@@ -34,8 +34,6 @@ public class DeliverabilityMetricsSample extends SparkPostBaseApp {
34
34
35
35
static final Logger logger = Logger .getLogger (CreateTemplateSimple .class );
36
36
37
- private Client client ;
38
-
39
37
public static void main (String [] args ) throws SparkPostException , IOException {
40
38
Logger .getRootLogger ().setLevel (Level .DEBUG );
41
39
@@ -204,7 +202,7 @@ public static void main(String[] args) throws SparkPostException, IOException {
204
202
* See: https://developers.sparkpost.com/api/#/reference/metrics/deliverability-metrics/deliverability-metrics-summary
205
203
*/
206
204
private void deliverabilityMetric () throws SparkPostException , IOException {
207
- this . client = this .newConfiguredClient ();
205
+ Client client = this .newConfiguredClient ();
208
206
209
207
String from = FROM_DATE ;
210
208
String to = null ;
@@ -216,7 +214,7 @@ private void deliverabilityMetric() throws SparkPostException, IOException {
216
214
String metrics = MetricsFields .ALL_FIELDS ;
217
215
String timezone = null ;
218
216
219
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
217
+ RestConnection connection = new RestConnection (client , getEndPoint ());
220
218
DeliverabiltyMetricsResponse response = ResourceMetrics
221
219
.getDeliverabilityMetricsSummary (connection , from , to , domains , campaigns , templates , metrics , timezone );
222
220
@@ -228,7 +226,6 @@ private void deliverabilityMetric() throws SparkPostException, IOException {
228
226
}
229
227
230
228
logger .debug ("-------------- LINKS -------------" );
231
-
232
229
List <MetricLinkResponse > links = response .getLinks ();
233
230
for (MetricLinkResponse link : links ) {
234
231
logger .debug ("Link: " + link .getRel ());
@@ -240,7 +237,7 @@ private void deliverabilityMetric() throws SparkPostException, IOException {
240
237
* See: https://developers.sparkpost.com/api/#/reference/metrics/discoverability-links/deliverability-metrics-by-domain
241
238
*/
242
239
private void deliverabilityDomainMetric () throws SparkPostException , IOException {
243
- this . client = this .newConfiguredClient ();
240
+ Client client = this .newConfiguredClient ();
244
241
245
242
String from = FROM_DATE ;
246
243
String to = null ;
@@ -254,7 +251,7 @@ private void deliverabilityDomainMetric() throws SparkPostException, IOException
254
251
String orderBy = null ;
255
252
String limit = null ;
256
253
257
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
254
+ RestConnection connection = new RestConnection (client , getEndPoint ());
258
255
DeliverabiltyMetricsResponse response = ResourceMetrics
259
256
.getDeliverabilityMetricsByDomain (connection , from , to , domains , campaigns , templates , metrics , timezone , orderBy , limit );
260
257
@@ -272,7 +269,7 @@ private void deliverabilityDomainMetric() throws SparkPostException, IOException
272
269
* See: https://developers.sparkpost.com/api/#/reference/metrics/deliverability-metrics-by-binding/deliverability-metrics-by-campaign
273
270
*/
274
271
private void deliverabilityCampaignMetric () throws SparkPostException , IOException {
275
- this . client = this .newConfiguredClient ();
272
+ Client client = this .newConfiguredClient ();
276
273
277
274
String from = FROM_DATE ;
278
275
String to = null ;
@@ -286,7 +283,7 @@ private void deliverabilityCampaignMetric() throws SparkPostException, IOExcepti
286
283
String orderBy = null ;
287
284
String limit = null ;
288
285
289
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
286
+ RestConnection connection = new RestConnection (client , getEndPoint ());
290
287
DeliverabiltyMetricsResponse response = ResourceMetrics
291
288
.getDeliverabilityMetricsByCampaign (connection , from , to , domains , campaigns , templates , metrics , timezone , orderBy , limit );
292
289
@@ -304,7 +301,7 @@ private void deliverabilityCampaignMetric() throws SparkPostException, IOExcepti
304
301
* See: https://developers.sparkpost.com/api/#/reference/metrics/deliverability-metrics-by-binding-group/deliverability-metrics-by-template
305
302
*/
306
303
private void deliverabilityTemplateMetric () throws SparkPostException , IOException {
307
- this . client = this .newConfiguredClient ();
304
+ Client client = this .newConfiguredClient ();
308
305
309
306
String from = FROM_DATE ;
310
307
String to = null ;
@@ -318,7 +315,7 @@ private void deliverabilityTemplateMetric() throws SparkPostException, IOExcepti
318
315
String orderBy = null ;
319
316
String limit = null ;
320
317
321
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
318
+ RestConnection connection = new RestConnection (client , getEndPoint ());
322
319
DeliverabiltyMetricsResponse response = ResourceMetrics
323
320
.getDeliverabilityMetricsByTemplate (connection , from , to , domains , campaigns , templates , metrics , timezone , orderBy , limit );
324
321
@@ -337,7 +334,7 @@ private void deliverabilityTemplateMetric() throws SparkPostException, IOExcepti
337
334
* See: https://developers.sparkpost.com/api/#/reference/metrics/deliverability-metrics-by-binding-group/deliverability-metrics-by-watched-domain
338
335
*/
339
336
private void deliverabilityWatchedDomainMetric () throws SparkPostException , IOException {
340
- this . client = this .newConfiguredClient ();
337
+ Client client = this .newConfiguredClient ();
341
338
342
339
String from = FROM_DATE ;
343
340
String to = null ;
@@ -351,7 +348,7 @@ private void deliverabilityWatchedDomainMetric() throws SparkPostException, IOEx
351
348
String orderBy = null ;
352
349
String limit = null ;
353
350
354
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
351
+ RestConnection connection = new RestConnection (client , getEndPoint ());
355
352
DeliverabiltyMetricsResponse response = ResourceMetrics
356
353
.getDeliverabilityMetricsByWatchedDomain (connection , from , to , domains , campaigns , templates , metrics , timezone , orderBy , limit );
357
354
@@ -369,7 +366,7 @@ private void deliverabilityWatchedDomainMetric() throws SparkPostException, IOEx
369
366
* See: https://developers.sparkpost.com/api/#/reference/metrics/time-series/time-series-metrics
370
367
*/
371
368
private void deliverabilityTimeSeriesMetrics (String precision ) throws SparkPostException , IOException {
372
- this . client = this .newConfiguredClient ();
369
+ Client client = this .newConfiguredClient ();
373
370
374
371
String from = FROM_DATE ;
375
372
String to = null ;
@@ -381,7 +378,7 @@ private void deliverabilityTimeSeriesMetrics(String precision) throws SparkPostE
381
378
String metrics = MetricsFields .ALL_FIELDS ;
382
379
String timezone = null ;
383
380
384
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
381
+ RestConnection connection = new RestConnection (client , getEndPoint ());
385
382
DeliverabiltyMetricsResponse response = ResourceMetrics
386
383
.getTimeSeriesMetrics (connection , from , to , domains , campaigns , templates , precision , metrics , timezone );
387
384
@@ -400,7 +397,7 @@ private void deliverabilityTimeSeriesMetrics(String precision) throws SparkPostE
400
397
* See: https://developers.sparkpost.com/api/#/reference/metrics/time-series/bounce-reason-metrics
401
398
*/
402
399
private void deliverabilityBounceReasonMetrics () throws SparkPostException , IOException {
403
- this . client = this .newConfiguredClient ();
400
+ Client client = this .newConfiguredClient ();
404
401
405
402
String from = FROM_DATE ;
406
403
String to = null ;
@@ -413,7 +410,7 @@ private void deliverabilityBounceReasonMetrics() throws SparkPostException, IOEx
413
410
String timezone = null ;
414
411
String limit = null ;
415
412
416
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
413
+ RestConnection connection = new RestConnection (client , getEndPoint ());
417
414
DeliverabiltyMetricsResponse response = ResourceMetrics
418
415
.getBounceReasonMetrics (connection , from , to , domains , campaigns , templates , metrics , timezone , limit );
419
416
@@ -431,7 +428,7 @@ private void deliverabilityBounceReasonMetrics() throws SparkPostException, IOEx
431
428
* See: https://developers.sparkpost.com/api/#/reference/metrics/bounce-reasons-by-domain/bounce-reason-metrics-by-domain
432
429
*/
433
430
private void deliverabilityBounceReasonByDomainMetrics () throws SparkPostException , IOException {
434
- this . client = this .newConfiguredClient ();
431
+ Client client = this .newConfiguredClient ();
435
432
436
433
String from = FROM_DATE ;
437
434
String to = null ;
@@ -444,7 +441,7 @@ private void deliverabilityBounceReasonByDomainMetrics() throws SparkPostExcepti
444
441
String timezone = null ;
445
442
String limit = null ;
446
443
447
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
444
+ RestConnection connection = new RestConnection (client , getEndPoint ());
448
445
DeliverabiltyMetricsResponse response = ResourceMetrics
449
446
.getBounceReasonMetricsByDomain (connection , from , to , domains , campaigns , templates , metrics , timezone , limit );
450
447
@@ -462,7 +459,7 @@ private void deliverabilityBounceReasonByDomainMetrics() throws SparkPostExcepti
462
459
* See: https://developers.sparkpost.com/api/#/reference/metrics/bounce-reasons/bounce-classification-metrics
463
460
*/
464
461
private void deliverabilityBounceReasonByClassificationMetrics () throws SparkPostException , IOException {
465
- this . client = this .newConfiguredClient ();
462
+ Client client = this .newConfiguredClient ();
466
463
467
464
String from = FROM_DATE ;
468
465
String to = null ;
@@ -475,7 +472,7 @@ private void deliverabilityBounceReasonByClassificationMetrics() throws SparkPos
475
472
String timezone = null ;
476
473
String limit = null ;
477
474
478
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
475
+ RestConnection connection = new RestConnection (client , getEndPoint ());
479
476
DeliverabiltyMetricsResponse response = ResourceMetrics
480
477
.getBounceClassificationMetrics (connection , from , to , domains , campaigns , templates , metrics , timezone , limit );
481
478
@@ -493,7 +490,7 @@ private void deliverabilityBounceReasonByClassificationMetrics() throws SparkPos
493
490
* See: https://developers.sparkpost.com/api/#/reference/metrics/rejection-reasons/rejection-reason-metrics
494
491
*/
495
492
private void deliverabilityRejectionMetrics () throws SparkPostException , IOException {
496
- this . client = this .newConfiguredClient ();
493
+ Client client = this .newConfiguredClient ();
497
494
498
495
String from = FROM_DATE ;
499
496
String to = null ;
@@ -505,7 +502,7 @@ private void deliverabilityRejectionMetrics() throws SparkPostException, IOExcep
505
502
String timezone = null ;
506
503
String limit = null ;
507
504
508
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
505
+ RestConnection connection = new RestConnection (client , getEndPoint ());
509
506
DeliverabiltyMetricsResponse response = ResourceMetrics .getRejectionReasonMetrics (connection , from , to , domains , campaigns , templates , timezone , limit );
510
507
511
508
List <Map <String , Object >> results = response .getResults ();
@@ -522,7 +519,7 @@ private void deliverabilityRejectionMetrics() throws SparkPostException, IOExcep
522
519
* See: https://developers.sparkpost.com/api/#/reference/metrics/bounce-classifications/rejection-reason-metrics-by-domain
523
520
*/
524
521
private void deliverabilityRejectionDomainMetrics () throws SparkPostException , IOException {
525
- this . client = this .newConfiguredClient ();
522
+ Client client = this .newConfiguredClient ();
526
523
527
524
String from = FROM_DATE ;
528
525
String to = null ;
@@ -534,7 +531,7 @@ private void deliverabilityRejectionDomainMetrics() throws SparkPostException, I
534
531
String timezone = null ;
535
532
String limit = null ;
536
533
537
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
534
+ RestConnection connection = new RestConnection (client , getEndPoint ());
538
535
DeliverabiltyMetricsResponse response = ResourceMetrics
539
536
.getRejectionReasonMetricsByDomain (connection , from , to , domains , campaigns , templates , timezone , limit );
540
537
@@ -552,7 +549,7 @@ private void deliverabilityRejectionDomainMetrics() throws SparkPostException, I
552
549
* See: https://developers.sparkpost.com/api/#/reference/metrics/rejection-reasons-by-domain/delay-reason-metrics
553
550
*/
554
551
private void deliverabilityDelayMetrics () throws SparkPostException , IOException {
555
- this . client = this .newConfiguredClient ();
552
+ Client client = this .newConfiguredClient ();
556
553
557
554
String from = FROM_DATE ;
558
555
String to = null ;
@@ -564,7 +561,7 @@ private void deliverabilityDelayMetrics() throws SparkPostException, IOException
564
561
String timezone = null ;
565
562
String limit = null ;
566
563
567
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
564
+ RestConnection connection = new RestConnection (client , getEndPoint ());
568
565
DeliverabiltyMetricsResponse response = ResourceMetrics .getDelayReasonMetrics (connection , from , to , domains , campaigns , templates , timezone , limit );
569
566
570
567
List <Map <String , Object >> results = response .getResults ();
@@ -581,7 +578,7 @@ private void deliverabilityDelayMetrics() throws SparkPostException, IOException
581
578
* See: https://developers.sparkpost.com/api/#/reference/metrics/delay-reasons-by-domain/delay-reason-metrics-by-domain
582
579
*/
583
580
private void deliverabilityDelayDomainMetrics () throws SparkPostException , IOException {
584
- this . client = this .newConfiguredClient ();
581
+ Client client = this .newConfiguredClient ();
585
582
586
583
String from = FROM_DATE ;
587
584
String to = null ;
@@ -593,7 +590,7 @@ private void deliverabilityDelayDomainMetrics() throws SparkPostException, IOExc
593
590
String timezone = null ;
594
591
String limit = null ;
595
592
596
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
593
+ RestConnection connection = new RestConnection (client , getEndPoint ());
597
594
DeliverabiltyMetricsResponse response = ResourceMetrics
598
595
.getDelayReasonMetricsByDomain (connection , from , to , domains , campaigns , templates , timezone , limit );
599
596
@@ -611,7 +608,7 @@ private void deliverabilityDelayDomainMetrics() throws SparkPostException, IOExc
611
608
* See: https://developers.sparkpost.com/api/#/reference/metrics/engagement-details/engagement-details
612
609
*/
613
610
private void deliverabilityEngagementMetrics () throws SparkPostException , IOException {
614
- this . client = this .newConfiguredClient ();
611
+ Client client = this .newConfiguredClient ();
615
612
616
613
String from = FROM_DATE ;
617
614
String to = null ;
@@ -623,7 +620,7 @@ private void deliverabilityEngagementMetrics() throws SparkPostException, IOExce
623
620
String limit = null ;
624
621
String metrics = MetricsEngagementFields .ALL_FIELDS ;
625
622
626
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
623
+ RestConnection connection = new RestConnection (client , getEndPoint ());
627
624
DeliverabiltyMetricsResponse response = ResourceMetrics .getEngagementDetails (connection , from , to , timezone , metrics , campaigns , templates , limit );
628
625
629
626
List <Map <String , Object >> results = response .getResults ();
@@ -640,7 +637,7 @@ private void deliverabilityEngagementMetrics() throws SparkPostException, IOExce
640
637
* See: https://developers.sparkpost.com/api/#/reference/metrics/deliveries-by-attempt
641
638
*/
642
639
private void deliverabilityDeliveriesMetrics () throws SparkPostException , IOException {
643
- this . client = this .newConfiguredClient ();
640
+ Client client = this .newConfiguredClient ();
644
641
645
642
String from = FROM_DATE ;
646
643
String to = null ;
@@ -649,7 +646,7 @@ private void deliverabilityDeliveriesMetrics() throws SparkPostException, IOExce
649
646
String templates = null ;
650
647
String timezone = null ;
651
648
652
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
649
+ RestConnection connection = new RestConnection (client , getEndPoint ());
653
650
DeliverabiltyMetricsResponse response = ResourceMetrics .getDeliveriesByAttempt (connection , from , to , domains , campaigns , templates , timezone );
654
651
655
652
List <Map <String , Object >> results = response .getResults ();
@@ -662,12 +659,12 @@ private void deliverabilityDeliveriesMetrics() throws SparkPostException, IOExce
662
659
}
663
660
664
661
private void deliverabilityCampaignListMetrics () throws SparkPostException , IOException {
665
- this . client = this .newConfiguredClient ();
662
+ Client client = this .newConfiguredClient ();
666
663
667
664
String match = null ;
668
665
String limit = null ;
669
666
670
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
667
+ RestConnection connection = new RestConnection (client , getEndPoint ());
671
668
CampaignListResponse response = ResourceMetrics .getCampaignsList (connection , match , limit );
672
669
673
670
List <String > results = response .getCampaignList ();
@@ -679,12 +676,12 @@ private void deliverabilityCampaignListMetrics() throws SparkPostException, IOEx
679
676
}
680
677
681
678
private void deliverabilityDomainListMetrics () throws SparkPostException , IOException {
682
- this . client = this .newConfiguredClient ();
679
+ Client client = this .newConfiguredClient ();
683
680
684
681
String match = null ;
685
682
String limit = null ;
686
683
687
- RestConnection connection = new RestConnection (this . client , getEndPoint ());
684
+ RestConnection connection = new RestConnection (client , getEndPoint ());
688
685
DomainListResponse response = ResourceMetrics .getDomainsList (connection , match , limit );
689
686
690
687
List <String > results = response .getDomainList ();
0 commit comments