google-apis-fcm_v1 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
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
+ module Google
16
+ module Apis
17
+ module FcmV1
18
+ # Version of the google-apis-fcm_v1 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.1.1"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20200720"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,262 @@
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
+ class AndroidConfig
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class AndroidFcmOptions
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class AndroidNotification
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class ApnsConfig
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class ApnsFcmOptions
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class Color
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class FcmOptions
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class LightSettings
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class Message
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class Notification
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class SendMessageRequest
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+
88
+ include Google::Apis::Core::JsonObjectSupport
89
+ end
90
+
91
+ class WebpushConfig
92
+ class Representation < Google::Apis::Core::JsonRepresentation; end
93
+
94
+ include Google::Apis::Core::JsonObjectSupport
95
+ end
96
+
97
+ class WebpushFcmOptions
98
+ class Representation < Google::Apis::Core::JsonRepresentation; end
99
+
100
+ include Google::Apis::Core::JsonObjectSupport
101
+ end
102
+
103
+ class AndroidConfig
104
+ # @private
105
+ class Representation < Google::Apis::Core::JsonRepresentation
106
+ property :collapse_key, as: 'collapseKey'
107
+ hash :data, as: 'data'
108
+ property :direct_boot_ok, as: 'directBootOk'
109
+ property :fcm_options, as: 'fcmOptions', class: Google::Apis::FcmV1::AndroidFcmOptions, decorator: Google::Apis::FcmV1::AndroidFcmOptions::Representation
110
+
111
+ property :notification, as: 'notification', class: Google::Apis::FcmV1::AndroidNotification, decorator: Google::Apis::FcmV1::AndroidNotification::Representation
112
+
113
+ property :priority, as: 'priority'
114
+ property :restricted_package_name, as: 'restrictedPackageName'
115
+ property :ttl, as: 'ttl'
116
+ end
117
+ end
118
+
119
+ class AndroidFcmOptions
120
+ # @private
121
+ class Representation < Google::Apis::Core::JsonRepresentation
122
+ property :analytics_label, as: 'analyticsLabel'
123
+ end
124
+ end
125
+
126
+ class AndroidNotification
127
+ # @private
128
+ class Representation < Google::Apis::Core::JsonRepresentation
129
+ property :body, as: 'body'
130
+ collection :body_loc_args, as: 'bodyLocArgs'
131
+ property :body_loc_key, as: 'bodyLocKey'
132
+ property :channel_id, as: 'channelId'
133
+ property :click_action, as: 'clickAction'
134
+ property :color, as: 'color'
135
+ property :default_light_settings, as: 'defaultLightSettings'
136
+ property :default_sound, as: 'defaultSound'
137
+ property :default_vibrate_timings, as: 'defaultVibrateTimings'
138
+ property :event_time, as: 'eventTime'
139
+ property :icon, as: 'icon'
140
+ property :image, as: 'image'
141
+ property :light_settings, as: 'lightSettings', class: Google::Apis::FcmV1::LightSettings, decorator: Google::Apis::FcmV1::LightSettings::Representation
142
+
143
+ property :local_only, as: 'localOnly'
144
+ property :notification_count, as: 'notificationCount'
145
+ property :notification_priority, as: 'notificationPriority'
146
+ property :sound, as: 'sound'
147
+ property :sticky, as: 'sticky'
148
+ property :tag, as: 'tag'
149
+ property :ticker, as: 'ticker'
150
+ property :title, as: 'title'
151
+ collection :title_loc_args, as: 'titleLocArgs'
152
+ property :title_loc_key, as: 'titleLocKey'
153
+ collection :vibrate_timings, as: 'vibrateTimings'
154
+ property :visibility, as: 'visibility'
155
+ end
156
+ end
157
+
158
+ class ApnsConfig
159
+ # @private
160
+ class Representation < Google::Apis::Core::JsonRepresentation
161
+ property :fcm_options, as: 'fcmOptions', class: Google::Apis::FcmV1::ApnsFcmOptions, decorator: Google::Apis::FcmV1::ApnsFcmOptions::Representation
162
+
163
+ hash :headers, as: 'headers'
164
+ hash :payload, as: 'payload'
165
+ end
166
+ end
167
+
168
+ class ApnsFcmOptions
169
+ # @private
170
+ class Representation < Google::Apis::Core::JsonRepresentation
171
+ property :analytics_label, as: 'analyticsLabel'
172
+ property :image, as: 'image'
173
+ end
174
+ end
175
+
176
+ class Color
177
+ # @private
178
+ class Representation < Google::Apis::Core::JsonRepresentation
179
+ property :alpha, as: 'alpha'
180
+ property :blue, as: 'blue'
181
+ property :green, as: 'green'
182
+ property :red, as: 'red'
183
+ end
184
+ end
185
+
186
+ class FcmOptions
187
+ # @private
188
+ class Representation < Google::Apis::Core::JsonRepresentation
189
+ property :analytics_label, as: 'analyticsLabel'
190
+ end
191
+ end
192
+
193
+ class LightSettings
194
+ # @private
195
+ class Representation < Google::Apis::Core::JsonRepresentation
196
+ property :color, as: 'color', class: Google::Apis::FcmV1::Color, decorator: Google::Apis::FcmV1::Color::Representation
197
+
198
+ property :light_off_duration, as: 'lightOffDuration'
199
+ property :light_on_duration, as: 'lightOnDuration'
200
+ end
201
+ end
202
+
203
+ class Message
204
+ # @private
205
+ class Representation < Google::Apis::Core::JsonRepresentation
206
+ property :android, as: 'android', class: Google::Apis::FcmV1::AndroidConfig, decorator: Google::Apis::FcmV1::AndroidConfig::Representation
207
+
208
+ property :apns, as: 'apns', class: Google::Apis::FcmV1::ApnsConfig, decorator: Google::Apis::FcmV1::ApnsConfig::Representation
209
+
210
+ property :condition, as: 'condition'
211
+ hash :data, as: 'data'
212
+ property :fcm_options, as: 'fcmOptions', class: Google::Apis::FcmV1::FcmOptions, decorator: Google::Apis::FcmV1::FcmOptions::Representation
213
+
214
+ property :name, as: 'name'
215
+ property :notification, as: 'notification', class: Google::Apis::FcmV1::Notification, decorator: Google::Apis::FcmV1::Notification::Representation
216
+
217
+ property :token, as: 'token'
218
+ property :topic, as: 'topic'
219
+ property :webpush, as: 'webpush', class: Google::Apis::FcmV1::WebpushConfig, decorator: Google::Apis::FcmV1::WebpushConfig::Representation
220
+
221
+ end
222
+ end
223
+
224
+ class Notification
225
+ # @private
226
+ class Representation < Google::Apis::Core::JsonRepresentation
227
+ property :body, as: 'body'
228
+ property :image, as: 'image'
229
+ property :title, as: 'title'
230
+ end
231
+ end
232
+
233
+ class SendMessageRequest
234
+ # @private
235
+ class Representation < Google::Apis::Core::JsonRepresentation
236
+ property :message, as: 'message', class: Google::Apis::FcmV1::Message, decorator: Google::Apis::FcmV1::Message::Representation
237
+
238
+ property :validate_only, as: 'validateOnly'
239
+ end
240
+ end
241
+
242
+ class WebpushConfig
243
+ # @private
244
+ class Representation < Google::Apis::Core::JsonRepresentation
245
+ hash :data, as: 'data'
246
+ property :fcm_options, as: 'fcmOptions', class: Google::Apis::FcmV1::WebpushFcmOptions, decorator: Google::Apis::FcmV1::WebpushFcmOptions::Representation
247
+
248
+ hash :headers, as: 'headers'
249
+ hash :notification, as: 'notification'
250
+ end
251
+ end
252
+
253
+ class WebpushFcmOptions
254
+ # @private
255
+ class Representation < Google::Apis::Core::JsonRepresentation
256
+ property :analytics_label, as: 'analyticsLabel'
257
+ property :link, as: 'link'
258
+ end
259
+ end
260
+ end
261
+ end
262
+ end
@@ -0,0 +1,98 @@
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/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module FcmV1
23
+ # Firebase Cloud Messaging API
24
+ #
25
+ # FCM send API that provides a cross-platform messaging solution to reliably
26
+ # deliver messages at no cost.
27
+ #
28
+ # @example
29
+ # require 'google/apis/fcm_v1'
30
+ #
31
+ # Fcm = Google::Apis::FcmV1 # Alias the module
32
+ # service = Fcm::FirebaseCloudMessagingService.new
33
+ #
34
+ # @see https://firebase.google.com/docs/cloud-messaging
35
+ class FirebaseCloudMessagingService < Google::Apis::Core::BaseService
36
+ # @return [String]
37
+ # API key. Your API key identifies your project and provides you with API access,
38
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
39
+ attr_accessor :key
40
+
41
+ # @return [String]
42
+ # Available to use for quota purposes for server-side applications. Can be any
43
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
44
+ attr_accessor :quota_user
45
+
46
+ def initialize
47
+ super('https://fcm.googleapis.com/', '',
48
+ client_name: 'google-apis-fcm_v1',
49
+ client_version: Google::Apis::FcmV1::GEM_VERSION)
50
+ @batch_path = 'batch'
51
+ end
52
+
53
+ # Send a message to specified target (a registration token, topic or condition).
54
+ # @param [String] parent
55
+ # Required. It contains the Firebase project id (i.e. the unique identifier for
56
+ # your Firebase project), in the format of `projects/`project_id``. For legacy
57
+ # support, the numeric project number with no padding is also supported in the
58
+ # format of `projects/`project_number``.
59
+ # @param [Google::Apis::FcmV1::SendMessageRequest] send_message_request_object
60
+ # @param [String] fields
61
+ # Selector specifying which fields to include in a partial response.
62
+ # @param [String] quota_user
63
+ # Available to use for quota purposes for server-side applications. Can be any
64
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
65
+ # @param [Google::Apis::RequestOptions] options
66
+ # Request-specific options
67
+ #
68
+ # @yield [result, err] Result & error if block supplied
69
+ # @yieldparam result [Google::Apis::FcmV1::Message] parsed result object
70
+ # @yieldparam err [StandardError] error object if request failed
71
+ #
72
+ # @return [Google::Apis::FcmV1::Message]
73
+ #
74
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
75
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
76
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
77
+ def send_message(parent, send_message_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
78
+ command = make_simple_command(:post, 'v1/{+parent}/messages:send', options)
79
+ command.request_representation = Google::Apis::FcmV1::SendMessageRequest::Representation
80
+ command.request_object = send_message_request_object
81
+ command.response_representation = Google::Apis::FcmV1::Message::Representation
82
+ command.response_class = Google::Apis::FcmV1::Message
83
+ command.params['parent'] = parent unless parent.nil?
84
+ command.query['fields'] = fields unless fields.nil?
85
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
86
+ execute_or_queue_command(command, &block)
87
+ end
88
+
89
+ protected
90
+
91
+ def apply_command_defaults(command)
92
+ command.query['key'] = key unless key.nil?
93
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: google-apis-fcm_v1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Google LLC
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-01-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: google-apis-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ description: This is the simple REST client for Firebase Cloud Messaging API V1. Simple
28
+ REST clients are Ruby client libraries that provide access to Google services via
29
+ their HTTP REST API endpoints. These libraries are generated and updated automatically
30
+ based on the discovery documents published by the service, and they handle most
31
+ concerns such as authentication, pagination, retry, timeouts, and logging. You can
32
+ use this client to access the Firebase Cloud Messaging API, but note that some services
33
+ may provide a separate modern client that is easier to use.
34
+ email: googleapis-packages@google.com
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - ".yardopts"
40
+ - CHANGELOG.md
41
+ - LICENSE.md
42
+ - OVERVIEW.md
43
+ - lib/google-apis-fcm_v1.rb
44
+ - lib/google/apis/fcm_v1.rb
45
+ - lib/google/apis/fcm_v1/classes.rb
46
+ - lib/google/apis/fcm_v1/gem_version.rb
47
+ - lib/google/apis/fcm_v1/representations.rb
48
+ - lib/google/apis/fcm_v1/service.rb
49
+ homepage: https://github.com/google/google-api-ruby-client
50
+ licenses:
51
+ - Apache-2.0
52
+ metadata:
53
+ bug_tracker_uri: https://github.com/googleapis/google-api-ruby-client/issues
54
+ changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-fcm_v1/CHANGELOG.md
55
+ documentation_uri: https://googleapis.dev/ruby/google-apis-fcm_v1/v0.1.0
56
+ source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-fcm_v1
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '2.4'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.1.4
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Simple REST client for Firebase Cloud Messaging API V1
76
+ test_files: []