1unit googlesiteVerification;
2{$MODE objfpc}
3{$H+}
4
5interface
6
7uses sysutils, classes, googleservice, restbase, googlebase;
8
9type
10
11  //Top-level schema types
12  TSiteVerificationWebResourceGettokenRequest = Class;
13  TSiteVerificationWebResourceGettokenResponse = Class;
14  TSiteVerificationWebResourceListResponse = Class;
15  TSiteVerificationWebResourceResource = Class;
16  TSiteVerificationWebResourceGettokenRequestArray = Array of TSiteVerificationWebResourceGettokenRequest;
17  TSiteVerificationWebResourceGettokenResponseArray = Array of TSiteVerificationWebResourceGettokenResponse;
18  TSiteVerificationWebResourceListResponseArray = Array of TSiteVerificationWebResourceListResponse;
19  TSiteVerificationWebResourceResourceArray = Array of TSiteVerificationWebResourceResource;
20  //Anonymous types, using auto-generated names
21  TSiteVerificationWebResourceGettokenRequestTypesite = Class;
22  TSiteVerificationWebResourceResourceTypesite = Class;
23  TSiteVerificationWebResourceListResponseTypeitemsArray = Array of TSiteVerificationWebResourceResource;
24
25  { --------------------------------------------------------------------
26    TSiteVerificationWebResourceGettokenRequestTypesite
27    --------------------------------------------------------------------}
28
29  TSiteVerificationWebResourceGettokenRequestTypesite = Class(TGoogleBaseObject)
30  Private
31    Fidentifier : String;
32    F_type : String;
33  Protected
34    Class Function ExportPropertyName(Const AName : String) : string; override;
35    //Property setters
36    Procedure Setidentifier(AIndex : Integer; const AValue : String); virtual;
37    Procedure Set_type(AIndex : Integer; const AValue : String); virtual;
38  Public
39  Published
40    Property identifier : String Index 0 Read Fidentifier Write Setidentifier;
41    Property _type : String Index 8 Read F_type Write Set_type;
42  end;
43  TSiteVerificationWebResourceGettokenRequestTypesiteClass = Class of TSiteVerificationWebResourceGettokenRequestTypesite;
44
45  { --------------------------------------------------------------------
46    TSiteVerificationWebResourceGettokenRequest
47    --------------------------------------------------------------------}
48
49  TSiteVerificationWebResourceGettokenRequest = Class(TGoogleBaseObject)
50  Private
51    Fsite : TSiteVerificationWebResourceGettokenRequestTypesite;
52    FverificationMethod : String;
53  Protected
54    //Property setters
55    Procedure Setsite(AIndex : Integer; const AValue : TSiteVerificationWebResourceGettokenRequestTypesite); virtual;
56    Procedure SetverificationMethod(AIndex : Integer; const AValue : String); virtual;
57  Public
58  Published
59    Property site : TSiteVerificationWebResourceGettokenRequestTypesite Index 0 Read Fsite Write Setsite;
60    Property verificationMethod : String Index 8 Read FverificationMethod Write SetverificationMethod;
61  end;
62  TSiteVerificationWebResourceGettokenRequestClass = Class of TSiteVerificationWebResourceGettokenRequest;
63
64  { --------------------------------------------------------------------
65    TSiteVerificationWebResourceGettokenResponse
66    --------------------------------------------------------------------}
67
68  TSiteVerificationWebResourceGettokenResponse = Class(TGoogleBaseObject)
69  Private
70    Fmethod : String;
71    Ftoken : String;
72  Protected
73    //Property setters
74    Procedure Setmethod(AIndex : Integer; const AValue : String); virtual;
75    Procedure Settoken(AIndex : Integer; const AValue : String); virtual;
76  Public
77  Published
78    Property method : String Index 0 Read Fmethod Write Setmethod;
79    Property token : String Index 8 Read Ftoken Write Settoken;
80  end;
81  TSiteVerificationWebResourceGettokenResponseClass = Class of TSiteVerificationWebResourceGettokenResponse;
82
83  { --------------------------------------------------------------------
84    TSiteVerificationWebResourceListResponse
85    --------------------------------------------------------------------}
86
87  TSiteVerificationWebResourceListResponse = Class(TGoogleBaseObject)
88  Private
89    Fitems : TSiteVerificationWebResourceListResponseTypeitemsArray;
90  Protected
91    //Property setters
92    Procedure Setitems(AIndex : Integer; const AValue : TSiteVerificationWebResourceListResponseTypeitemsArray); virtual;
93    //2.6.4. bug workaround
94    {$IFDEF VER2_6}
95    Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
96    {$ENDIF VER2_6}
97  Public
98  Published
99    Property items : TSiteVerificationWebResourceListResponseTypeitemsArray Index 0 Read Fitems Write Setitems;
100  end;
101  TSiteVerificationWebResourceListResponseClass = Class of TSiteVerificationWebResourceListResponse;
102
103  { --------------------------------------------------------------------
104    TSiteVerificationWebResourceResourceTypesite
105    --------------------------------------------------------------------}
106
107  TSiteVerificationWebResourceResourceTypesite = Class(TGoogleBaseObject)
108  Private
109    Fidentifier : String;
110    F_type : String;
111  Protected
112    Class Function ExportPropertyName(Const AName : String) : string; override;
113    //Property setters
114    Procedure Setidentifier(AIndex : Integer; const AValue : String); virtual;
115    Procedure Set_type(AIndex : Integer; const AValue : String); virtual;
116  Public
117  Published
118    Property identifier : String Index 0 Read Fidentifier Write Setidentifier;
119    Property _type : String Index 8 Read F_type Write Set_type;
120  end;
121  TSiteVerificationWebResourceResourceTypesiteClass = Class of TSiteVerificationWebResourceResourceTypesite;
122
123  { --------------------------------------------------------------------
124    TSiteVerificationWebResourceResource
125    --------------------------------------------------------------------}
126
127  TSiteVerificationWebResourceResource = Class(TGoogleBaseObject)
128  Private
129    Fid : String;
130    Fowners : TStringArray;
131    Fsite : TSiteVerificationWebResourceResourceTypesite;
132  Protected
133    //Property setters
134    Procedure Setid(AIndex : Integer; const AValue : String); virtual;
135    Procedure Setowners(AIndex : Integer; const AValue : TStringArray); virtual;
136    Procedure Setsite(AIndex : Integer; const AValue : TSiteVerificationWebResourceResourceTypesite); virtual;
137    //2.6.4. bug workaround
138    {$IFDEF VER2_6}
139    Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
140    {$ENDIF VER2_6}
141  Public
142  Published
143    Property id : String Index 0 Read Fid Write Setid;
144    Property owners : TStringArray Index 8 Read Fowners Write Setowners;
145    Property site : TSiteVerificationWebResourceResourceTypesite Index 16 Read Fsite Write Setsite;
146  end;
147  TSiteVerificationWebResourceResourceClass = Class of TSiteVerificationWebResourceResource;
148
149  { --------------------------------------------------------------------
150    TWebResourceResource
151    --------------------------------------------------------------------}
152
153
154  //Optional query Options for TWebResourceResource, method Insert
155
156  TWebResourceInsertOptions = Record
157    verificationMethod : String;
158  end;
159
160  TWebResourceResource = Class(TGoogleResource)
161  Public
162    Class Function ResourceName : String; override;
163    Class Function DefaultAPI : TGoogleAPIClass; override;
164    Procedure Delete(id: string);
165    Function Get(id: string) : TSiteVerificationWebResourceResource;
166    Function GetToken(aSiteVerificationWebResourceGettokenRequest : TSiteVerificationWebResourceGettokenRequest) : TSiteVerificationWebResourceGettokenResponse;
167    Function Insert(aSiteVerificationWebResourceResource : TSiteVerificationWebResourceResource; AQuery : string  = '') : TSiteVerificationWebResourceResource;
168    Function Insert(aSiteVerificationWebResourceResource : TSiteVerificationWebResourceResource; AQuery : TWebResourceinsertOptions) : TSiteVerificationWebResourceResource;
169    Function List : TSiteVerificationWebResourceListResponse;
170    Function Patch(id: string; aSiteVerificationWebResourceResource : TSiteVerificationWebResourceResource) : TSiteVerificationWebResourceResource;
171    Function Update(id: string; aSiteVerificationWebResourceResource : TSiteVerificationWebResourceResource) : TSiteVerificationWebResourceResource;
172  end;
173
174
175  { --------------------------------------------------------------------
176    TSiteVerificationAPI
177    --------------------------------------------------------------------}
178
179  TSiteVerificationAPI = Class(TGoogleAPI)
180  Private
181    FWebResourceInstance : TWebResourceResource;
182    Function GetWebResourceInstance : TWebResourceResource;virtual;
183  Public
184    //Override class functions with API info
185    Class Function APIName : String; override;
186    Class Function APIVersion : String; override;
187    Class Function APIRevision : String; override;
188    Class Function APIID : String; override;
189    Class Function APITitle : String; override;
190    Class Function APIDescription : String; override;
191    Class Function APIOwnerDomain : String; override;
192    Class Function APIOwnerName : String; override;
193    Class Function APIIcon16 : String; override;
194    Class Function APIIcon32 : String; override;
195    Class Function APIdocumentationLink : String; override;
196    Class Function APIrootUrl : string; override;
197    Class Function APIbasePath : string;override;
198    Class Function APIbaseURL : String;override;
199    Class Function APIProtocol : string;override;
200    Class Function APIservicePath : string;override;
201    Class Function APIbatchPath : String;override;
202    Class Function APIAuthScopes : TScopeInfoArray;override;
203    Class Function APINeedsAuth : Boolean;override;
204    Class Procedure RegisterAPIResources; override;
205    //Add create function for resources
206    Function CreateWebResourceResource(AOwner : TComponent) : TWebResourceResource;virtual;overload;
207    Function CreateWebResourceResource : TWebResourceResource;virtual;overload;
208    //Add default on-demand instances for resources
209    Property WebResourceResource : TWebResourceResource Read GetWebResourceInstance;
210  end;
211
212implementation
213
214
215{ --------------------------------------------------------------------
216  TSiteVerificationWebResourceGettokenRequestTypesite
217  --------------------------------------------------------------------}
218
219
220Procedure TSiteVerificationWebResourceGettokenRequestTypesite.Setidentifier(AIndex : Integer; const AValue : String);
221
222begin
223  If (Fidentifier=AValue) then exit;
224  Fidentifier:=AValue;
225  MarkPropertyChanged(AIndex);
226end;
227
228
229
230Procedure TSiteVerificationWebResourceGettokenRequestTypesite.Set_type(AIndex : Integer; const AValue : String);
231
232begin
233  If (F_type=AValue) then exit;
234  F_type:=AValue;
235  MarkPropertyChanged(AIndex);
236end;
237
238
239
240Class Function TSiteVerificationWebResourceGettokenRequestTypesite.ExportPropertyName(Const AName : String) :String;
241
242begin
243  Case AName of
244  '_type' : Result:='type';
245  else
246    Result:=Inherited ExportPropertyName(AName);
247  end;
248end;
249
250
251
252
253{ --------------------------------------------------------------------
254  TSiteVerificationWebResourceGettokenRequest
255  --------------------------------------------------------------------}
256
257
258Procedure TSiteVerificationWebResourceGettokenRequest.Setsite(AIndex : Integer; const AValue : TSiteVerificationWebResourceGettokenRequestTypesite);
259
260begin
261  If (Fsite=AValue) then exit;
262  Fsite:=AValue;
263  MarkPropertyChanged(AIndex);
264end;
265
266
267
268Procedure TSiteVerificationWebResourceGettokenRequest.SetverificationMethod(AIndex : Integer; const AValue : String);
269
270begin
271  If (FverificationMethod=AValue) then exit;
272  FverificationMethod:=AValue;
273  MarkPropertyChanged(AIndex);
274end;
275
276
277
278
279
280{ --------------------------------------------------------------------
281  TSiteVerificationWebResourceGettokenResponse
282  --------------------------------------------------------------------}
283
284
285Procedure TSiteVerificationWebResourceGettokenResponse.Setmethod(AIndex : Integer; const AValue : String);
286
287begin
288  If (Fmethod=AValue) then exit;
289  Fmethod:=AValue;
290  MarkPropertyChanged(AIndex);
291end;
292
293
294
295Procedure TSiteVerificationWebResourceGettokenResponse.Settoken(AIndex : Integer; const AValue : String);
296
297begin
298  If (Ftoken=AValue) then exit;
299  Ftoken:=AValue;
300  MarkPropertyChanged(AIndex);
301end;
302
303
304
305
306
307{ --------------------------------------------------------------------
308  TSiteVerificationWebResourceListResponse
309  --------------------------------------------------------------------}
310
311
312Procedure TSiteVerificationWebResourceListResponse.Setitems(AIndex : Integer; const AValue : TSiteVerificationWebResourceListResponseTypeitemsArray);
313
314begin
315  If (Fitems=AValue) then exit;
316  Fitems:=AValue;
317  MarkPropertyChanged(AIndex);
318end;
319
320
321//2.6.4. bug workaround
322{$IFDEF VER2_6}
323Procedure TSiteVerificationWebResourceListResponse.SetArrayLength(Const AName : String; ALength : Longint);
324
325begin
326  Case AName of
327  'items' : SetLength(Fitems,ALength);
328  else
329    Inherited SetArrayLength(AName,ALength);
330  end;
331end;
332{$ENDIF VER2_6}
333
334
335
336
337{ --------------------------------------------------------------------
338  TSiteVerificationWebResourceResourceTypesite
339  --------------------------------------------------------------------}
340
341
342Procedure TSiteVerificationWebResourceResourceTypesite.Setidentifier(AIndex : Integer; const AValue : String);
343
344begin
345  If (Fidentifier=AValue) then exit;
346  Fidentifier:=AValue;
347  MarkPropertyChanged(AIndex);
348end;
349
350
351
352Procedure TSiteVerificationWebResourceResourceTypesite.Set_type(AIndex : Integer; const AValue : String);
353
354begin
355  If (F_type=AValue) then exit;
356  F_type:=AValue;
357  MarkPropertyChanged(AIndex);
358end;
359
360
361
362Class Function TSiteVerificationWebResourceResourceTypesite.ExportPropertyName(Const AName : String) :String;
363
364begin
365  Case AName of
366  '_type' : Result:='type';
367  else
368    Result:=Inherited ExportPropertyName(AName);
369  end;
370end;
371
372
373
374
375{ --------------------------------------------------------------------
376  TSiteVerificationWebResourceResource
377  --------------------------------------------------------------------}
378
379
380Procedure TSiteVerificationWebResourceResource.Setid(AIndex : Integer; const AValue : String);
381
382begin
383  If (Fid=AValue) then exit;
384  Fid:=AValue;
385  MarkPropertyChanged(AIndex);
386end;
387
388
389
390Procedure TSiteVerificationWebResourceResource.Setowners(AIndex : Integer; const AValue : TStringArray);
391
392begin
393  If (Fowners=AValue) then exit;
394  Fowners:=AValue;
395  MarkPropertyChanged(AIndex);
396end;
397
398
399
400Procedure TSiteVerificationWebResourceResource.Setsite(AIndex : Integer; const AValue : TSiteVerificationWebResourceResourceTypesite);
401
402begin
403  If (Fsite=AValue) then exit;
404  Fsite:=AValue;
405  MarkPropertyChanged(AIndex);
406end;
407
408
409//2.6.4. bug workaround
410{$IFDEF VER2_6}
411Procedure TSiteVerificationWebResourceResource.SetArrayLength(Const AName : String; ALength : Longint);
412
413begin
414  Case AName of
415  'owners' : SetLength(Fowners,ALength);
416  else
417    Inherited SetArrayLength(AName,ALength);
418  end;
419end;
420{$ENDIF VER2_6}
421
422
423
424
425{ --------------------------------------------------------------------
426  TWebResourceResource
427  --------------------------------------------------------------------}
428
429
430Class Function TWebResourceResource.ResourceName : String;
431
432begin
433  Result:='webResource';
434end;
435
436Class Function TWebResourceResource.DefaultAPI : TGoogleAPIClass;
437
438begin
439  Result:=TsiteVerificationAPI;
440end;
441
442Procedure TWebResourceResource.Delete(id: string);
443
444Const
445  _HTTPMethod = 'DELETE';
446  _Path       = 'webResource/{id}';
447  _Methodid   = 'siteVerification.webResource.delete';
448
449Var
450  _P : String;
451
452begin
453  _P:=SubstitutePath(_Path,['id',id]);
454  ServiceCall(_HTTPMethod,_P,'',Nil,Nil);
455end;
456
457Function TWebResourceResource.Get(id: string) : TSiteVerificationWebResourceResource;
458
459Const
460  _HTTPMethod = 'GET';
461  _Path       = 'webResource/{id}';
462  _Methodid   = 'siteVerification.webResource.get';
463
464Var
465  _P : String;
466
467begin
468  _P:=SubstitutePath(_Path,['id',id]);
469  Result:=ServiceCall(_HTTPMethod,_P,'',Nil,TSiteVerificationWebResourceResource) as TSiteVerificationWebResourceResource;
470end;
471
472Function TWebResourceResource.GetToken(aSiteVerificationWebResourceGettokenRequest : TSiteVerificationWebResourceGettokenRequest) : TSiteVerificationWebResourceGettokenResponse;
473
474Const
475  _HTTPMethod = 'POST';
476  _Path       = 'token';
477  _Methodid   = 'siteVerification.webResource.getToken';
478
479begin
480  Result:=ServiceCall(_HTTPMethod,_Path,'',aSiteVerificationWebResourceGettokenRequest,TSiteVerificationWebResourceGettokenResponse) as TSiteVerificationWebResourceGettokenResponse;
481end;
482
483Function TWebResourceResource.Insert(aSiteVerificationWebResourceResource : TSiteVerificationWebResourceResource; AQuery : string = '') : TSiteVerificationWebResourceResource;
484
485Const
486  _HTTPMethod = 'POST';
487  _Path       = 'webResource';
488  _Methodid   = 'siteVerification.webResource.insert';
489
490begin
491  Result:=ServiceCall(_HTTPMethod,_Path,AQuery,aSiteVerificationWebResourceResource,TSiteVerificationWebResourceResource) as TSiteVerificationWebResourceResource;
492end;
493
494
495Function TWebResourceResource.Insert(aSiteVerificationWebResourceResource : TSiteVerificationWebResourceResource; AQuery : TWebResourceinsertOptions) : TSiteVerificationWebResourceResource;
496
497Var
498  _Q : String;
499
500begin
501  _Q:='';
502  AddToQuery(_Q,'verificationMethod',AQuery.verificationMethod);
503  Result:=Insert(aSiteVerificationWebResourceResource,_Q);
504end;
505
506Function TWebResourceResource.List : TSiteVerificationWebResourceListResponse;
507
508Const
509  _HTTPMethod = 'GET';
510  _Path       = 'webResource';
511  _Methodid   = 'siteVerification.webResource.list';
512
513begin
514  Result:=ServiceCall(_HTTPMethod,_Path,'',Nil,TSiteVerificationWebResourceListResponse) as TSiteVerificationWebResourceListResponse;
515end;
516
517Function TWebResourceResource.Patch(id: string; aSiteVerificationWebResourceResource : TSiteVerificationWebResourceResource) : TSiteVerificationWebResourceResource;
518
519Const
520  _HTTPMethod = 'PATCH';
521  _Path       = 'webResource/{id}';
522  _Methodid   = 'siteVerification.webResource.patch';
523
524Var
525  _P : String;
526
527begin
528  _P:=SubstitutePath(_Path,['id',id]);
529  Result:=ServiceCall(_HTTPMethod,_P,'',aSiteVerificationWebResourceResource,TSiteVerificationWebResourceResource) as TSiteVerificationWebResourceResource;
530end;
531
532Function TWebResourceResource.Update(id: string; aSiteVerificationWebResourceResource : TSiteVerificationWebResourceResource) : TSiteVerificationWebResourceResource;
533
534Const
535  _HTTPMethod = 'PUT';
536  _Path       = 'webResource/{id}';
537  _Methodid   = 'siteVerification.webResource.update';
538
539Var
540  _P : String;
541
542begin
543  _P:=SubstitutePath(_Path,['id',id]);
544  Result:=ServiceCall(_HTTPMethod,_P,'',aSiteVerificationWebResourceResource,TSiteVerificationWebResourceResource) as TSiteVerificationWebResourceResource;
545end;
546
547
548
549{ --------------------------------------------------------------------
550  TSiteVerificationAPI
551  --------------------------------------------------------------------}
552
553Class Function TSiteVerificationAPI.APIName : String;
554
555begin
556  Result:='siteVerification';
557end;
558
559Class Function TSiteVerificationAPI.APIVersion : String;
560
561begin
562  Result:='v1';
563end;
564
565Class Function TSiteVerificationAPI.APIRevision : String;
566
567begin
568  Result:='20160228';
569end;
570
571Class Function TSiteVerificationAPI.APIID : String;
572
573begin
574  Result:='siteVerification:v1';
575end;
576
577Class Function TSiteVerificationAPI.APITitle : String;
578
579begin
580  Result:='Google Site Verification API';
581end;
582
583Class Function TSiteVerificationAPI.APIDescription : String;
584
585begin
586  Result:='Verifies ownership of websites or domains with Google.';
587end;
588
589Class Function TSiteVerificationAPI.APIOwnerDomain : String;
590
591begin
592  Result:='google.com';
593end;
594
595Class Function TSiteVerificationAPI.APIOwnerName : String;
596
597begin
598  Result:='Google';
599end;
600
601Class Function TSiteVerificationAPI.APIIcon16 : String;
602
603begin
604  Result:='http://www.google.com/images/icons/product/search-16.gif';
605end;
606
607Class Function TSiteVerificationAPI.APIIcon32 : String;
608
609begin
610  Result:='http://www.google.com/images/icons/product/search-32.gif';
611end;
612
613Class Function TSiteVerificationAPI.APIdocumentationLink : String;
614
615begin
616  Result:='https://developers.google.com/site-verification/';
617end;
618
619Class Function TSiteVerificationAPI.APIrootUrl : string;
620
621begin
622  Result:='https://www.googleapis.com/';
623end;
624
625Class Function TSiteVerificationAPI.APIbasePath : string;
626
627begin
628  Result:='/siteVerification/v1/';
629end;
630
631Class Function TSiteVerificationAPI.APIbaseURL : String;
632
633begin
634  Result:='https://www.googleapis.com/siteVerification/v1/';
635end;
636
637Class Function TSiteVerificationAPI.APIProtocol : string;
638
639begin
640  Result:='rest';
641end;
642
643Class Function TSiteVerificationAPI.APIservicePath : string;
644
645begin
646  Result:='siteVerification/v1/';
647end;
648
649Class Function TSiteVerificationAPI.APIbatchPath : String;
650
651begin
652  Result:='batch';
653end;
654
655Class Function TSiteVerificationAPI.APIAuthScopes : TScopeInfoArray;
656
657begin
658  SetLength(Result,2);
659  Result[0].Name:='https://www.googleapis.com/auth/siteverification';
660  Result[0].Description:='Manage the list of sites and domains you control';
661  Result[1].Name:='https://www.googleapis.com/auth/siteverification.verify_only';
662  Result[1].Description:='Manage your new site verifications with Google';
663
664end;
665
666Class Function TSiteVerificationAPI.APINeedsAuth : Boolean;
667
668begin
669  Result:=True;
670end;
671
672Class Procedure TSiteVerificationAPI.RegisterAPIResources;
673
674begin
675  TSiteVerificationWebResourceGettokenRequestTypesite.RegisterObject;
676  TSiteVerificationWebResourceGettokenRequest.RegisterObject;
677  TSiteVerificationWebResourceGettokenResponse.RegisterObject;
678  TSiteVerificationWebResourceListResponse.RegisterObject;
679  TSiteVerificationWebResourceResourceTypesite.RegisterObject;
680  TSiteVerificationWebResourceResource.RegisterObject;
681end;
682
683
684Function TSiteVerificationAPI.GetWebResourceInstance : TWebResourceResource;
685
686begin
687  if (FWebResourceInstance=Nil) then
688    FWebResourceInstance:=CreateWebResourceResource;
689  Result:=FWebResourceInstance;
690end;
691
692Function TSiteVerificationAPI.CreateWebResourceResource : TWebResourceResource;
693
694begin
695  Result:=CreateWebResourceResource(Self);
696end;
697
698
699Function TSiteVerificationAPI.CreateWebResourceResource(AOwner : TComponent) : TWebResourceResource;
700
701begin
702  Result:=TWebResourceResource.Create(AOwner);
703  Result.API:=Self.API;
704end;
705
706
707
708initialization
709  TSiteVerificationAPI.RegisterAPI;
710end.
711