123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516 |
- unit googlefreebase;
- {$MODE objfpc}
- {$H+}
- interface
- uses sysutils, classes, googleservice, restbase, googlebase;
- type
-
- //Top-level schema types
- TReconcileCandidate = Class;
- TReconcileGet = Class;
- TReconcileCandidateArray = Array of TReconcileCandidate;
- TReconcileGetArray = Array of TReconcileGet;
- //Anonymous types, using auto-generated names
- TReconcileCandidateTypenotable = Class;
- TReconcileGetTypecosts = Class;
- TReconcileGetTypewarningItem = Class;
- TReconcileGetTypecandidateArray = Array of TReconcileCandidate;
- TReconcileGetTypewarningArray = Array of TReconcileGetTypewarningItem;
-
- { --------------------------------------------------------------------
- TReconcileCandidateTypenotable
- --------------------------------------------------------------------}
-
- TReconcileCandidateTypenotable = Class(TGoogleBaseObject)
- Private
- Fid : String;
- Fname : String;
- Protected
- //Property setters
- Procedure Setid(AIndex : Integer; const AValue : String); virtual;
- Procedure Setname(AIndex : Integer; const AValue : String); virtual;
- Public
- Published
- Property id : String Index 0 Read Fid Write Setid;
- Property name : String Index 8 Read Fname Write Setname;
- end;
- TReconcileCandidateTypenotableClass = Class of TReconcileCandidateTypenotable;
-
- { --------------------------------------------------------------------
- TReconcileCandidate
- --------------------------------------------------------------------}
-
- TReconcileCandidate = Class(TGoogleBaseObject)
- Private
- Fconfidence : integer;
- Flang : String;
- Fmid : String;
- Fname : String;
- Fnotable : TReconcileCandidateTypenotable;
- Protected
- //Property setters
- Procedure Setconfidence(AIndex : Integer; const AValue : integer); virtual;
- Procedure Setlang(AIndex : Integer; const AValue : String); virtual;
- Procedure Setmid(AIndex : Integer; const AValue : String); virtual;
- Procedure Setname(AIndex : Integer; const AValue : String); virtual;
- Procedure Setnotable(AIndex : Integer; const AValue : TReconcileCandidateTypenotable); virtual;
- Public
- Published
- Property confidence : integer Index 0 Read Fconfidence Write Setconfidence;
- Property lang : String Index 8 Read Flang Write Setlang;
- Property mid : String Index 16 Read Fmid Write Setmid;
- Property name : String Index 24 Read Fname Write Setname;
- Property notable : TReconcileCandidateTypenotable Index 32 Read Fnotable Write Setnotable;
- end;
- TReconcileCandidateClass = Class of TReconcileCandidate;
-
- { --------------------------------------------------------------------
- TReconcileGetTypecosts
- --------------------------------------------------------------------}
-
- TReconcileGetTypecosts = Class(TGoogleBaseObject)
- Private
- Fhits : integer;
- Fms : integer;
- Protected
- //Property setters
- Procedure Sethits(AIndex : Integer; const AValue : integer); virtual;
- Procedure Setms(AIndex : Integer; const AValue : integer); virtual;
- Public
- Published
- Property hits : integer Index 0 Read Fhits Write Sethits;
- Property ms : integer Index 8 Read Fms Write Setms;
- end;
- TReconcileGetTypecostsClass = Class of TReconcileGetTypecosts;
-
- { --------------------------------------------------------------------
- TReconcileGetTypewarningItem
- --------------------------------------------------------------------}
-
- TReconcileGetTypewarningItem = Class(TGoogleBaseObject)
- Private
- Flocation : String;
- Fmessage : String;
- Freason : String;
- Protected
- //Property setters
- Procedure Setlocation(AIndex : Integer; const AValue : String); virtual;
- Procedure Setmessage(AIndex : Integer; const AValue : String); virtual;
- Procedure Setreason(AIndex : Integer; const AValue : String); virtual;
- Public
- Published
- Property location : String Index 0 Read Flocation Write Setlocation;
- Property message : String Index 8 Read Fmessage Write Setmessage;
- Property reason : String Index 16 Read Freason Write Setreason;
- end;
- TReconcileGetTypewarningItemClass = Class of TReconcileGetTypewarningItem;
-
- { --------------------------------------------------------------------
- TReconcileGet
- --------------------------------------------------------------------}
-
- TReconcileGet = Class(TGoogleBaseObject)
- Private
- Fcandidate : TReconcileGetTypecandidateArray;
- Fcosts : TReconcileGetTypecosts;
- Fmatch : TReconcileCandidate;
- Fwarning : TReconcileGetTypewarningArray;
- Protected
- //Property setters
- Procedure Setcandidate(AIndex : Integer; const AValue : TReconcileGetTypecandidateArray); virtual;
- Procedure Setcosts(AIndex : Integer; const AValue : TReconcileGetTypecosts); virtual;
- Procedure Setmatch(AIndex : Integer; const AValue : TReconcileCandidate); virtual;
- Procedure Setwarning(AIndex : Integer; const AValue : TReconcileGetTypewarningArray); virtual;
- //2.6.4. bug workaround
- {$IFDEF VER2_6}
- Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
- {$ENDIF VER2_6}
- Public
- Published
- Property candidate : TReconcileGetTypecandidateArray Index 0 Read Fcandidate Write Setcandidate;
- Property costs : TReconcileGetTypecosts Index 8 Read Fcosts Write Setcosts;
- Property match : TReconcileCandidate Index 16 Read Fmatch Write Setmatch;
- Property warning : TReconcileGetTypewarningArray Index 24 Read Fwarning Write Setwarning;
- end;
- TReconcileGetClass = Class of TReconcileGet;
-
- { --------------------------------------------------------------------
- TFreebaseAPI
- --------------------------------------------------------------------}
-
- TFreebaseAPI = Class(TGoogleAPI)
- Private
- 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
- //Add default on-demand instances for resources
- end;
- implementation
- { --------------------------------------------------------------------
- TReconcileCandidateTypenotable
- --------------------------------------------------------------------}
- Procedure TReconcileCandidateTypenotable.Setid(AIndex : Integer; const AValue : String);
- begin
- If (Fid=AValue) then exit;
- Fid:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TReconcileCandidateTypenotable.Setname(AIndex : Integer; const AValue : String);
- begin
- If (Fname=AValue) then exit;
- Fname:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- { --------------------------------------------------------------------
- TReconcileCandidate
- --------------------------------------------------------------------}
- Procedure TReconcileCandidate.Setconfidence(AIndex : Integer; const AValue : integer);
- begin
- If (Fconfidence=AValue) then exit;
- Fconfidence:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TReconcileCandidate.Setlang(AIndex : Integer; const AValue : String);
- begin
- If (Flang=AValue) then exit;
- Flang:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TReconcileCandidate.Setmid(AIndex : Integer; const AValue : String);
- begin
- If (Fmid=AValue) then exit;
- Fmid:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TReconcileCandidate.Setname(AIndex : Integer; const AValue : String);
- begin
- If (Fname=AValue) then exit;
- Fname:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TReconcileCandidate.Setnotable(AIndex : Integer; const AValue : TReconcileCandidateTypenotable);
- begin
- If (Fnotable=AValue) then exit;
- Fnotable:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- { --------------------------------------------------------------------
- TReconcileGetTypecosts
- --------------------------------------------------------------------}
- Procedure TReconcileGetTypecosts.Sethits(AIndex : Integer; const AValue : integer);
- begin
- If (Fhits=AValue) then exit;
- Fhits:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TReconcileGetTypecosts.Setms(AIndex : Integer; const AValue : integer);
- begin
- If (Fms=AValue) then exit;
- Fms:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- { --------------------------------------------------------------------
- TReconcileGetTypewarningItem
- --------------------------------------------------------------------}
- Procedure TReconcileGetTypewarningItem.Setlocation(AIndex : Integer; const AValue : String);
- begin
- If (Flocation=AValue) then exit;
- Flocation:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TReconcileGetTypewarningItem.Setmessage(AIndex : Integer; const AValue : String);
- begin
- If (Fmessage=AValue) then exit;
- Fmessage:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TReconcileGetTypewarningItem.Setreason(AIndex : Integer; const AValue : String);
- begin
- If (Freason=AValue) then exit;
- Freason:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- { --------------------------------------------------------------------
- TReconcileGet
- --------------------------------------------------------------------}
- Procedure TReconcileGet.Setcandidate(AIndex : Integer; const AValue : TReconcileGetTypecandidateArray);
- begin
- If (Fcandidate=AValue) then exit;
- Fcandidate:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TReconcileGet.Setcosts(AIndex : Integer; const AValue : TReconcileGetTypecosts);
- begin
- If (Fcosts=AValue) then exit;
- Fcosts:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TReconcileGet.Setmatch(AIndex : Integer; const AValue : TReconcileCandidate);
- begin
- If (Fmatch=AValue) then exit;
- Fmatch:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TReconcileGet.Setwarning(AIndex : Integer; const AValue : TReconcileGetTypewarningArray);
- begin
- If (Fwarning=AValue) then exit;
- Fwarning:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- //2.6.4. bug workaround
- {$IFDEF VER2_6}
- Procedure TReconcileGet.SetArrayLength(Const AName : String; ALength : Longint);
- begin
- Case AName of
- 'candidate' : SetLength(Fcandidate,ALength);
- 'warning' : SetLength(Fwarning,ALength);
- else
- Inherited SetArrayLength(AName,ALength);
- end;
- end;
- {$ENDIF VER2_6}
- { --------------------------------------------------------------------
- TFreebaseAPI
- --------------------------------------------------------------------}
- Class Function TFreebaseAPI.APIName : String;
- begin
- Result:='freebase';
- end;
- Class Function TFreebaseAPI.APIVersion : String;
- begin
- Result:='v1';
- end;
- Class Function TFreebaseAPI.APIRevision : String;
- begin
- Result:='20150728';
- end;
- Class Function TFreebaseAPI.APIID : String;
- begin
- Result:='freebase:v1';
- end;
- Class Function TFreebaseAPI.APITitle : String;
- begin
- Result:='Freebase Search';
- end;
- Class Function TFreebaseAPI.APIDescription : String;
- begin
- Result:='Find Freebase entities using textual queries and other constraints.';
- end;
- Class Function TFreebaseAPI.APIOwnerDomain : String;
- begin
- Result:='google.com';
- end;
- Class Function TFreebaseAPI.APIOwnerName : String;
- begin
- Result:='Google';
- end;
- Class Function TFreebaseAPI.APIIcon16 : String;
- begin
- Result:='https://www.google.com/images/icons/product/freebase-16.png';
- end;
- Class Function TFreebaseAPI.APIIcon32 : String;
- begin
- Result:='https://www.google.com/images/icons/product/freebase-32.png';
- end;
- Class Function TFreebaseAPI.APIdocumentationLink : String;
- begin
- Result:='https://developers.google.com/freebase/';
- end;
- Class Function TFreebaseAPI.APIrootUrl : string;
- begin
- Result:='https://www.googleapis.com/';
- end;
- Class Function TFreebaseAPI.APIbasePath : string;
- begin
- Result:='/freebase/v1/';
- end;
- Class Function TFreebaseAPI.APIbaseURL : String;
- begin
- Result:='https://www.googleapis.com/freebase/v1/';
- end;
- Class Function TFreebaseAPI.APIProtocol : string;
- begin
- Result:='rest';
- end;
- Class Function TFreebaseAPI.APIservicePath : string;
- begin
- Result:='freebase/v1/';
- end;
- Class Function TFreebaseAPI.APIbatchPath : String;
- begin
- Result:='batch';
- end;
- Class Function TFreebaseAPI.APIAuthScopes : TScopeInfoArray;
- begin
- SetLength(Result,0);
-
- end;
- Class Function TFreebaseAPI.APINeedsAuth : Boolean;
- begin
- Result:=False;
- end;
- Class Procedure TFreebaseAPI.RegisterAPIResources;
- begin
- TReconcileCandidateTypenotable.RegisterObject;
- TReconcileCandidate.RegisterObject;
- TReconcileGetTypecosts.RegisterObject;
- TReconcileGetTypewarningItem.RegisterObject;
- TReconcileGet.RegisterObject;
- end;
- initialization
- TFreebaseAPI.RegisterAPI;
- end.
|