1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
|
unit googlepagespeedonline;
{$MODE objfpc}
{$H+}
interface
uses sysutils, classes, googleservice, restbase, googlebase;
type
//Top-level schema types
TPagespeedApiFormatStringV2 = Class;
TPagespeedApiImageV2 = Class;
TResult = Class;
TPagespeedApiFormatStringV2Array = Array of TPagespeedApiFormatStringV2;
TPagespeedApiImageV2Array = Array of TPagespeedApiImageV2;
TResultArray = Array of TResult;
//Anonymous types, using auto-generated names
TPagespeedApiFormatStringV2TypeargsItemTyperectsItem = Class;
TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsItem = Class;
TPagespeedApiFormatStringV2TypeargsItem = Class;
TPagespeedApiImageV2Typepage_rect = Class;
TResultTypeformattedResultsTyperuleResults = Class;
TResultTypeformattedResults = Class;
TResultTypepageStats = Class;
TResultTyperuleGroups = Class;
TResultTypeversion = Class;
TPagespeedApiFormatStringV2TypeargsItemTyperectsArray = Array of TPagespeedApiFormatStringV2TypeargsItemTyperectsItem;
TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsArray = Array of TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsItem;
TPagespeedApiFormatStringV2TypeargsArray = Array of TPagespeedApiFormatStringV2TypeargsItem;
{ --------------------------------------------------------------------
TPagespeedApiFormatStringV2TypeargsItemTyperectsItem
--------------------------------------------------------------------}
TPagespeedApiFormatStringV2TypeargsItemTyperectsItem = Class(TGoogleBaseObject)
Private
Fheight : integer;
Fleft : integer;
Ftop : integer;
Fwidth : integer;
Protected
//Property setters
Procedure Setheight(AIndex : Integer; const AValue : integer); virtual;
Procedure Setleft(AIndex : Integer; const AValue : integer); virtual;
Procedure Settop(AIndex : Integer; const AValue : integer); virtual;
Procedure Setwidth(AIndex : Integer; const AValue : integer); virtual;
Public
Published
Property height : integer Index 0 Read Fheight Write Setheight;
Property left : integer Index 8 Read Fleft Write Setleft;
Property top : integer Index 16 Read Ftop Write Settop;
Property width : integer Index 24 Read Fwidth Write Setwidth;
end;
TPagespeedApiFormatStringV2TypeargsItemTyperectsItemClass = Class of TPagespeedApiFormatStringV2TypeargsItemTyperectsItem;
{ --------------------------------------------------------------------
TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsItem
--------------------------------------------------------------------}
TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsItem = Class(TGoogleBaseObject)
Private
Fheight : integer;
Fleft : integer;
Ftop : integer;
Fwidth : integer;
Protected
//Property setters
Procedure Setheight(AIndex : Integer; const AValue : integer); virtual;
Procedure Setleft(AIndex : Integer; const AValue : integer); virtual;
Procedure Settop(AIndex : Integer; const AValue : integer); virtual;
Procedure Setwidth(AIndex : Integer; const AValue : integer); virtual;
Public
Published
Property height : integer Index 0 Read Fheight Write Setheight;
Property left : integer Index 8 Read Fleft Write Setleft;
Property top : integer Index 16 Read Ftop Write Settop;
Property width : integer Index 24 Read Fwidth Write Setwidth;
end;
TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsItemClass = Class of TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsItem;
{ --------------------------------------------------------------------
TPagespeedApiFormatStringV2TypeargsItem
--------------------------------------------------------------------}
TPagespeedApiFormatStringV2TypeargsItem = Class(TGoogleBaseObject)
Private
Fkey : String;
Frects : TPagespeedApiFormatStringV2TypeargsItemTyperectsArray;
Fsecondary_rects : TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsArray;
F_type : String;
Fvalue : String;
Protected
Class Function ExportPropertyName(Const AName : String) : string; override;
//Property setters
Procedure Setkey(AIndex : Integer; const AValue : String); virtual;
Procedure Setrects(AIndex : Integer; const AValue : TPagespeedApiFormatStringV2TypeargsItemTyperectsArray); virtual;
Procedure Setsecondary_rects(AIndex : Integer; const AValue : TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsArray); virtual;
Procedure Set_type(AIndex : Integer; const AValue : String); virtual;
Procedure Setvalue(AIndex : Integer; const AValue : String); virtual;
//2.6.4. bug workaround
{$IFDEF VER2_6}
Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
{$ENDIF VER2_6}
Public
Published
Property key : String Index 0 Read Fkey Write Setkey;
Property rects : TPagespeedApiFormatStringV2TypeargsItemTyperectsArray Index 8 Read Frects Write Setrects;
Property secondary_rects : TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsArray Index 16 Read Fsecondary_rects Write Setsecondary_rects;
Property _type : String Index 24 Read F_type Write Set_type;
Property value : String Index 32 Read Fvalue Write Setvalue;
end;
TPagespeedApiFormatStringV2TypeargsItemClass = Class of TPagespeedApiFormatStringV2TypeargsItem;
{ --------------------------------------------------------------------
TPagespeedApiFormatStringV2
--------------------------------------------------------------------}
TPagespeedApiFormatStringV2 = Class(TGoogleBaseObject)
Private
Fargs : TPagespeedApiFormatStringV2TypeargsArray;
Fformat : String;
Protected
//Property setters
Procedure Setargs(AIndex : Integer; const AValue : TPagespeedApiFormatStringV2TypeargsArray); virtual;
Procedure Setformat(AIndex : Integer; const AValue : String); virtual;
//2.6.4. bug workaround
{$IFDEF VER2_6}
Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
{$ENDIF VER2_6}
Public
Published
Property args : TPagespeedApiFormatStringV2TypeargsArray Index 0 Read Fargs Write Setargs;
Property format : String Index 8 Read Fformat Write Setformat;
end;
TPagespeedApiFormatStringV2Class = Class of TPagespeedApiFormatStringV2;
{ --------------------------------------------------------------------
TPagespeedApiImageV2Typepage_rect
--------------------------------------------------------------------}
TPagespeedApiImageV2Typepage_rect = Class(TGoogleBaseObject)
Private
Fheight : integer;
Fleft : integer;
Ftop : integer;
Fwidth : integer;
Protected
//Property setters
Procedure Setheight(AIndex : Integer; const AValue : integer); virtual;
Procedure Setleft(AIndex : Integer; const AValue : integer); virtual;
Procedure Settop(AIndex : Integer; const AValue : integer); virtual;
Procedure Setwidth(AIndex : Integer; const AValue : integer); virtual;
Public
Published
Property height : integer Index 0 Read Fheight Write Setheight;
Property left : integer Index 8 Read Fleft Write Setleft;
Property top : integer Index 16 Read Ftop Write Settop;
Property width : integer Index 24 Read Fwidth Write Setwidth;
end;
TPagespeedApiImageV2Typepage_rectClass = Class of TPagespeedApiImageV2Typepage_rect;
{ --------------------------------------------------------------------
TPagespeedApiImageV2
--------------------------------------------------------------------}
TPagespeedApiImageV2 = Class(TGoogleBaseObject)
Private
Fdata : String;
Fheight : integer;
Fkey : String;
Fmime_type : String;
Fpage_rect : TPagespeedApiImageV2Typepage_rect;
Fwidth : integer;
Protected
//Property setters
Procedure Setdata(AIndex : Integer; const AValue : String); virtual;
Procedure Setheight(AIndex : Integer; const AValue : integer); virtual;
Procedure Setkey(AIndex : Integer; const AValue : String); virtual;
Procedure Setmime_type(AIndex : Integer; const AValue : String); virtual;
Procedure Setpage_rect(AIndex : Integer; const AValue : TPagespeedApiImageV2Typepage_rect); virtual;
Procedure Setwidth(AIndex : Integer; const AValue : integer); virtual;
Public
Published
Property data : String Index 0 Read Fdata Write Setdata;
Property height : integer Index 8 Read Fheight Write Setheight;
Property key : String Index 16 Read Fkey Write Setkey;
Property mime_type : String Index 24 Read Fmime_type Write Setmime_type;
Property page_rect : TPagespeedApiImageV2Typepage_rect Index 32 Read Fpage_rect Write Setpage_rect;
Property width : integer Index 40 Read Fwidth Write Setwidth;
end;
TPagespeedApiImageV2Class = Class of TPagespeedApiImageV2;
{ --------------------------------------------------------------------
TResultTypeformattedResultsTyperuleResults
--------------------------------------------------------------------}
TResultTypeformattedResultsTyperuleResults = Class(TGoogleBaseObject)
Private
Protected
//Property setters
Public
Class Function AllowAdditionalProperties : Boolean; override;
Published
end;
TResultTypeformattedResultsTyperuleResultsClass = Class of TResultTypeformattedResultsTyperuleResults;
{ --------------------------------------------------------------------
TResultTypeformattedResults
--------------------------------------------------------------------}
TResultTypeformattedResults = Class(TGoogleBaseObject)
Private
Flocale : String;
FruleResults : TResultTypeformattedResultsTyperuleResults;
Protected
//Property setters
Procedure Setlocale(AIndex : Integer; const AValue : String); virtual;
Procedure SetruleResults(AIndex : Integer; const AValue : TResultTypeformattedResultsTyperuleResults); virtual;
Public
Published
Property locale : String Index 0 Read Flocale Write Setlocale;
Property ruleResults : TResultTypeformattedResultsTyperuleResults Index 8 Read FruleResults Write SetruleResults;
end;
TResultTypeformattedResultsClass = Class of TResultTypeformattedResults;
{ --------------------------------------------------------------------
TResultTypepageStats
--------------------------------------------------------------------}
TResultTypepageStats = Class(TGoogleBaseObject)
Private
FcssResponseBytes : String;
FflashResponseBytes : String;
FhtmlResponseBytes : String;
FimageResponseBytes : String;
FjavascriptResponseBytes : String;
FnumberCssResources : integer;
FnumberHosts : integer;
FnumberJsResources : integer;
FnumberResources : integer;
FnumberStaticResources : integer;
FotherResponseBytes : String;
FtextResponseBytes : String;
FtotalRequestBytes : String;
Protected
//Property setters
Procedure SetcssResponseBytes(AIndex : Integer; const AValue : String); virtual;
Procedure SetflashResponseBytes(AIndex : Integer; const AValue : String); virtual;
Procedure SethtmlResponseBytes(AIndex : Integer; const AValue : String); virtual;
Procedure SetimageResponseBytes(AIndex : Integer; const AValue : String); virtual;
Procedure SetjavascriptResponseBytes(AIndex : Integer; const AValue : String); virtual;
Procedure SetnumberCssResources(AIndex : Integer; const AValue : integer); virtual;
Procedure SetnumberHosts(AIndex : Integer; const AValue : integer); virtual;
Procedure SetnumberJsResources(AIndex : Integer; const AValue : integer); virtual;
Procedure SetnumberResources(AIndex : Integer; const AValue : integer); virtual;
Procedure SetnumberStaticResources(AIndex : Integer; const AValue : integer); virtual;
Procedure SetotherResponseBytes(AIndex : Integer; const AValue : String); virtual;
Procedure SettextResponseBytes(AIndex : Integer; const AValue : String); virtual;
Procedure SettotalRequestBytes(AIndex : Integer; const AValue : String); virtual;
Public
Published
Property cssResponseBytes : String Index 0 Read FcssResponseBytes Write SetcssResponseBytes;
Property flashResponseBytes : String Index 8 Read FflashResponseBytes Write SetflashResponseBytes;
Property htmlResponseBytes : String Index 16 Read FhtmlResponseBytes Write SethtmlResponseBytes;
Property imageResponseBytes : String Index 24 Read FimageResponseBytes Write SetimageResponseBytes;
Property javascriptResponseBytes : String Index 32 Read FjavascriptResponseBytes Write SetjavascriptResponseBytes;
Property numberCssResources : integer Index 40 Read FnumberCssResources Write SetnumberCssResources;
Property numberHosts : integer Index 48 Read FnumberHosts Write SetnumberHosts;
Property numberJsResources : integer Index 56 Read FnumberJsResources Write SetnumberJsResources;
Property numberResources : integer Index 64 Read FnumberResources Write SetnumberResources;
Property numberStaticResources : integer Index 72 Read FnumberStaticResources Write SetnumberStaticResources;
Property otherResponseBytes : String Index 80 Read FotherResponseBytes Write SetotherResponseBytes;
Property textResponseBytes : String Index 88 Read FtextResponseBytes Write SettextResponseBytes;
Property totalRequestBytes : String Index 96 Read FtotalRequestBytes Write SettotalRequestBytes;
end;
TResultTypepageStatsClass = Class of TResultTypepageStats;
{ --------------------------------------------------------------------
TResultTyperuleGroups
--------------------------------------------------------------------}
TResultTyperuleGroups = Class(TGoogleBaseObject)
Private
Protected
//Property setters
Public
Class Function AllowAdditionalProperties : Boolean; override;
Published
end;
TResultTyperuleGroupsClass = Class of TResultTyperuleGroups;
{ --------------------------------------------------------------------
TResultTypeversion
--------------------------------------------------------------------}
TResultTypeversion = Class(TGoogleBaseObject)
Private
Fmajor : integer;
Fminor : integer;
Protected
//Property setters
Procedure Setmajor(AIndex : Integer; const AValue : integer); virtual;
Procedure Setminor(AIndex : Integer; const AValue : integer); virtual;
Public
Published
Property major : integer Index 0 Read Fmajor Write Setmajor;
Property minor : integer Index 8 Read Fminor Write Setminor;
end;
TResultTypeversionClass = Class of TResultTypeversion;
{ --------------------------------------------------------------------
TResult
--------------------------------------------------------------------}
TResult = Class(TGoogleBaseObject)
Private
FformattedResults : TResultTypeformattedResults;
Fid : String;
FinvalidRules : TStringArray;
Fkind : String;
FpageStats : TResultTypepageStats;
FresponseCode : integer;
FruleGroups : TResultTyperuleGroups;
Fscreenshot : TPagespeedApiImageV2;
Ftitle : String;
Fversion : TResultTypeversion;
Protected
//Property setters
Procedure SetformattedResults(AIndex : Integer; const AValue : TResultTypeformattedResults); virtual;
Procedure Setid(AIndex : Integer; const AValue : String); virtual;
Procedure SetinvalidRules(AIndex : Integer; const AValue : TStringArray); virtual;
Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
Procedure SetpageStats(AIndex : Integer; const AValue : TResultTypepageStats); virtual;
Procedure SetresponseCode(AIndex : Integer; const AValue : integer); virtual;
Procedure SetruleGroups(AIndex : Integer; const AValue : TResultTyperuleGroups); virtual;
Procedure Setscreenshot(AIndex : Integer; const AValue : TPagespeedApiImageV2); virtual;
Procedure Settitle(AIndex : Integer; const AValue : String); virtual;
Procedure Setversion(AIndex : Integer; const AValue : TResultTypeversion); virtual;
//2.6.4. bug workaround
{$IFDEF VER2_6}
Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
{$ENDIF VER2_6}
Public
Published
Property formattedResults : TResultTypeformattedResults Index 0 Read FformattedResults Write SetformattedResults;
Property id : String Index 8 Read Fid Write Setid;
Property invalidRules : TStringArray Index 16 Read FinvalidRules Write SetinvalidRules;
Property kind : String Index 24 Read Fkind Write Setkind;
Property pageStats : TResultTypepageStats Index 32 Read FpageStats Write SetpageStats;
Property responseCode : integer Index 40 Read FresponseCode Write SetresponseCode;
Property ruleGroups : TResultTyperuleGroups Index 48 Read FruleGroups Write SetruleGroups;
Property screenshot : TPagespeedApiImageV2 Index 56 Read Fscreenshot Write Setscreenshot;
Property title : String Index 64 Read Ftitle Write Settitle;
Property version : TResultTypeversion Index 72 Read Fversion Write Setversion;
end;
TResultClass = Class of TResult;
{ --------------------------------------------------------------------
TPagespeedapiResource
--------------------------------------------------------------------}
//Optional query Options for TPagespeedapiResource, method Runpagespeed
TPagespeedapiRunpagespeedOptions = Record
filter_third_party_resources : boolean;
locale : String;
rule : String;
screenshot : boolean;
strategy : String;
url : String;
end;
TPagespeedapiResource = Class(TGoogleResource)
Public
Class Function ResourceName : String; override;
Class Function DefaultAPI : TGoogleAPIClass; override;
Function Runpagespeed(AQuery : string = '') : TResult;
Function Runpagespeed(AQuery : TPagespeedapirunpagespeedOptions) : TResult;
end;
{ --------------------------------------------------------------------
TPagespeedonlineAPI
--------------------------------------------------------------------}
TPagespeedonlineAPI = Class(TGoogleAPI)
Private
FPagespeedapiInstance : TPagespeedapiResource;
Function GetPagespeedapiInstance : TPagespeedapiResource;virtual;
Public
//Override class functions with API info
Class Function APIName : String; override;
Class Function APIVersion : String; override;
Class Function APIRevision : String; override;
Class Function APIID : String; override;
Class Function APITitle : String; override;
Class Function APIDescription : String; override;
Class Function APIOwnerDomain : String; override;
Class Function APIOwnerName : String; override;
Class Function APIIcon16 : String; override;
Class Function APIIcon32 : String; override;
Class Function APIdocumentationLink : String; override;
Class Function APIrootUrl : string; override;
Class Function APIbasePath : string;override;
Class Function APIbaseURL : String;override;
Class Function APIProtocol : string;override;
Class Function APIservicePath : string;override;
Class Function APIbatchPath : String;override;
Class Function APIAuthScopes : TScopeInfoArray;override;
Class Function APINeedsAuth : Boolean;override;
Class Procedure RegisterAPIResources; override;
//Add create function for resources
Function CreatePagespeedapiResource(AOwner : TComponent) : TPagespeedapiResource;virtual;overload;
Function CreatePagespeedapiResource : TPagespeedapiResource;virtual;overload;
//Add default on-demand instances for resources
Property PagespeedapiResource : TPagespeedapiResource Read GetPagespeedapiInstance;
end;
implementation
{ --------------------------------------------------------------------
TPagespeedApiFormatStringV2TypeargsItemTyperectsItem
--------------------------------------------------------------------}
Procedure TPagespeedApiFormatStringV2TypeargsItemTyperectsItem.Setheight(AIndex : Integer; const AValue : integer);
begin
If (Fheight=AValue) then exit;
Fheight:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiFormatStringV2TypeargsItemTyperectsItem.Setleft(AIndex : Integer; const AValue : integer);
begin
If (Fleft=AValue) then exit;
Fleft:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiFormatStringV2TypeargsItemTyperectsItem.Settop(AIndex : Integer; const AValue : integer);
begin
If (Ftop=AValue) then exit;
Ftop:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiFormatStringV2TypeargsItemTyperectsItem.Setwidth(AIndex : Integer; const AValue : integer);
begin
If (Fwidth=AValue) then exit;
Fwidth:=AValue;
MarkPropertyChanged(AIndex);
end;
{ --------------------------------------------------------------------
TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsItem
--------------------------------------------------------------------}
Procedure TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsItem.Setheight(AIndex : Integer; const AValue : integer);
begin
If (Fheight=AValue) then exit;
Fheight:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsItem.Setleft(AIndex : Integer; const AValue : integer);
begin
If (Fleft=AValue) then exit;
Fleft:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsItem.Settop(AIndex : Integer; const AValue : integer);
begin
If (Ftop=AValue) then exit;
Ftop:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsItem.Setwidth(AIndex : Integer; const AValue : integer);
begin
If (Fwidth=AValue) then exit;
Fwidth:=AValue;
MarkPropertyChanged(AIndex);
end;
{ --------------------------------------------------------------------
TPagespeedApiFormatStringV2TypeargsItem
--------------------------------------------------------------------}
Procedure TPagespeedApiFormatStringV2TypeargsItem.Setkey(AIndex : Integer; const AValue : String);
begin
If (Fkey=AValue) then exit;
Fkey:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiFormatStringV2TypeargsItem.Setrects(AIndex : Integer; const AValue : TPagespeedApiFormatStringV2TypeargsItemTyperectsArray);
begin
If (Frects=AValue) then exit;
Frects:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiFormatStringV2TypeargsItem.Setsecondary_rects(AIndex : Integer; const AValue : TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsArray);
begin
If (Fsecondary_rects=AValue) then exit;
Fsecondary_rects:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiFormatStringV2TypeargsItem.Set_type(AIndex : Integer; const AValue : String);
begin
If (F_type=AValue) then exit;
F_type:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiFormatStringV2TypeargsItem.Setvalue(AIndex : Integer; const AValue : String);
begin
If (Fvalue=AValue) then exit;
Fvalue:=AValue;
MarkPropertyChanged(AIndex);
end;
Class Function TPagespeedApiFormatStringV2TypeargsItem.ExportPropertyName(Const AName : String) :String;
begin
Case AName of
'_type' : Result:='type';
else
Result:=Inherited ExportPropertyName(AName);
end;
end;
//2.6.4. bug workaround
{$IFDEF VER2_6}
Procedure TPagespeedApiFormatStringV2TypeargsItem.SetArrayLength(Const AName : String; ALength : Longint);
begin
Case AName of
'rects' : SetLength(Frects,ALength);
'secondary_rects' : SetLength(Fsecondary_rects,ALength);
else
Inherited SetArrayLength(AName,ALength);
end;
end;
{$ENDIF VER2_6}
{ --------------------------------------------------------------------
TPagespeedApiFormatStringV2
--------------------------------------------------------------------}
Procedure TPagespeedApiFormatStringV2.Setargs(AIndex : Integer; const AValue : TPagespeedApiFormatStringV2TypeargsArray);
begin
If (Fargs=AValue) then exit;
Fargs:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiFormatStringV2.Setformat(AIndex : Integer; const AValue : String);
begin
If (Fformat=AValue) then exit;
Fformat:=AValue;
MarkPropertyChanged(AIndex);
end;
//2.6.4. bug workaround
{$IFDEF VER2_6}
Procedure TPagespeedApiFormatStringV2.SetArrayLength(Const AName : String; ALength : Longint);
begin
Case AName of
'args' : SetLength(Fargs,ALength);
else
Inherited SetArrayLength(AName,ALength);
end;
end;
{$ENDIF VER2_6}
{ --------------------------------------------------------------------
TPagespeedApiImageV2Typepage_rect
--------------------------------------------------------------------}
Procedure TPagespeedApiImageV2Typepage_rect.Setheight(AIndex : Integer; const AValue : integer);
begin
If (Fheight=AValue) then exit;
Fheight:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiImageV2Typepage_rect.Setleft(AIndex : Integer; const AValue : integer);
begin
If (Fleft=AValue) then exit;
Fleft:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiImageV2Typepage_rect.Settop(AIndex : Integer; const AValue : integer);
begin
If (Ftop=AValue) then exit;
Ftop:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiImageV2Typepage_rect.Setwidth(AIndex : Integer; const AValue : integer);
begin
If (Fwidth=AValue) then exit;
Fwidth:=AValue;
MarkPropertyChanged(AIndex);
end;
{ --------------------------------------------------------------------
TPagespeedApiImageV2
--------------------------------------------------------------------}
Procedure TPagespeedApiImageV2.Setdata(AIndex : Integer; const AValue : String);
begin
If (Fdata=AValue) then exit;
Fdata:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiImageV2.Setheight(AIndex : Integer; const AValue : integer);
begin
If (Fheight=AValue) then exit;
Fheight:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiImageV2.Setkey(AIndex : Integer; const AValue : String);
begin
If (Fkey=AValue) then exit;
Fkey:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiImageV2.Setmime_type(AIndex : Integer; const AValue : String);
begin
If (Fmime_type=AValue) then exit;
Fmime_type:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiImageV2.Setpage_rect(AIndex : Integer; const AValue : TPagespeedApiImageV2Typepage_rect);
begin
If (Fpage_rect=AValue) then exit;
Fpage_rect:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TPagespeedApiImageV2.Setwidth(AIndex : Integer; const AValue : integer);
begin
If (Fwidth=AValue) then exit;
Fwidth:=AValue;
MarkPropertyChanged(AIndex);
end;
{ --------------------------------------------------------------------
TResultTypeformattedResultsTyperuleResults
--------------------------------------------------------------------}
Class Function TResultTypeformattedResultsTyperuleResults.AllowAdditionalProperties : Boolean;
begin
Result:=True;
end;
{ --------------------------------------------------------------------
TResultTypeformattedResults
--------------------------------------------------------------------}
Procedure TResultTypeformattedResults.Setlocale(AIndex : Integer; const AValue : String);
begin
If (Flocale=AValue) then exit;
Flocale:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypeformattedResults.SetruleResults(AIndex : Integer; const AValue : TResultTypeformattedResultsTyperuleResults);
begin
If (FruleResults=AValue) then exit;
FruleResults:=AValue;
MarkPropertyChanged(AIndex);
end;
{ --------------------------------------------------------------------
TResultTypepageStats
--------------------------------------------------------------------}
Procedure TResultTypepageStats.SetcssResponseBytes(AIndex : Integer; const AValue : String);
begin
If (FcssResponseBytes=AValue) then exit;
FcssResponseBytes:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypepageStats.SetflashResponseBytes(AIndex : Integer; const AValue : String);
begin
If (FflashResponseBytes=AValue) then exit;
FflashResponseBytes:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypepageStats.SethtmlResponseBytes(AIndex : Integer; const AValue : String);
begin
If (FhtmlResponseBytes=AValue) then exit;
FhtmlResponseBytes:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypepageStats.SetimageResponseBytes(AIndex : Integer; const AValue : String);
begin
If (FimageResponseBytes=AValue) then exit;
FimageResponseBytes:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypepageStats.SetjavascriptResponseBytes(AIndex : Integer; const AValue : String);
begin
If (FjavascriptResponseBytes=AValue) then exit;
FjavascriptResponseBytes:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypepageStats.SetnumberCssResources(AIndex : Integer; const AValue : integer);
begin
If (FnumberCssResources=AValue) then exit;
FnumberCssResources:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypepageStats.SetnumberHosts(AIndex : Integer; const AValue : integer);
begin
If (FnumberHosts=AValue) then exit;
FnumberHosts:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypepageStats.SetnumberJsResources(AIndex : Integer; const AValue : integer);
begin
If (FnumberJsResources=AValue) then exit;
FnumberJsResources:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypepageStats.SetnumberResources(AIndex : Integer; const AValue : integer);
begin
If (FnumberResources=AValue) then exit;
FnumberResources:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypepageStats.SetnumberStaticResources(AIndex : Integer; const AValue : integer);
begin
If (FnumberStaticResources=AValue) then exit;
FnumberStaticResources:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypepageStats.SetotherResponseBytes(AIndex : Integer; const AValue : String);
begin
If (FotherResponseBytes=AValue) then exit;
FotherResponseBytes:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypepageStats.SettextResponseBytes(AIndex : Integer; const AValue : String);
begin
If (FtextResponseBytes=AValue) then exit;
FtextResponseBytes:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypepageStats.SettotalRequestBytes(AIndex : Integer; const AValue : String);
begin
If (FtotalRequestBytes=AValue) then exit;
FtotalRequestBytes:=AValue;
MarkPropertyChanged(AIndex);
end;
{ --------------------------------------------------------------------
TResultTyperuleGroups
--------------------------------------------------------------------}
Class Function TResultTyperuleGroups.AllowAdditionalProperties : Boolean;
begin
Result:=True;
end;
{ --------------------------------------------------------------------
TResultTypeversion
--------------------------------------------------------------------}
Procedure TResultTypeversion.Setmajor(AIndex : Integer; const AValue : integer);
begin
If (Fmajor=AValue) then exit;
Fmajor:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResultTypeversion.Setminor(AIndex : Integer; const AValue : integer);
begin
If (Fminor=AValue) then exit;
Fminor:=AValue;
MarkPropertyChanged(AIndex);
end;
{ --------------------------------------------------------------------
TResult
--------------------------------------------------------------------}
Procedure TResult.SetformattedResults(AIndex : Integer; const AValue : TResultTypeformattedResults);
begin
If (FformattedResults=AValue) then exit;
FformattedResults:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResult.Setid(AIndex : Integer; const AValue : String);
begin
If (Fid=AValue) then exit;
Fid:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResult.SetinvalidRules(AIndex : Integer; const AValue : TStringArray);
begin
If (FinvalidRules=AValue) then exit;
FinvalidRules:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResult.Setkind(AIndex : Integer; const AValue : String);
begin
If (Fkind=AValue) then exit;
Fkind:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResult.SetpageStats(AIndex : Integer; const AValue : TResultTypepageStats);
begin
If (FpageStats=AValue) then exit;
FpageStats:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResult.SetresponseCode(AIndex : Integer; const AValue : integer);
begin
If (FresponseCode=AValue) then exit;
FresponseCode:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResult.SetruleGroups(AIndex : Integer; const AValue : TResultTyperuleGroups);
begin
If (FruleGroups=AValue) then exit;
FruleGroups:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResult.Setscreenshot(AIndex : Integer; const AValue : TPagespeedApiImageV2);
begin
If (Fscreenshot=AValue) then exit;
Fscreenshot:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResult.Settitle(AIndex : Integer; const AValue : String);
begin
If (Ftitle=AValue) then exit;
Ftitle:=AValue;
MarkPropertyChanged(AIndex);
end;
Procedure TResult.Setversion(AIndex : Integer; const AValue : TResultTypeversion);
begin
If (Fversion=AValue) then exit;
Fversion:=AValue;
MarkPropertyChanged(AIndex);
end;
//2.6.4. bug workaround
{$IFDEF VER2_6}
Procedure TResult.SetArrayLength(Const AName : String; ALength : Longint);
begin
Case AName of
'invalidrules' : SetLength(FinvalidRules,ALength);
else
Inherited SetArrayLength(AName,ALength);
end;
end;
{$ENDIF VER2_6}
{ --------------------------------------------------------------------
TPagespeedapiResource
--------------------------------------------------------------------}
Class Function TPagespeedapiResource.ResourceName : String;
begin
Result:='pagespeedapi';
end;
Class Function TPagespeedapiResource.DefaultAPI : TGoogleAPIClass;
begin
Result:=TpagespeedonlineAPI;
end;
Function TPagespeedapiResource.Runpagespeed(AQuery : string = '') : TResult;
Const
_HTTPMethod = 'GET';
_Path = 'runPagespeed';
_Methodid = 'pagespeedonline.pagespeedapi.runpagespeed';
begin
Result:=ServiceCall(_HTTPMethod,_Path,AQuery,Nil,TResult) as TResult;
end;
Function TPagespeedapiResource.Runpagespeed(AQuery : TPagespeedapirunpagespeedOptions) : TResult;
Var
_Q : String;
begin
_Q:='';
AddToQuery(_Q,'filter_third_party_resources',AQuery.filter_third_party_resources);
AddToQuery(_Q,'locale',AQuery.locale);
AddToQuery(_Q,'rule',AQuery.rule);
AddToQuery(_Q,'screenshot',AQuery.screenshot);
AddToQuery(_Q,'strategy',AQuery.strategy);
AddToQuery(_Q,'url',AQuery.url);
Result:=Runpagespeed(_Q);
end;
{ --------------------------------------------------------------------
TPagespeedonlineAPI
--------------------------------------------------------------------}
Class Function TPagespeedonlineAPI.APIName : String;
begin
Result:='pagespeedonline';
end;
Class Function TPagespeedonlineAPI.APIVersion : String;
begin
Result:='v2';
end;
Class Function TPagespeedonlineAPI.APIRevision : String;
begin
Result:='20160516';
end;
Class Function TPagespeedonlineAPI.APIID : String;
begin
Result:='pagespeedonline:v2';
end;
Class Function TPagespeedonlineAPI.APITitle : String;
begin
Result:='PageSpeed Insights API';
end;
Class Function TPagespeedonlineAPI.APIDescription : String;
begin
Result:='Analyzes the performance of a web page and provides tailored suggestions to make that page faster.';
end;
Class Function TPagespeedonlineAPI.APIOwnerDomain : String;
begin
Result:='google.com';
end;
Class Function TPagespeedonlineAPI.APIOwnerName : String;
begin
Result:='Google';
end;
Class Function TPagespeedonlineAPI.APIIcon16 : String;
begin
Result:='https://www.google.com/images/icons/product/pagespeed-16.png';
end;
Class Function TPagespeedonlineAPI.APIIcon32 : String;
begin
Result:='https://www.google.com/images/icons/product/pagespeed-32.png';
end;
Class Function TPagespeedonlineAPI.APIdocumentationLink : String;
begin
Result:='https://developers.google.com/speed/docs/insights/v2/getting-started';
end;
Class Function TPagespeedonlineAPI.APIrootUrl : string;
begin
Result:='https://www.googleapis.com/';
end;
Class Function TPagespeedonlineAPI.APIbasePath : string;
begin
Result:='/pagespeedonline/v2/';
end;
Class Function TPagespeedonlineAPI.APIbaseURL : String;
begin
Result:='https://www.googleapis.com/pagespeedonline/v2/';
end;
Class Function TPagespeedonlineAPI.APIProtocol : string;
begin
Result:='rest';
end;
Class Function TPagespeedonlineAPI.APIservicePath : string;
begin
Result:='pagespeedonline/v2/';
end;
Class Function TPagespeedonlineAPI.APIbatchPath : String;
begin
Result:='batch';
end;
Class Function TPagespeedonlineAPI.APIAuthScopes : TScopeInfoArray;
begin
SetLength(Result,0);
end;
Class Function TPagespeedonlineAPI.APINeedsAuth : Boolean;
begin
Result:=False;
end;
Class Procedure TPagespeedonlineAPI.RegisterAPIResources;
begin
TPagespeedApiFormatStringV2TypeargsItemTyperectsItem.RegisterObject;
TPagespeedApiFormatStringV2TypeargsItemTypesecondary_rectsItem.RegisterObject;
TPagespeedApiFormatStringV2TypeargsItem.RegisterObject;
TPagespeedApiFormatStringV2.RegisterObject;
TPagespeedApiImageV2Typepage_rect.RegisterObject;
TPagespeedApiImageV2.RegisterObject;
TResultTypeformattedResultsTyperuleResults.RegisterObject;
TResultTypeformattedResults.RegisterObject;
TResultTypepageStats.RegisterObject;
TResultTyperuleGroups.RegisterObject;
TResultTypeversion.RegisterObject;
TResult.RegisterObject;
end;
Function TPagespeedonlineAPI.GetPagespeedapiInstance : TPagespeedapiResource;
begin
if (FPagespeedapiInstance=Nil) then
FPagespeedapiInstance:=CreatePagespeedapiResource;
Result:=FPagespeedapiInstance;
end;
Function TPagespeedonlineAPI.CreatePagespeedapiResource : TPagespeedapiResource;
begin
Result:=CreatePagespeedapiResource(Self);
end;
Function TPagespeedonlineAPI.CreatePagespeedapiResource(AOwner : TComponent) : TPagespeedapiResource;
begin
Result:=TPagespeedapiResource.Create(AOwner);
Result.API:=Self.API;
end;
initialization
TPagespeedonlineAPI.RegisterAPI;
end.
|