google-apis-fcm_v1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +13 -0
- data/CHANGELOG.md +7 -0
- data/LICENSE.md +202 -0
- data/OVERVIEW.md +96 -0
- data/lib/google-apis-fcm_v1.rb +15 -0
- data/lib/google/apis/fcm_v1.rb +37 -0
- data/lib/google/apis/fcm_v1/classes.rb +825 -0
- data/lib/google/apis/fcm_v1/gem_version.rb +28 -0
- data/lib/google/apis/fcm_v1/representations.rb +262 -0
- data/lib/google/apis/fcm_v1/service.rb +98 -0
- metadata +76 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b20610027995a81a1d60b9bc0b86055f4db6a38403175e1509c3e3002f8e616c
|
4
|
+
data.tar.gz: 01f145945e49833b5f8bffd873252aeb8a306e230a21ab2b555cae00ea5b9462
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 964689da07e821180cf756b63bb877c74e1b3aad230f596186c64143353f3b8522badcdb831418ac9fbb4834845ebdcae1410ae5664a152a5d7eac26ee96b72e
|
7
|
+
data.tar.gz: 7f38b5825f356670a3a53c5aede1f50f94c4c36a0906ba400a8080632aef7cb5064fb6da403fb46058331f0afe7563966a0af53bdb8ba0b7a66b6ec9b25043ee
|
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
data/OVERVIEW.md
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# Simple REST client for version V1 of the Firebase Cloud Messaging API
|
2
|
+
|
3
|
+
This is a simple client library for version V1 of the Firebase Cloud Messaging API. It provides:
|
4
|
+
|
5
|
+
* A client object that connects to the HTTP/JSON REST endpoint for the service.
|
6
|
+
* Ruby objects for data structures related to the service.
|
7
|
+
* Integration with the googleauth gem for authentication using OAuth, API keys, and service accounts.
|
8
|
+
* Control of retry, pagination, and timeouts.
|
9
|
+
|
10
|
+
Note that although this client library is supported and will continue to be updated to track changes to the service, it is otherwise considered complete and not under active development. Many Google services, especially Google Cloud Platform services, may provide a more modern client that is under more active development and improvement. See the section below titled *Which client should I use?* for more information.
|
11
|
+
|
12
|
+
## Getting started
|
13
|
+
|
14
|
+
### Before you begin
|
15
|
+
|
16
|
+
There are a few setup steps you need to complete before you can use this library:
|
17
|
+
|
18
|
+
1. If you don't already have a Google account, [sign up](https://www.google.com/accounts).
|
19
|
+
2. If you have never created a Google APIs Console project, read about [Managing Projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects) and create a project in the [Google API Console](https://console.cloud.google.com/).
|
20
|
+
3. Most APIs need to be enabled for your project. [Enable it](https://console.cloud.google.com/apis/library/fcm.googleapis.com) in the console.
|
21
|
+
|
22
|
+
### Installation
|
23
|
+
|
24
|
+
Add this line to your application's Gemfile:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
gem 'google-apis-fcm_v1', '~> 0.1'
|
28
|
+
```
|
29
|
+
|
30
|
+
And then execute:
|
31
|
+
|
32
|
+
```
|
33
|
+
$ bundle
|
34
|
+
```
|
35
|
+
|
36
|
+
Or install it yourself as:
|
37
|
+
|
38
|
+
```
|
39
|
+
$ gem install google-apis-fcm_v1
|
40
|
+
```
|
41
|
+
|
42
|
+
### Creating a client object
|
43
|
+
|
44
|
+
Once the gem is installed, you can load the client code and instantiate a client.
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
# Load the client
|
48
|
+
require "google/apis/fcm_v1"
|
49
|
+
|
50
|
+
# Create a client object
|
51
|
+
client = Google::Apis::FcmV1::FirebaseCloudMessagingService.new
|
52
|
+
|
53
|
+
# Authenticate calls
|
54
|
+
client.authentication = # ... use the googleauth gem to create credentials
|
55
|
+
```
|
56
|
+
|
57
|
+
See the class reference docs for information on the methods you can call from a client.
|
58
|
+
|
59
|
+
## Documentation
|
60
|
+
|
61
|
+
More detailed descriptions of the Google simple REST clients are available in two documents.
|
62
|
+
|
63
|
+
* The [Usage Guide](https://github.com/googleapis/google-api-ruby-client/blob/master/docs/usage-guide.md) discusses how to make API calls, how to use the provided data structures, and how to work the various features of the client library, including media upload and download, error handling, retries, pagination, and logging.
|
64
|
+
* The [Auth Guide](https://github.com/googleapis/google-api-ruby-client/blob/master/docs/auth-guide.md) discusses authentication in the client libraries, including API keys, OAuth 2.0, service accounts, and environment variables.
|
65
|
+
|
66
|
+
(Note: the above documents are written for the simple REST clients in general, and their examples may not reflect the Fcm service in particular.)
|
67
|
+
|
68
|
+
For reference information on specific calls in the Firebase Cloud Messaging API, see the {Google::Apis::FcmV1::FirebaseCloudMessagingService class reference docs}.
|
69
|
+
|
70
|
+
## Which client should I use?
|
71
|
+
|
72
|
+
Google provides two types of Ruby API client libraries: **simple REST clients** and **modern clients**.
|
73
|
+
|
74
|
+
This library, `google-apis-fcm_v1`, is a simple REST client. You can identify these clients by their gem names, which are always in the form `google-apis-<servicename>_<serviceversion>`. The simple REST clients connect to HTTP/JSON REST endpoints and are automatically generated from service discovery documents. They support most API functionality, but their class interfaces are sometimes awkward.
|
75
|
+
|
76
|
+
Modern clients are produced by a modern code generator, sometimes combined with hand-crafted functionality. Most modern clients connect to high-performance gRPC endpoints, although a few are backed by REST services. Modern clients are available for many Google services, especially Google Cloud Platform services, but do not yet support all the services covered by the simple clients.
|
77
|
+
|
78
|
+
Gem names for modern clients are often of the form `google-cloud-<service_name>`. (For example, [google-cloud-pubsub](https://rubygems.org/gems/google-cloud-pubsub).) Note that most modern clients also have corresponding "versioned" gems with names like `google-cloud-<service_name>-<version>`. (For example, [google-cloud-pubsub-v1](https://rubygems.org/gems/google-cloud-pubsub-v1).) The "versioned" gems can be used directly, but often provide lower-level interfaces. In most cases, the main gem is recommended.
|
79
|
+
|
80
|
+
**For most users, we recommend the modern client, if one is available.** Compared with simple clients, modern clients are generally much easier to use and more Ruby-like, support more advanced features such as streaming and long-running operations, and often provide much better performance. You may consider using a simple client instead, if a modern client is not yet available for the service you want to use, or if you are not able to use gRPC on your infrastructure.
|
81
|
+
|
82
|
+
The [product documentation](https://firebase.google.com/docs/cloud-messaging) may provide guidance regarding the preferred client library to use.
|
83
|
+
|
84
|
+
## Supported Ruby versions
|
85
|
+
|
86
|
+
This library is supported on Ruby 2.5+.
|
87
|
+
|
88
|
+
Google provides official support for Ruby versions that are actively supported by Ruby Core -- that is, Ruby versions that are either in normal maintenance or in security maintenance, and not end of life. Currently, this means Ruby 2.5 and later. Older versions of Ruby _may_ still work, but are unsupported and not recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby support schedule.
|
89
|
+
|
90
|
+
## License
|
91
|
+
|
92
|
+
This library is licensed under Apache 2.0. Full license text is available in the {file:LICENSE.md LICENSE}.
|
93
|
+
|
94
|
+
## Support
|
95
|
+
|
96
|
+
Please [report bugs at the project on Github](https://github.com/google/google-api-ruby-client/issues). Don't hesitate to [ask questions](http://stackoverflow.com/questions/tagged/google-api-ruby-client) about the client or APIs on [StackOverflow](http://stackoverflow.com).
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Copyright 2020 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require "google/apis/fcm_v1"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Copyright 2020 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'google/apis/fcm_v1/service.rb'
|
16
|
+
require 'google/apis/fcm_v1/classes.rb'
|
17
|
+
require 'google/apis/fcm_v1/representations.rb'
|
18
|
+
require 'google/apis/fcm_v1/gem_version.rb'
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Apis
|
22
|
+
# Firebase Cloud Messaging API
|
23
|
+
#
|
24
|
+
# FCM send API that provides a cross-platform messaging solution to reliably
|
25
|
+
# deliver messages at no cost.
|
26
|
+
#
|
27
|
+
# @see https://firebase.google.com/docs/cloud-messaging
|
28
|
+
module FcmV1
|
29
|
+
# Version of the Firebase Cloud Messaging API this client connects to.
|
30
|
+
# This is NOT the gem version.
|
31
|
+
VERSION = 'V1'
|
32
|
+
|
33
|
+
# View and manage your data across Google Cloud Platform services
|
34
|
+
AUTH_CLOUD_PLATFORM = 'https://www.googleapis.com/auth/cloud-platform'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,825 @@
|
|
1
|
+
# Copyright 2020 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'date'
|
16
|
+
require 'google/apis/core/base_service'
|
17
|
+
require 'google/apis/core/json_representation'
|
18
|
+
require 'google/apis/core/hashable'
|
19
|
+
require 'google/apis/errors'
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Apis
|
23
|
+
module FcmV1
|
24
|
+
|
25
|
+
# Android specific options for messages sent through [FCM connection server](
|
26
|
+
# https://goo.gl/4GLdUl).
|
27
|
+
class AndroidConfig
|
28
|
+
include Google::Apis::Core::Hashable
|
29
|
+
|
30
|
+
# An identifier of a group of messages that can be collapsed, so that only the
|
31
|
+
# last message gets sent when delivery can be resumed. A maximum of 4 different
|
32
|
+
# collapse keys is allowed at any given time.
|
33
|
+
# Corresponds to the JSON property `collapseKey`
|
34
|
+
# @return [String]
|
35
|
+
attr_accessor :collapse_key
|
36
|
+
|
37
|
+
# Arbitrary key/value payload. If present, it will override google.firebase.fcm.
|
38
|
+
# v1.Message.data.
|
39
|
+
# Corresponds to the JSON property `data`
|
40
|
+
# @return [Hash<String,String>]
|
41
|
+
attr_accessor :data
|
42
|
+
|
43
|
+
# If set to true, messages will be allowed to be delivered to the app while the
|
44
|
+
# device is in direct boot mode. See [Support Direct Boot mode](https://
|
45
|
+
# developer.android.com/training/articles/direct-boot).
|
46
|
+
# Corresponds to the JSON property `directBootOk`
|
47
|
+
# @return [Boolean]
|
48
|
+
attr_accessor :direct_boot_ok
|
49
|
+
alias_method :direct_boot_ok?, :direct_boot_ok
|
50
|
+
|
51
|
+
# Options for features provided by the FCM SDK for Android.
|
52
|
+
# Corresponds to the JSON property `fcmOptions`
|
53
|
+
# @return [Google::Apis::FcmV1::AndroidFcmOptions]
|
54
|
+
attr_accessor :fcm_options
|
55
|
+
|
56
|
+
# Notification to send to android devices.
|
57
|
+
# Corresponds to the JSON property `notification`
|
58
|
+
# @return [Google::Apis::FcmV1::AndroidNotification]
|
59
|
+
attr_accessor :notification
|
60
|
+
|
61
|
+
# Message priority. Can take "normal" and "high" values. For more information,
|
62
|
+
# see [Setting the priority of a message](https://goo.gl/GjONJv).
|
63
|
+
# Corresponds to the JSON property `priority`
|
64
|
+
# @return [String]
|
65
|
+
attr_accessor :priority
|
66
|
+
|
67
|
+
# Package name of the application where the registration token must match in
|
68
|
+
# order to receive the message.
|
69
|
+
# Corresponds to the JSON property `restrictedPackageName`
|
70
|
+
# @return [String]
|
71
|
+
attr_accessor :restricted_package_name
|
72
|
+
|
73
|
+
# How long (in seconds) the message should be kept in FCM storage if the device
|
74
|
+
# is offline. The maximum time to live supported is 4 weeks, and the default
|
75
|
+
# value is 4 weeks if not set. Set it to 0 if want to send the message
|
76
|
+
# immediately. In JSON format, the Duration type is encoded as a string rather
|
77
|
+
# than an object, where the string ends in the suffix "s" (indicating seconds)
|
78
|
+
# and is preceded by the number of seconds, with nanoseconds expressed as
|
79
|
+
# fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
80
|
+
# encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should be
|
81
|
+
# expressed in JSON format as "3.000000001s". The ttl will be rounded down to
|
82
|
+
# the nearest second.
|
83
|
+
# Corresponds to the JSON property `ttl`
|
84
|
+
# @return [String]
|
85
|
+
attr_accessor :ttl
|
86
|
+
|
87
|
+
def initialize(**args)
|
88
|
+
update!(**args)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Update properties of this object
|
92
|
+
def update!(**args)
|
93
|
+
@collapse_key = args[:collapse_key] if args.key?(:collapse_key)
|
94
|
+
@data = args[:data] if args.key?(:data)
|
95
|
+
@direct_boot_ok = args[:direct_boot_ok] if args.key?(:direct_boot_ok)
|
96
|
+
@fcm_options = args[:fcm_options] if args.key?(:fcm_options)
|
97
|
+
@notification = args[:notification] if args.key?(:notification)
|
98
|
+
@priority = args[:priority] if args.key?(:priority)
|
99
|
+
@restricted_package_name = args[:restricted_package_name] if args.key?(:restricted_package_name)
|
100
|
+
@ttl = args[:ttl] if args.key?(:ttl)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# Options for features provided by the FCM SDK for Android.
|
105
|
+
class AndroidFcmOptions
|
106
|
+
include Google::Apis::Core::Hashable
|
107
|
+
|
108
|
+
# Label associated with the message's analytics data.
|
109
|
+
# Corresponds to the JSON property `analyticsLabel`
|
110
|
+
# @return [String]
|
111
|
+
attr_accessor :analytics_label
|
112
|
+
|
113
|
+
def initialize(**args)
|
114
|
+
update!(**args)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Update properties of this object
|
118
|
+
def update!(**args)
|
119
|
+
@analytics_label = args[:analytics_label] if args.key?(:analytics_label)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# Notification to send to android devices.
|
124
|
+
class AndroidNotification
|
125
|
+
include Google::Apis::Core::Hashable
|
126
|
+
|
127
|
+
# The notification's body text. If present, it will override google.firebase.fcm.
|
128
|
+
# v1.Notification.body.
|
129
|
+
# Corresponds to the JSON property `body`
|
130
|
+
# @return [String]
|
131
|
+
attr_accessor :body
|
132
|
+
|
133
|
+
# Variable string values to be used in place of the format specifiers in
|
134
|
+
# body_loc_key to use to localize the body text to the user's current
|
135
|
+
# localization. See [Formatting and Styling](https://goo.gl/MalYE3) for more
|
136
|
+
# information.
|
137
|
+
# Corresponds to the JSON property `bodyLocArgs`
|
138
|
+
# @return [Array<String>]
|
139
|
+
attr_accessor :body_loc_args
|
140
|
+
|
141
|
+
# The key to the body string in the app's string resources to use to localize
|
142
|
+
# the body text to the user's current localization. See [String Resources](https:
|
143
|
+
# //goo.gl/NdFZGI) for more information.
|
144
|
+
# Corresponds to the JSON property `bodyLocKey`
|
145
|
+
# @return [String]
|
146
|
+
attr_accessor :body_loc_key
|
147
|
+
|
148
|
+
# The [notification's channel id](https://developer.android.com/guide/topics/ui/
|
149
|
+
# notifiers/notifications#ManageChannels) (new in Android O). The app must
|
150
|
+
# create a channel with this channel ID before any notification with this
|
151
|
+
# channel ID is received. If you don't send this channel ID in the request, or
|
152
|
+
# if the channel ID provided has not yet been created by the app, FCM uses the
|
153
|
+
# channel ID specified in the app manifest.
|
154
|
+
# Corresponds to the JSON property `channelId`
|
155
|
+
# @return [String]
|
156
|
+
attr_accessor :channel_id
|
157
|
+
|
158
|
+
# The action associated with a user click on the notification. If specified, an
|
159
|
+
# activity with a matching intent filter is launched when a user clicks on the
|
160
|
+
# notification.
|
161
|
+
# Corresponds to the JSON property `clickAction`
|
162
|
+
# @return [String]
|
163
|
+
attr_accessor :click_action
|
164
|
+
|
165
|
+
# The notification's icon color, expressed in #rrggbb format.
|
166
|
+
# Corresponds to the JSON property `color`
|
167
|
+
# @return [String]
|
168
|
+
attr_accessor :color
|
169
|
+
|
170
|
+
# If set to true, use the Android framework's default LED light settings for the
|
171
|
+
# notification. Default values are specified in [config.xml](https://android.
|
172
|
+
# googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.
|
173
|
+
# xml). If `default_light_settings` is set to true and `light_settings` is also
|
174
|
+
# set, the user-specified `light_settings` is used instead of the default value.
|
175
|
+
# Corresponds to the JSON property `defaultLightSettings`
|
176
|
+
# @return [Boolean]
|
177
|
+
attr_accessor :default_light_settings
|
178
|
+
alias_method :default_light_settings?, :default_light_settings
|
179
|
+
|
180
|
+
# If set to true, use the Android framework's default sound for the notification.
|
181
|
+
# Default values are specified in [config.xml](https://android.googlesource.com/
|
182
|
+
# platform/frameworks/base/+/master/core/res/res/values/config.xml).
|
183
|
+
# Corresponds to the JSON property `defaultSound`
|
184
|
+
# @return [Boolean]
|
185
|
+
attr_accessor :default_sound
|
186
|
+
alias_method :default_sound?, :default_sound
|
187
|
+
|
188
|
+
# If set to true, use the Android framework's default vibrate pattern for the
|
189
|
+
# notification. Default values are specified in [config.xml](https://android.
|
190
|
+
# googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.
|
191
|
+
# xml). If `default_vibrate_timings` is set to true and `vibrate_timings` is
|
192
|
+
# also set, the default value is used instead of the user-specified `
|
193
|
+
# vibrate_timings`.
|
194
|
+
# Corresponds to the JSON property `defaultVibrateTimings`
|
195
|
+
# @return [Boolean]
|
196
|
+
attr_accessor :default_vibrate_timings
|
197
|
+
alias_method :default_vibrate_timings?, :default_vibrate_timings
|
198
|
+
|
199
|
+
# Set the time that the event in the notification occurred. Notifications in the
|
200
|
+
# panel are sorted by this time. A point in time is represented using [protobuf.
|
201
|
+
# Timestamp](https://developers.google.com/protocol-buffers/docs/reference/java/
|
202
|
+
# com/google/protobuf/Timestamp).
|
203
|
+
# Corresponds to the JSON property `eventTime`
|
204
|
+
# @return [String]
|
205
|
+
attr_accessor :event_time
|
206
|
+
|
207
|
+
# The notification's icon. Sets the notification icon to myicon for drawable
|
208
|
+
# resource myicon. If you don't send this key in the request, FCM displays the
|
209
|
+
# launcher icon specified in your app manifest.
|
210
|
+
# Corresponds to the JSON property `icon`
|
211
|
+
# @return [String]
|
212
|
+
attr_accessor :icon
|
213
|
+
|
214
|
+
# Contains the URL of an image that is going to be displayed in a notification.
|
215
|
+
# If present, it will override google.firebase.fcm.v1.Notification.image.
|
216
|
+
# Corresponds to the JSON property `image`
|
217
|
+
# @return [String]
|
218
|
+
attr_accessor :image
|
219
|
+
|
220
|
+
# Settings to control notification LED.
|
221
|
+
# Corresponds to the JSON property `lightSettings`
|
222
|
+
# @return [Google::Apis::FcmV1::LightSettings]
|
223
|
+
attr_accessor :light_settings
|
224
|
+
|
225
|
+
# Set whether or not this notification is relevant only to the current device.
|
226
|
+
# Some notifications can be bridged to other devices for remote display, such as
|
227
|
+
# a Wear OS watch. This hint can be set to recommend this notification not be
|
228
|
+
# bridged. See [Wear OS guides](https://developer.android.com/training/wearables/
|
229
|
+
# notifications/bridger#existing-method-of-preventing-bridging)
|
230
|
+
# Corresponds to the JSON property `localOnly`
|
231
|
+
# @return [Boolean]
|
232
|
+
attr_accessor :local_only
|
233
|
+
alias_method :local_only?, :local_only
|
234
|
+
|
235
|
+
# Sets the number of items this notification represents. May be displayed as a
|
236
|
+
# badge count for launchers that support badging.See [Notification Badge](https:/
|
237
|
+
# /developer.android.com/training/notify-user/badges). For example, this might
|
238
|
+
# be useful if you're using just one notification to represent multiple new
|
239
|
+
# messages but you want the count here to represent the number of total new
|
240
|
+
# messages. If zero or unspecified, systems that support badging use the default,
|
241
|
+
# which is to increment a number displayed on the long-press menu each time a
|
242
|
+
# new notification arrives.
|
243
|
+
# Corresponds to the JSON property `notificationCount`
|
244
|
+
# @return [Fixnum]
|
245
|
+
attr_accessor :notification_count
|
246
|
+
|
247
|
+
# Set the relative priority for this notification. Priority is an indication of
|
248
|
+
# how much of the user's attention should be consumed by this notification. Low-
|
249
|
+
# priority notifications may be hidden from the user in certain situations,
|
250
|
+
# while the user might be interrupted for a higher-priority notification. The
|
251
|
+
# effect of setting the same priorities may differ slightly on different
|
252
|
+
# platforms. Note this priority differs from `AndroidMessagePriority`. This
|
253
|
+
# priority is processed by the client after the message has been delivered,
|
254
|
+
# whereas [AndroidMessagePriority](https://firebase.google.com/docs/reference/
|
255
|
+
# fcm/rest/v1/projects.messages#androidmessagepriority) is an FCM concept that
|
256
|
+
# controls when the message is delivered.
|
257
|
+
# Corresponds to the JSON property `notificationPriority`
|
258
|
+
# @return [String]
|
259
|
+
attr_accessor :notification_priority
|
260
|
+
|
261
|
+
# The sound to play when the device receives the notification. Supports "default"
|
262
|
+
# or the filename of a sound resource bundled in the app. Sound files must
|
263
|
+
# reside in /res/raw/.
|
264
|
+
# Corresponds to the JSON property `sound`
|
265
|
+
# @return [String]
|
266
|
+
attr_accessor :sound
|
267
|
+
|
268
|
+
# When set to false or unset, the notification is automatically dismissed when
|
269
|
+
# the user clicks it in the panel. When set to true, the notification persists
|
270
|
+
# even when the user clicks it.
|
271
|
+
# Corresponds to the JSON property `sticky`
|
272
|
+
# @return [Boolean]
|
273
|
+
attr_accessor :sticky
|
274
|
+
alias_method :sticky?, :sticky
|
275
|
+
|
276
|
+
# Identifier used to replace existing notifications in the notification drawer.
|
277
|
+
# If not specified, each request creates a new notification. If specified and a
|
278
|
+
# notification with the same tag is already being shown, the new notification
|
279
|
+
# replaces the existing one in the notification drawer.
|
280
|
+
# Corresponds to the JSON property `tag`
|
281
|
+
# @return [String]
|
282
|
+
attr_accessor :tag
|
283
|
+
|
284
|
+
# Sets the "ticker" text, which is sent to accessibility services. Prior to API
|
285
|
+
# level 21 (`Lollipop`), sets the text that is displayed in the status bar when
|
286
|
+
# the notification first arrives.
|
287
|
+
# Corresponds to the JSON property `ticker`
|
288
|
+
# @return [String]
|
289
|
+
attr_accessor :ticker
|
290
|
+
|
291
|
+
# The notification's title. If present, it will override google.firebase.fcm.v1.
|
292
|
+
# Notification.title.
|
293
|
+
# Corresponds to the JSON property `title`
|
294
|
+
# @return [String]
|
295
|
+
attr_accessor :title
|
296
|
+
|
297
|
+
# Variable string values to be used in place of the format specifiers in
|
298
|
+
# title_loc_key to use to localize the title text to the user's current
|
299
|
+
# localization. See [Formatting and Styling](https://goo.gl/MalYE3) for more
|
300
|
+
# information.
|
301
|
+
# Corresponds to the JSON property `titleLocArgs`
|
302
|
+
# @return [Array<String>]
|
303
|
+
attr_accessor :title_loc_args
|
304
|
+
|
305
|
+
# The key to the title string in the app's string resources to use to localize
|
306
|
+
# the title text to the user's current localization. See [String Resources](
|
307
|
+
# https://goo.gl/NdFZGI) for more information.
|
308
|
+
# Corresponds to the JSON property `titleLocKey`
|
309
|
+
# @return [String]
|
310
|
+
attr_accessor :title_loc_key
|
311
|
+
|
312
|
+
# Set the vibration pattern to use. Pass in an array of [protobuf.Duration](
|
313
|
+
# https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#
|
314
|
+
# google.protobuf.Duration) to turn on or off the vibrator. The first value
|
315
|
+
# indicates the `Duration` to wait before turning the vibrator on. The next
|
316
|
+
# value indicates the `Duration` to keep the vibrator on. Subsequent values
|
317
|
+
# alternate between `Duration` to turn the vibrator off and to turn the vibrator
|
318
|
+
# on. If `vibrate_timings` is set and `default_vibrate_timings` is set to `true`,
|
319
|
+
# the default value is used instead of the user-specified `vibrate_timings`.
|
320
|
+
# Corresponds to the JSON property `vibrateTimings`
|
321
|
+
# @return [Array<String>]
|
322
|
+
attr_accessor :vibrate_timings
|
323
|
+
|
324
|
+
# Set the [Notification.visibility](https://developer.android.com/reference/
|
325
|
+
# android/app/Notification.html#visibility) of the notification.
|
326
|
+
# Corresponds to the JSON property `visibility`
|
327
|
+
# @return [String]
|
328
|
+
attr_accessor :visibility
|
329
|
+
|
330
|
+
def initialize(**args)
|
331
|
+
update!(**args)
|
332
|
+
end
|
333
|
+
|
334
|
+
# Update properties of this object
|
335
|
+
def update!(**args)
|
336
|
+
@body = args[:body] if args.key?(:body)
|
337
|
+
@body_loc_args = args[:body_loc_args] if args.key?(:body_loc_args)
|
338
|
+
@body_loc_key = args[:body_loc_key] if args.key?(:body_loc_key)
|
339
|
+
@channel_id = args[:channel_id] if args.key?(:channel_id)
|
340
|
+
@click_action = args[:click_action] if args.key?(:click_action)
|
341
|
+
@color = args[:color] if args.key?(:color)
|
342
|
+
@default_light_settings = args[:default_light_settings] if args.key?(:default_light_settings)
|
343
|
+
@default_sound = args[:default_sound] if args.key?(:default_sound)
|
344
|
+
@default_vibrate_timings = args[:default_vibrate_timings] if args.key?(:default_vibrate_timings)
|
345
|
+
@event_time = args[:event_time] if args.key?(:event_time)
|
346
|
+
@icon = args[:icon] if args.key?(:icon)
|
347
|
+
@image = args[:image] if args.key?(:image)
|
348
|
+
@light_settings = args[:light_settings] if args.key?(:light_settings)
|
349
|
+
@local_only = args[:local_only] if args.key?(:local_only)
|
350
|
+
@notification_count = args[:notification_count] if args.key?(:notification_count)
|
351
|
+
@notification_priority = args[:notification_priority] if args.key?(:notification_priority)
|
352
|
+
@sound = args[:sound] if args.key?(:sound)
|
353
|
+
@sticky = args[:sticky] if args.key?(:sticky)
|
354
|
+
@tag = args[:tag] if args.key?(:tag)
|
355
|
+
@ticker = args[:ticker] if args.key?(:ticker)
|
356
|
+
@title = args[:title] if args.key?(:title)
|
357
|
+
@title_loc_args = args[:title_loc_args] if args.key?(:title_loc_args)
|
358
|
+
@title_loc_key = args[:title_loc_key] if args.key?(:title_loc_key)
|
359
|
+
@vibrate_timings = args[:vibrate_timings] if args.key?(:vibrate_timings)
|
360
|
+
@visibility = args[:visibility] if args.key?(:visibility)
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
# [Apple Push Notification Service](https://goo.gl/MXRTPa) specific options.
|
365
|
+
class ApnsConfig
|
366
|
+
include Google::Apis::Core::Hashable
|
367
|
+
|
368
|
+
# Options for features provided by the FCM SDK for iOS.
|
369
|
+
# Corresponds to the JSON property `fcmOptions`
|
370
|
+
# @return [Google::Apis::FcmV1::ApnsFcmOptions]
|
371
|
+
attr_accessor :fcm_options
|
372
|
+
|
373
|
+
# HTTP request headers defined in Apple Push Notification Service. Refer to [
|
374
|
+
# APNs request headers](https://developer.apple.com/documentation/
|
375
|
+
# usernotifications/setting_up_a_remote_notification_server/
|
376
|
+
# sending_notification_requests_to_apns) for supported headers, e.g. "apns-
|
377
|
+
# priority": "10".
|
378
|
+
# Corresponds to the JSON property `headers`
|
379
|
+
# @return [Hash<String,String>]
|
380
|
+
attr_accessor :headers
|
381
|
+
|
382
|
+
# APNs payload as a JSON object, including both `aps` dictionary and custom
|
383
|
+
# payload. See [Payload Key Reference](https://developer.apple.com/documentation/
|
384
|
+
# usernotifications/setting_up_a_remote_notification_server/
|
385
|
+
# generating_a_remote_notification). If present, it overrides google.firebase.
|
386
|
+
# fcm.v1.Notification.title and google.firebase.fcm.v1.Notification.body.
|
387
|
+
# Corresponds to the JSON property `payload`
|
388
|
+
# @return [Hash<String,Object>]
|
389
|
+
attr_accessor :payload
|
390
|
+
|
391
|
+
def initialize(**args)
|
392
|
+
update!(**args)
|
393
|
+
end
|
394
|
+
|
395
|
+
# Update properties of this object
|
396
|
+
def update!(**args)
|
397
|
+
@fcm_options = args[:fcm_options] if args.key?(:fcm_options)
|
398
|
+
@headers = args[:headers] if args.key?(:headers)
|
399
|
+
@payload = args[:payload] if args.key?(:payload)
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
# Options for features provided by the FCM SDK for iOS.
|
404
|
+
class ApnsFcmOptions
|
405
|
+
include Google::Apis::Core::Hashable
|
406
|
+
|
407
|
+
# Label associated with the message's analytics data.
|
408
|
+
# Corresponds to the JSON property `analyticsLabel`
|
409
|
+
# @return [String]
|
410
|
+
attr_accessor :analytics_label
|
411
|
+
|
412
|
+
# Contains the URL of an image that is going to be displayed in a notification.
|
413
|
+
# If present, it will override google.firebase.fcm.v1.Notification.image.
|
414
|
+
# Corresponds to the JSON property `image`
|
415
|
+
# @return [String]
|
416
|
+
attr_accessor :image
|
417
|
+
|
418
|
+
def initialize(**args)
|
419
|
+
update!(**args)
|
420
|
+
end
|
421
|
+
|
422
|
+
# Update properties of this object
|
423
|
+
def update!(**args)
|
424
|
+
@analytics_label = args[:analytics_label] if args.key?(:analytics_label)
|
425
|
+
@image = args[:image] if args.key?(:image)
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
# Represents a color in the RGBA color space. This representation is designed
|
430
|
+
# for simplicity of conversion to/from color representations in various
|
431
|
+
# languages over compactness; for example, the fields of this representation can
|
432
|
+
# be trivially provided to the constructor of "java.awt.Color" in Java; it can
|
433
|
+
# also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha"
|
434
|
+
# method in iOS; and, with just a little work, it can be easily formatted into a
|
435
|
+
# CSS "rgba()" string in JavaScript, as well. Note: this proto does not carry
|
436
|
+
# information about the absolute color space that should be used to interpret
|
437
|
+
# the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default,
|
438
|
+
# applications SHOULD assume the sRGB color space. Note: when color equality
|
439
|
+
# needs to be decided, implementations, unless documented otherwise, will treat
|
440
|
+
# two colors to be equal if all their red, green, blue and alpha values each
|
441
|
+
# differ by at most 1e-5. Example (Java): import com.google.type.Color; // ...
|
442
|
+
# public static java.awt.Color fromProto(Color protocolor) ` float alpha =
|
443
|
+
# protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new
|
444
|
+
# java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(
|
445
|
+
# ), alpha); ` public static Color toProto(java.awt.Color color) ` float red = (
|
446
|
+
# float) color.getRed(); float green = (float) color.getGreen(); float blue = (
|
447
|
+
# float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder
|
448
|
+
# = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator)
|
449
|
+
# .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255)
|
450
|
+
# ` result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) /
|
451
|
+
# denominator) .build()); ` return resultBuilder.build(); ` // ... Example (iOS /
|
452
|
+
# Obj-C): // ... static UIColor* fromProto(Color* protocolor) ` float red = [
|
453
|
+
# protocolor red]; float green = [protocolor green]; float blue = [protocolor
|
454
|
+
# blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (
|
455
|
+
# alpha_wrapper != nil) ` alpha = [alpha_wrapper value]; ` return [UIColor
|
456
|
+
# colorWithRed:red green:green blue:blue alpha:alpha]; ` static Color* toProto(
|
457
|
+
# UIColor* color) ` CGFloat red, green, blue, alpha; if (![color getRed:&red
|
458
|
+
# green:&green blue:&blue alpha:&alpha]) ` return nil; ` Color* result = [[Color
|
459
|
+
# alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:
|
460
|
+
# blue]; if (alpha <= 0.9999) ` [result setAlpha:floatWrapperWithValue(alpha)]; `
|
461
|
+
# [result autorelease]; return result; ` // ... Example (JavaScript): // ...
|
462
|
+
# var protoToCssColor = function(rgb_color) ` var redFrac = rgb_color.red || 0.0;
|
463
|
+
# var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0;
|
464
|
+
# var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255);
|
465
|
+
# var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) ` return
|
466
|
+
# rgbToCssColor_(red, green, blue); ` var alphaFrac = rgb_color.alpha.value || 0.
|
467
|
+
# 0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',
|
468
|
+
# ', alphaFrac, ')'].join(''); `; var rgbToCssColor_ = function(red, green, blue)
|
469
|
+
# ` var rgbNumber = new Number((red << 16) | (green << 8) | blue); var
|
470
|
+
# hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length;
|
471
|
+
# var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) `
|
472
|
+
# resultBuilder.push('0'); ` resultBuilder.push(hexString); return resultBuilder.
|
473
|
+
# join(''); `; // ...
|
474
|
+
class Color
|
475
|
+
include Google::Apis::Core::Hashable
|
476
|
+
|
477
|
+
# The fraction of this color that should be applied to the pixel. That is, the
|
478
|
+
# final pixel color is defined by the equation: pixel color = alpha * (this
|
479
|
+
# color) + (1.0 - alpha) * (background color) This means that a value of 1.0
|
480
|
+
# corresponds to a solid color, whereas a value of 0.0 corresponds to a
|
481
|
+
# completely transparent color. This uses a wrapper message rather than a simple
|
482
|
+
# float scalar so that it is possible to distinguish between a default value and
|
483
|
+
# the value being unset. If omitted, this color object is to be rendered as a
|
484
|
+
# solid color (as if the alpha value had been explicitly given with a value of 1.
|
485
|
+
# 0).
|
486
|
+
# Corresponds to the JSON property `alpha`
|
487
|
+
# @return [Float]
|
488
|
+
attr_accessor :alpha
|
489
|
+
|
490
|
+
# The amount of blue in the color as a value in the interval [0, 1].
|
491
|
+
# Corresponds to the JSON property `blue`
|
492
|
+
# @return [Float]
|
493
|
+
attr_accessor :blue
|
494
|
+
|
495
|
+
# The amount of green in the color as a value in the interval [0, 1].
|
496
|
+
# Corresponds to the JSON property `green`
|
497
|
+
# @return [Float]
|
498
|
+
attr_accessor :green
|
499
|
+
|
500
|
+
# The amount of red in the color as a value in the interval [0, 1].
|
501
|
+
# Corresponds to the JSON property `red`
|
502
|
+
# @return [Float]
|
503
|
+
attr_accessor :red
|
504
|
+
|
505
|
+
def initialize(**args)
|
506
|
+
update!(**args)
|
507
|
+
end
|
508
|
+
|
509
|
+
# Update properties of this object
|
510
|
+
def update!(**args)
|
511
|
+
@alpha = args[:alpha] if args.key?(:alpha)
|
512
|
+
@blue = args[:blue] if args.key?(:blue)
|
513
|
+
@green = args[:green] if args.key?(:green)
|
514
|
+
@red = args[:red] if args.key?(:red)
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
518
|
+
# Platform independent options for features provided by the FCM SDKs.
|
519
|
+
class FcmOptions
|
520
|
+
include Google::Apis::Core::Hashable
|
521
|
+
|
522
|
+
# Label associated with the message's analytics data.
|
523
|
+
# Corresponds to the JSON property `analyticsLabel`
|
524
|
+
# @return [String]
|
525
|
+
attr_accessor :analytics_label
|
526
|
+
|
527
|
+
def initialize(**args)
|
528
|
+
update!(**args)
|
529
|
+
end
|
530
|
+
|
531
|
+
# Update properties of this object
|
532
|
+
def update!(**args)
|
533
|
+
@analytics_label = args[:analytics_label] if args.key?(:analytics_label)
|
534
|
+
end
|
535
|
+
end
|
536
|
+
|
537
|
+
# Settings to control notification LED.
|
538
|
+
class LightSettings
|
539
|
+
include Google::Apis::Core::Hashable
|
540
|
+
|
541
|
+
# Represents a color in the RGBA color space. This representation is designed
|
542
|
+
# for simplicity of conversion to/from color representations in various
|
543
|
+
# languages over compactness; for example, the fields of this representation can
|
544
|
+
# be trivially provided to the constructor of "java.awt.Color" in Java; it can
|
545
|
+
# also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha"
|
546
|
+
# method in iOS; and, with just a little work, it can be easily formatted into a
|
547
|
+
# CSS "rgba()" string in JavaScript, as well. Note: this proto does not carry
|
548
|
+
# information about the absolute color space that should be used to interpret
|
549
|
+
# the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default,
|
550
|
+
# applications SHOULD assume the sRGB color space. Note: when color equality
|
551
|
+
# needs to be decided, implementations, unless documented otherwise, will treat
|
552
|
+
# two colors to be equal if all their red, green, blue and alpha values each
|
553
|
+
# differ by at most 1e-5. Example (Java): import com.google.type.Color; // ...
|
554
|
+
# public static java.awt.Color fromProto(Color protocolor) ` float alpha =
|
555
|
+
# protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new
|
556
|
+
# java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(
|
557
|
+
# ), alpha); ` public static Color toProto(java.awt.Color color) ` float red = (
|
558
|
+
# float) color.getRed(); float green = (float) color.getGreen(); float blue = (
|
559
|
+
# float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder
|
560
|
+
# = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator)
|
561
|
+
# .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255)
|
562
|
+
# ` result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) /
|
563
|
+
# denominator) .build()); ` return resultBuilder.build(); ` // ... Example (iOS /
|
564
|
+
# Obj-C): // ... static UIColor* fromProto(Color* protocolor) ` float red = [
|
565
|
+
# protocolor red]; float green = [protocolor green]; float blue = [protocolor
|
566
|
+
# blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (
|
567
|
+
# alpha_wrapper != nil) ` alpha = [alpha_wrapper value]; ` return [UIColor
|
568
|
+
# colorWithRed:red green:green blue:blue alpha:alpha]; ` static Color* toProto(
|
569
|
+
# UIColor* color) ` CGFloat red, green, blue, alpha; if (![color getRed:&red
|
570
|
+
# green:&green blue:&blue alpha:&alpha]) ` return nil; ` Color* result = [[Color
|
571
|
+
# alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:
|
572
|
+
# blue]; if (alpha <= 0.9999) ` [result setAlpha:floatWrapperWithValue(alpha)]; `
|
573
|
+
# [result autorelease]; return result; ` // ... Example (JavaScript): // ...
|
574
|
+
# var protoToCssColor = function(rgb_color) ` var redFrac = rgb_color.red || 0.0;
|
575
|
+
# var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0;
|
576
|
+
# var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255);
|
577
|
+
# var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) ` return
|
578
|
+
# rgbToCssColor_(red, green, blue); ` var alphaFrac = rgb_color.alpha.value || 0.
|
579
|
+
# 0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',
|
580
|
+
# ', alphaFrac, ')'].join(''); `; var rgbToCssColor_ = function(red, green, blue)
|
581
|
+
# ` var rgbNumber = new Number((red << 16) | (green << 8) | blue); var
|
582
|
+
# hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length;
|
583
|
+
# var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) `
|
584
|
+
# resultBuilder.push('0'); ` resultBuilder.push(hexString); return resultBuilder.
|
585
|
+
# join(''); `; // ...
|
586
|
+
# Corresponds to the JSON property `color`
|
587
|
+
# @return [Google::Apis::FcmV1::Color]
|
588
|
+
attr_accessor :color
|
589
|
+
|
590
|
+
# Required. Along with `light_on_duration `, define the blink rate of LED
|
591
|
+
# flashes. Resolution defined by [proto.Duration](https://developers.google.com/
|
592
|
+
# protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration)
|
593
|
+
# Corresponds to the JSON property `lightOffDuration`
|
594
|
+
# @return [String]
|
595
|
+
attr_accessor :light_off_duration
|
596
|
+
|
597
|
+
# Required. Along with `light_off_duration`, define the blink rate of LED
|
598
|
+
# flashes. Resolution defined by [proto.Duration](https://developers.google.com/
|
599
|
+
# protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration)
|
600
|
+
# Corresponds to the JSON property `lightOnDuration`
|
601
|
+
# @return [String]
|
602
|
+
attr_accessor :light_on_duration
|
603
|
+
|
604
|
+
def initialize(**args)
|
605
|
+
update!(**args)
|
606
|
+
end
|
607
|
+
|
608
|
+
# Update properties of this object
|
609
|
+
def update!(**args)
|
610
|
+
@color = args[:color] if args.key?(:color)
|
611
|
+
@light_off_duration = args[:light_off_duration] if args.key?(:light_off_duration)
|
612
|
+
@light_on_duration = args[:light_on_duration] if args.key?(:light_on_duration)
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
616
|
+
# Message to send by Firebase Cloud Messaging Service.
|
617
|
+
class Message
|
618
|
+
include Google::Apis::Core::Hashable
|
619
|
+
|
620
|
+
# Android specific options for messages sent through [FCM connection server](
|
621
|
+
# https://goo.gl/4GLdUl).
|
622
|
+
# Corresponds to the JSON property `android`
|
623
|
+
# @return [Google::Apis::FcmV1::AndroidConfig]
|
624
|
+
attr_accessor :android
|
625
|
+
|
626
|
+
# [Apple Push Notification Service](https://goo.gl/MXRTPa) specific options.
|
627
|
+
# Corresponds to the JSON property `apns`
|
628
|
+
# @return [Google::Apis::FcmV1::ApnsConfig]
|
629
|
+
attr_accessor :apns
|
630
|
+
|
631
|
+
# Condition to send a message to, e.g. "'foo' in topics && 'bar' in topics".
|
632
|
+
# Corresponds to the JSON property `condition`
|
633
|
+
# @return [String]
|
634
|
+
attr_accessor :condition
|
635
|
+
|
636
|
+
# Input only. Arbitrary key/value payload. The key should not be a reserved word
|
637
|
+
# ("from", "message_type", or any word starting with "google" or "gcm").
|
638
|
+
# Corresponds to the JSON property `data`
|
639
|
+
# @return [Hash<String,String>]
|
640
|
+
attr_accessor :data
|
641
|
+
|
642
|
+
# Platform independent options for features provided by the FCM SDKs.
|
643
|
+
# Corresponds to the JSON property `fcmOptions`
|
644
|
+
# @return [Google::Apis::FcmV1::FcmOptions]
|
645
|
+
attr_accessor :fcm_options
|
646
|
+
|
647
|
+
# Output Only. The identifier of the message sent, in the format of `projects/*/
|
648
|
+
# messages/`message_id``.
|
649
|
+
# Corresponds to the JSON property `name`
|
650
|
+
# @return [String]
|
651
|
+
attr_accessor :name
|
652
|
+
|
653
|
+
# Basic notification template to use across all platforms.
|
654
|
+
# Corresponds to the JSON property `notification`
|
655
|
+
# @return [Google::Apis::FcmV1::Notification]
|
656
|
+
attr_accessor :notification
|
657
|
+
|
658
|
+
# Registration token to send a message to.
|
659
|
+
# Corresponds to the JSON property `token`
|
660
|
+
# @return [String]
|
661
|
+
attr_accessor :token
|
662
|
+
|
663
|
+
# Topic name to send a message to, e.g. "weather". Note: "/topics/" prefix
|
664
|
+
# should not be provided.
|
665
|
+
# Corresponds to the JSON property `topic`
|
666
|
+
# @return [String]
|
667
|
+
attr_accessor :topic
|
668
|
+
|
669
|
+
# [Webpush protocol](https://tools.ietf.org/html/rfc8030) options.
|
670
|
+
# Corresponds to the JSON property `webpush`
|
671
|
+
# @return [Google::Apis::FcmV1::WebpushConfig]
|
672
|
+
attr_accessor :webpush
|
673
|
+
|
674
|
+
def initialize(**args)
|
675
|
+
update!(**args)
|
676
|
+
end
|
677
|
+
|
678
|
+
# Update properties of this object
|
679
|
+
def update!(**args)
|
680
|
+
@android = args[:android] if args.key?(:android)
|
681
|
+
@apns = args[:apns] if args.key?(:apns)
|
682
|
+
@condition = args[:condition] if args.key?(:condition)
|
683
|
+
@data = args[:data] if args.key?(:data)
|
684
|
+
@fcm_options = args[:fcm_options] if args.key?(:fcm_options)
|
685
|
+
@name = args[:name] if args.key?(:name)
|
686
|
+
@notification = args[:notification] if args.key?(:notification)
|
687
|
+
@token = args[:token] if args.key?(:token)
|
688
|
+
@topic = args[:topic] if args.key?(:topic)
|
689
|
+
@webpush = args[:webpush] if args.key?(:webpush)
|
690
|
+
end
|
691
|
+
end
|
692
|
+
|
693
|
+
# Basic notification template to use across all platforms.
|
694
|
+
class Notification
|
695
|
+
include Google::Apis::Core::Hashable
|
696
|
+
|
697
|
+
# The notification's body text.
|
698
|
+
# Corresponds to the JSON property `body`
|
699
|
+
# @return [String]
|
700
|
+
attr_accessor :body
|
701
|
+
|
702
|
+
# Contains the URL of an image that is going to be downloaded on the device and
|
703
|
+
# displayed in a notification. JPEG, PNG, BMP have full support across platforms.
|
704
|
+
# Animated GIF and video only work on iOS. WebP and HEIF have varying levels of
|
705
|
+
# support across platforms and platform versions. Android has 1MB image size
|
706
|
+
# limit. Quota usage and implications/costs for hosting image on Firebase
|
707
|
+
# Storage: https://firebase.google.com/pricing
|
708
|
+
# Corresponds to the JSON property `image`
|
709
|
+
# @return [String]
|
710
|
+
attr_accessor :image
|
711
|
+
|
712
|
+
# The notification's title.
|
713
|
+
# Corresponds to the JSON property `title`
|
714
|
+
# @return [String]
|
715
|
+
attr_accessor :title
|
716
|
+
|
717
|
+
def initialize(**args)
|
718
|
+
update!(**args)
|
719
|
+
end
|
720
|
+
|
721
|
+
# Update properties of this object
|
722
|
+
def update!(**args)
|
723
|
+
@body = args[:body] if args.key?(:body)
|
724
|
+
@image = args[:image] if args.key?(:image)
|
725
|
+
@title = args[:title] if args.key?(:title)
|
726
|
+
end
|
727
|
+
end
|
728
|
+
|
729
|
+
# Request to send a message to specified target.
|
730
|
+
class SendMessageRequest
|
731
|
+
include Google::Apis::Core::Hashable
|
732
|
+
|
733
|
+
# Message to send by Firebase Cloud Messaging Service.
|
734
|
+
# Corresponds to the JSON property `message`
|
735
|
+
# @return [Google::Apis::FcmV1::Message]
|
736
|
+
attr_accessor :message
|
737
|
+
|
738
|
+
# Flag for testing the request without actually delivering the message.
|
739
|
+
# Corresponds to the JSON property `validateOnly`
|
740
|
+
# @return [Boolean]
|
741
|
+
attr_accessor :validate_only
|
742
|
+
alias_method :validate_only?, :validate_only
|
743
|
+
|
744
|
+
def initialize(**args)
|
745
|
+
update!(**args)
|
746
|
+
end
|
747
|
+
|
748
|
+
# Update properties of this object
|
749
|
+
def update!(**args)
|
750
|
+
@message = args[:message] if args.key?(:message)
|
751
|
+
@validate_only = args[:validate_only] if args.key?(:validate_only)
|
752
|
+
end
|
753
|
+
end
|
754
|
+
|
755
|
+
# [Webpush protocol](https://tools.ietf.org/html/rfc8030) options.
|
756
|
+
class WebpushConfig
|
757
|
+
include Google::Apis::Core::Hashable
|
758
|
+
|
759
|
+
# Arbitrary key/value payload. If present, it will override google.firebase.fcm.
|
760
|
+
# v1.Message.data.
|
761
|
+
# Corresponds to the JSON property `data`
|
762
|
+
# @return [Hash<String,String>]
|
763
|
+
attr_accessor :data
|
764
|
+
|
765
|
+
# Options for features provided by the FCM SDK for Web.
|
766
|
+
# Corresponds to the JSON property `fcmOptions`
|
767
|
+
# @return [Google::Apis::FcmV1::WebpushFcmOptions]
|
768
|
+
attr_accessor :fcm_options
|
769
|
+
|
770
|
+
# HTTP headers defined in webpush protocol. Refer to [Webpush protocol](https://
|
771
|
+
# tools.ietf.org/html/rfc8030#section-5) for supported headers, e.g. "TTL": "15".
|
772
|
+
# Corresponds to the JSON property `headers`
|
773
|
+
# @return [Hash<String,String>]
|
774
|
+
attr_accessor :headers
|
775
|
+
|
776
|
+
# Web Notification options as a JSON object. Supports Notification instance
|
777
|
+
# properties as defined in [Web Notification API](https://developer.mozilla.org/
|
778
|
+
# en-US/docs/Web/API/Notification). If present, "title" and "body" fields
|
779
|
+
# override [google.firebase.fcm.v1.Notification.title] and [google.firebase.fcm.
|
780
|
+
# v1.Notification.body].
|
781
|
+
# Corresponds to the JSON property `notification`
|
782
|
+
# @return [Hash<String,Object>]
|
783
|
+
attr_accessor :notification
|
784
|
+
|
785
|
+
def initialize(**args)
|
786
|
+
update!(**args)
|
787
|
+
end
|
788
|
+
|
789
|
+
# Update properties of this object
|
790
|
+
def update!(**args)
|
791
|
+
@data = args[:data] if args.key?(:data)
|
792
|
+
@fcm_options = args[:fcm_options] if args.key?(:fcm_options)
|
793
|
+
@headers = args[:headers] if args.key?(:headers)
|
794
|
+
@notification = args[:notification] if args.key?(:notification)
|
795
|
+
end
|
796
|
+
end
|
797
|
+
|
798
|
+
# Options for features provided by the FCM SDK for Web.
|
799
|
+
class WebpushFcmOptions
|
800
|
+
include Google::Apis::Core::Hashable
|
801
|
+
|
802
|
+
# Label associated with the message's analytics data.
|
803
|
+
# Corresponds to the JSON property `analyticsLabel`
|
804
|
+
# @return [String]
|
805
|
+
attr_accessor :analytics_label
|
806
|
+
|
807
|
+
# The link to open when the user clicks on the notification. For all URL values,
|
808
|
+
# HTTPS is required.
|
809
|
+
# Corresponds to the JSON property `link`
|
810
|
+
# @return [String]
|
811
|
+
attr_accessor :link
|
812
|
+
|
813
|
+
def initialize(**args)
|
814
|
+
update!(**args)
|
815
|
+
end
|
816
|
+
|
817
|
+
# Update properties of this object
|
818
|
+
def update!(**args)
|
819
|
+
@analytics_label = args[:analytics_label] if args.key?(:analytics_label)
|
820
|
+
@link = args[:link] if args.key?(:link)
|
821
|
+
end
|
822
|
+
end
|
823
|
+
end
|
824
|
+
end
|
825
|
+
end
|