@@ -32,7 +32,7 @@ protected HttpClient httpClient
32
32
33
33
return _httpClient ;
34
34
}
35
- }
35
+ }
36
36
37
37
/// <summary>
38
38
/// When sending messages to a GCM endpoint you need to set the GCM API key
@@ -231,52 +231,52 @@ public HttpRequestMessage GenerateRequestDetails(PushSubscription subscription,
231
231
return request ;
232
232
}
233
233
234
- /// <summary>
235
- /// To send a push notification call this method with a subscription, optional payload and any options
236
- /// Will exception is unsuccessful
237
- /// </summary>
238
- /// <param name="subscription">The PushSubscription you wish to send the notification to.</param>
239
- /// <param name="payload">The payload you wish to send to the user</param>
240
- /// <param name="options">Options for the GCM API key and vapid keys can be passed in if they are unique for each notification.</param>
241
- public void SendNotification ( PushSubscription subscription , string payload = null , Dictionary < string , object > options = null )
242
- {
243
- SendNotificationAsync ( subscription , payload , options ) . Wait ( ) ;
244
- }
245
-
246
- /// <summary>
247
- /// To send a push notification call this method with a subscription, optional payload and any options
248
- /// Will exception is unsuccessful
249
- /// </summary>
250
- /// <param name="subscription">The PushSubscription you wish to send the notification to.</param>
251
- /// <param name="payload">The payload you wish to send to the user</param>
252
- /// <param name="vapidDetails">The vapid details for the notification.</param>
253
- public void SendNotification ( PushSubscription subscription , string payload , VapidDetails vapidDetails )
254
- {
255
- SendNotificationAsync ( subscription , payload , vapidDetails ) . Wait ( ) ;
256
- }
257
-
258
- /// <summary>
259
- /// To send a push notification call this method with a subscription, optional payload and any options
260
- /// Will exception is unsuccessful
261
- /// </summary>
262
- /// <param name="subscription">The PushSubscription you wish to send the notification to.</param>
263
- /// <param name="payload">The payload you wish to send to the user</param>
264
- /// <param name="gcmAPIKey">The GCM API key</param>
265
- public void SendNotification ( PushSubscription subscription , string payload , string gcmAPIKey )
266
- {
267
- SendNotificationAsync ( subscription , payload , gcmAPIKey ) . Wait ( ) ;
268
- }
269
-
270
- /// <summary>
271
- /// To send a push notification asyncronously call this method with a subscription, optional payload and any options
272
- /// Will exception is unsuccessful
273
- /// </summary>
274
- /// <param name="subscription">The PushSubscription you wish to send the notification to.</param>
275
- /// <param name="payload">The payload you wish to send to the user</param>
276
- /// <param name="options">Options for the GCM API key and vapid keys can be passed in if they are unique for each notification.</param>
277
- public async Task SendNotificationAsync ( PushSubscription subscription , string payload = null , Dictionary < string , object > options = null )
234
+ /// <summary>
235
+ /// To send a push notification call this method with a subscription, optional payload and any options
236
+ /// Will exception is unsuccessful
237
+ /// </summary>
238
+ /// <param name="subscription">The PushSubscription you wish to send the notification to.</param>
239
+ /// <param name="payload">The payload you wish to send to the user</param>
240
+ /// <param name="options">Options for the GCM API key and vapid keys can be passed in if they are unique for each notification.</param>
241
+ public void SendNotification ( PushSubscription subscription , string payload = null , Dictionary < string , object > options = null )
242
+ {
243
+ SendNotificationAsync ( subscription , payload , options ) . Wait ( ) ;
244
+ }
245
+
246
+ /// <summary>
247
+ /// To send a push notification call this method with a subscription, optional payload and any options
248
+ /// Will exception is unsuccessful
249
+ /// </summary>
250
+ /// <param name="subscription">The PushSubscription you wish to send the notification to.</param>
251
+ /// <param name="payload">The payload you wish to send to the user</param>
252
+ /// <param name="vapidDetails">The vapid details for the notification.</param>
253
+ public void SendNotification ( PushSubscription subscription , string payload , VapidDetails vapidDetails )
254
+ {
255
+ SendNotificationAsync ( subscription , payload , vapidDetails ) . Wait ( ) ;
256
+ }
257
+
258
+ /// <summary>
259
+ /// To send a push notification call this method with a subscription, optional payload and any options
260
+ /// Will exception is unsuccessful
261
+ /// </summary>
262
+ /// <param name="subscription">The PushSubscription you wish to send the notification to.</param>
263
+ /// <param name="payload">The payload you wish to send to the user</param>
264
+ /// <param name="gcmAPIKey">The GCM API key</param>
265
+ public void SendNotification ( PushSubscription subscription , string payload , string gcmAPIKey )
266
+ {
267
+ SendNotificationAsync ( subscription , payload , gcmAPIKey ) . Wait ( ) ;
268
+ }
269
+
270
+ /// <summary>
271
+ /// To send a push notification asyncronously call this method with a subscription, optional payload and any options
272
+ /// Will exception is unsuccessful
273
+ /// </summary>
274
+ /// <param name="subscription">The PushSubscription you wish to send the notification to.</param>
275
+ /// <param name="payload">The payload you wish to send to the user</param>
276
+ /// <param name="options">Options for the GCM API key and vapid keys can be passed in if they are unique for each notification.</param>
277
+ public async Task SendNotificationAsync ( PushSubscription subscription , string payload = null , Dictionary < string , object > options = null )
278
278
{
279
-
279
+
280
280
HttpRequestMessage request = GenerateRequestDetails ( subscription , payload , options ) ;
281
281
282
282
HttpResponseMessage response = await httpClient . SendAsync ( request ) ;
@@ -285,31 +285,31 @@ public async Task SendNotificationAsync(PushSubscription subscription, string pa
285
285
{
286
286
throw new WebPushException ( @"Received unexpected response code" , response . StatusCode , response . Headers , subscription ) ;
287
287
}
288
-
288
+
289
289
}
290
290
291
- /// <summary>
292
- /// To send a push notification asyncronously call this method with a subscription, optional payload and any options
293
- /// Will exception is unsuccessful
294
- /// </summary>
295
- /// <param name="subscription">The PushSubscription you wish to send the notification to.</param>
296
- /// <param name="payload">The payload you wish to send to the user</param>
297
- /// <param name="vapidDetails">The vapid details for the notification.</param>
298
- public async Task SendNotificationAsync ( PushSubscription subscription , string payload , VapidDetails vapidDetails )
291
+ /// <summary>
292
+ /// To send a push notification asyncronously call this method with a subscription, optional payload and any options
293
+ /// Will exception is unsuccessful
294
+ /// </summary>
295
+ /// <param name="subscription">The PushSubscription you wish to send the notification to.</param>
296
+ /// <param name="payload">The payload you wish to send to the user</param>
297
+ /// <param name="vapidDetails">The vapid details for the notification.</param>
298
+ public async Task SendNotificationAsync ( PushSubscription subscription , string payload , VapidDetails vapidDetails )
299
299
{
300
300
Dictionary < string , object > options = new Dictionary < string , object > ( ) ;
301
301
options [ "vapidDetails" ] = vapidDetails ;
302
302
await SendNotificationAsync ( subscription , payload , options ) ;
303
303
}
304
304
305
- /// <summary>
306
- /// To send a push notification asyncronously call this method with a subscription, optional payload and any options
307
- /// Will exception is unsuccessful
308
- /// </summary>
309
- /// <param name="subscription">The PushSubscription you wish to send the notification to.</param>
310
- /// <param name="payload">The payload you wish to send to the user</param>
311
- /// <param name="gcmAPIKey">The GCM API key</param>
312
- public async Task SendNotificationAsync ( PushSubscription subscription , string payload , string gcmAPIKey )
305
+ /// <summary>
306
+ /// To send a push notification asyncronously call this method with a subscription, optional payload and any options
307
+ /// Will exception is unsuccessful
308
+ /// </summary>
309
+ /// <param name="subscription">The PushSubscription you wish to send the notification to.</param>
310
+ /// <param name="payload">The payload you wish to send to the user</param>
311
+ /// <param name="gcmAPIKey">The GCM API key</param>
312
+ public async Task SendNotificationAsync ( PushSubscription subscription , string payload , string gcmAPIKey )
313
313
{
314
314
Dictionary < string , object > options = new Dictionary < string , object > ( ) ;
315
315
options [ "gcmAPIKey" ] = gcmAPIKey ;
0 commit comments