googlecivicinfo.pp 85 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957
  1. unit googlecivicinfo;
  2. {$MODE objfpc}
  3. {$H+}
  4. interface
  5. uses sysutils, classes, googleservice, restbase, googlebase;
  6. type
  7. //Top-level schema types
  8. TAdministrationRegion = Class;
  9. TAdministrativeBody = Class;
  10. TCandidate = Class;
  11. TChannel = Class;
  12. TContest = Class;
  13. TDivisionSearchResponse = Class;
  14. TDivisionSearchResult = Class;
  15. TElection = Class;
  16. TElectionOfficial = Class;
  17. TElectionsQueryResponse = Class;
  18. TElectoralDistrict = Class;
  19. TGeographicDivision = Class;
  20. TOffice = Class;
  21. TOfficial = Class;
  22. TPollingLocation = Class;
  23. TRepresentativeInfoData = Class;
  24. TRepresentativeInfoResponse = Class;
  25. TSimpleAddressType = Class;
  26. TSource = Class;
  27. TVoterInfoResponse = Class;
  28. TAdministrationRegionArray = Array of TAdministrationRegion;
  29. TAdministrativeBodyArray = Array of TAdministrativeBody;
  30. TCandidateArray = Array of TCandidate;
  31. TChannelArray = Array of TChannel;
  32. TContestArray = Array of TContest;
  33. TDivisionSearchResponseArray = Array of TDivisionSearchResponse;
  34. TDivisionSearchResultArray = Array of TDivisionSearchResult;
  35. TElectionArray = Array of TElection;
  36. TElectionOfficialArray = Array of TElectionOfficial;
  37. TElectionsQueryResponseArray = Array of TElectionsQueryResponse;
  38. TElectoralDistrictArray = Array of TElectoralDistrict;
  39. TGeographicDivisionArray = Array of TGeographicDivision;
  40. TOfficeArray = Array of TOffice;
  41. TOfficialArray = Array of TOfficial;
  42. TPollingLocationArray = Array of TPollingLocation;
  43. TRepresentativeInfoDataArray = Array of TRepresentativeInfoData;
  44. TRepresentativeInfoResponseArray = Array of TRepresentativeInfoResponse;
  45. TSimpleAddressTypeArray = Array of TSimpleAddressType;
  46. TSourceArray = Array of TSource;
  47. TVoterInfoResponseArray = Array of TVoterInfoResponse;
  48. //Anonymous types, using auto-generated names
  49. TRepresentativeInfoDataTypedivisions = Class;
  50. TRepresentativeInfoResponseTypedivisions = Class;
  51. TAdministrationRegionTypesourcesArray = Array of TSource;
  52. TAdministrativeBodyTypeelectionOfficialsArray = Array of TElectionOfficial;
  53. TCandidateTypechannelsArray = Array of TChannel;
  54. TContestTypecandidatesArray = Array of TCandidate;
  55. TContestTypesourcesArray = Array of TSource;
  56. TDivisionSearchResponseTyperesultsArray = Array of TDivisionSearchResult;
  57. TElectionsQueryResponseTypeelectionsArray = Array of TElection;
  58. TOfficeTypesourcesArray = Array of TSource;
  59. TOfficialTypeaddressArray = Array of TSimpleAddressType;
  60. TOfficialTypechannelsArray = Array of TChannel;
  61. TPollingLocationTypesourcesArray = Array of TSource;
  62. TRepresentativeInfoDataTypeofficesArray = Array of TOffice;
  63. TRepresentativeInfoDataTypeofficialsArray = Array of TOfficial;
  64. TRepresentativeInfoResponseTypeofficesArray = Array of TOffice;
  65. TRepresentativeInfoResponseTypeofficialsArray = Array of TOfficial;
  66. TVoterInfoResponseTypecontestsArray = Array of TContest;
  67. TVoterInfoResponseTypedropOffLocationsArray = Array of TPollingLocation;
  68. TVoterInfoResponseTypeearlyVoteSitesArray = Array of TPollingLocation;
  69. TVoterInfoResponseTypeotherElectionsArray = Array of TElection;
  70. TVoterInfoResponseTypepollingLocationsArray = Array of TPollingLocation;
  71. TVoterInfoResponseTypestateArray = Array of TAdministrationRegion;
  72. { --------------------------------------------------------------------
  73. TAdministrationRegion
  74. --------------------------------------------------------------------}
  75. TAdministrationRegion = Class(TGoogleBaseObject)
  76. Private
  77. FelectionAdministrationBody : TAdministrativeBody;
  78. Fid : String;
  79. Flocal_jurisdiction : TAdministrationRegion;
  80. Fname : String;
  81. Fsources : TAdministrationRegionTypesourcesArray;
  82. Protected
  83. //Property setters
  84. Procedure SetelectionAdministrationBody(AIndex : Integer; const AValue : TAdministrativeBody); virtual;
  85. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  86. Procedure Setlocal_jurisdiction(AIndex : Integer; const AValue : TAdministrationRegion); virtual;
  87. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  88. Procedure Setsources(AIndex : Integer; const AValue : TAdministrationRegionTypesourcesArray); virtual;
  89. //2.6.4. bug workaround
  90. {$IFDEF VER2_6}
  91. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  92. {$ENDIF VER2_6}
  93. Public
  94. Published
  95. Property electionAdministrationBody : TAdministrativeBody Index 0 Read FelectionAdministrationBody Write SetelectionAdministrationBody;
  96. Property id : String Index 8 Read Fid Write Setid;
  97. Property local_jurisdiction : TAdministrationRegion Index 16 Read Flocal_jurisdiction Write Setlocal_jurisdiction;
  98. Property name : String Index 24 Read Fname Write Setname;
  99. Property sources : TAdministrationRegionTypesourcesArray Index 32 Read Fsources Write Setsources;
  100. end;
  101. TAdministrationRegionClass = Class of TAdministrationRegion;
  102. { --------------------------------------------------------------------
  103. TAdministrativeBody
  104. --------------------------------------------------------------------}
  105. TAdministrativeBody = Class(TGoogleBaseObject)
  106. Private
  107. FabsenteeVotingInfoUrl : String;
  108. FballotInfoUrl : String;
  109. FcorrespondenceAddress : TSimpleAddressType;
  110. FelectionInfoUrl : String;
  111. FelectionOfficials : TAdministrativeBodyTypeelectionOfficialsArray;
  112. FelectionRegistrationConfirmationUrl : String;
  113. FelectionRegistrationUrl : String;
  114. FelectionRulesUrl : String;
  115. FhoursOfOperation : String;
  116. Fname : String;
  117. FphysicalAddress : TSimpleAddressType;
  118. Fvoter_services : TStringArray;
  119. FvotingLocationFinderUrl : String;
  120. Protected
  121. //Property setters
  122. Procedure SetabsenteeVotingInfoUrl(AIndex : Integer; const AValue : String); virtual;
  123. Procedure SetballotInfoUrl(AIndex : Integer; const AValue : String); virtual;
  124. Procedure SetcorrespondenceAddress(AIndex : Integer; const AValue : TSimpleAddressType); virtual;
  125. Procedure SetelectionInfoUrl(AIndex : Integer; const AValue : String); virtual;
  126. Procedure SetelectionOfficials(AIndex : Integer; const AValue : TAdministrativeBodyTypeelectionOfficialsArray); virtual;
  127. Procedure SetelectionRegistrationConfirmationUrl(AIndex : Integer; const AValue : String); virtual;
  128. Procedure SetelectionRegistrationUrl(AIndex : Integer; const AValue : String); virtual;
  129. Procedure SetelectionRulesUrl(AIndex : Integer; const AValue : String); virtual;
  130. Procedure SethoursOfOperation(AIndex : Integer; const AValue : String); virtual;
  131. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  132. Procedure SetphysicalAddress(AIndex : Integer; const AValue : TSimpleAddressType); virtual;
  133. Procedure Setvoter_services(AIndex : Integer; const AValue : TStringArray); virtual;
  134. Procedure SetvotingLocationFinderUrl(AIndex : Integer; const AValue : String); virtual;
  135. //2.6.4. bug workaround
  136. {$IFDEF VER2_6}
  137. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  138. {$ENDIF VER2_6}
  139. Public
  140. Published
  141. Property absenteeVotingInfoUrl : String Index 0 Read FabsenteeVotingInfoUrl Write SetabsenteeVotingInfoUrl;
  142. Property ballotInfoUrl : String Index 8 Read FballotInfoUrl Write SetballotInfoUrl;
  143. Property correspondenceAddress : TSimpleAddressType Index 16 Read FcorrespondenceAddress Write SetcorrespondenceAddress;
  144. Property electionInfoUrl : String Index 24 Read FelectionInfoUrl Write SetelectionInfoUrl;
  145. Property electionOfficials : TAdministrativeBodyTypeelectionOfficialsArray Index 32 Read FelectionOfficials Write SetelectionOfficials;
  146. Property electionRegistrationConfirmationUrl : String Index 40 Read FelectionRegistrationConfirmationUrl Write SetelectionRegistrationConfirmationUrl;
  147. Property electionRegistrationUrl : String Index 48 Read FelectionRegistrationUrl Write SetelectionRegistrationUrl;
  148. Property electionRulesUrl : String Index 56 Read FelectionRulesUrl Write SetelectionRulesUrl;
  149. Property hoursOfOperation : String Index 64 Read FhoursOfOperation Write SethoursOfOperation;
  150. Property name : String Index 72 Read Fname Write Setname;
  151. Property physicalAddress : TSimpleAddressType Index 80 Read FphysicalAddress Write SetphysicalAddress;
  152. Property voter_services : TStringArray Index 88 Read Fvoter_services Write Setvoter_services;
  153. Property votingLocationFinderUrl : String Index 96 Read FvotingLocationFinderUrl Write SetvotingLocationFinderUrl;
  154. end;
  155. TAdministrativeBodyClass = Class of TAdministrativeBody;
  156. { --------------------------------------------------------------------
  157. TCandidate
  158. --------------------------------------------------------------------}
  159. TCandidate = Class(TGoogleBaseObject)
  160. Private
  161. FcandidateUrl : String;
  162. Fchannels : TCandidateTypechannelsArray;
  163. Femail : String;
  164. Fname : String;
  165. ForderOnBallot : String;
  166. Fparty : String;
  167. Fphone : String;
  168. FphotoUrl : String;
  169. Protected
  170. //Property setters
  171. Procedure SetcandidateUrl(AIndex : Integer; const AValue : String); virtual;
  172. Procedure Setchannels(AIndex : Integer; const AValue : TCandidateTypechannelsArray); virtual;
  173. Procedure Setemail(AIndex : Integer; const AValue : String); virtual;
  174. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  175. Procedure SetorderOnBallot(AIndex : Integer; const AValue : String); virtual;
  176. Procedure Setparty(AIndex : Integer; const AValue : String); virtual;
  177. Procedure Setphone(AIndex : Integer; const AValue : String); virtual;
  178. Procedure SetphotoUrl(AIndex : Integer; const AValue : String); virtual;
  179. //2.6.4. bug workaround
  180. {$IFDEF VER2_6}
  181. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  182. {$ENDIF VER2_6}
  183. Public
  184. Published
  185. Property candidateUrl : String Index 0 Read FcandidateUrl Write SetcandidateUrl;
  186. Property channels : TCandidateTypechannelsArray Index 8 Read Fchannels Write Setchannels;
  187. Property email : String Index 16 Read Femail Write Setemail;
  188. Property name : String Index 24 Read Fname Write Setname;
  189. Property orderOnBallot : String Index 32 Read ForderOnBallot Write SetorderOnBallot;
  190. Property party : String Index 40 Read Fparty Write Setparty;
  191. Property phone : String Index 48 Read Fphone Write Setphone;
  192. Property photoUrl : String Index 56 Read FphotoUrl Write SetphotoUrl;
  193. end;
  194. TCandidateClass = Class of TCandidate;
  195. { --------------------------------------------------------------------
  196. TChannel
  197. --------------------------------------------------------------------}
  198. TChannel = Class(TGoogleBaseObject)
  199. Private
  200. Fid : String;
  201. F_type : String;
  202. Protected
  203. Class Function ExportPropertyName(Const AName : String) : string; override;
  204. //Property setters
  205. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  206. Procedure Set_type(AIndex : Integer; const AValue : String); virtual;
  207. Public
  208. Published
  209. Property id : String Index 0 Read Fid Write Setid;
  210. Property _type : String Index 8 Read F_type Write Set_type;
  211. end;
  212. TChannelClass = Class of TChannel;
  213. { --------------------------------------------------------------------
  214. TContest
  215. --------------------------------------------------------------------}
  216. TContest = Class(TGoogleBaseObject)
  217. Private
  218. FballotPlacement : String;
  219. Fcandidates : TContestTypecandidatesArray;
  220. Fdistrict : TElectoralDistrict;
  221. FelectorateSpecifications : String;
  222. Fid : String;
  223. Flevel : TStringArray;
  224. FnumberElected : String;
  225. FnumberVotingFor : String;
  226. Foffice : String;
  227. FprimaryParty : String;
  228. FreferendumBallotResponses : TStringArray;
  229. FreferendumBrief : String;
  230. FreferendumConStatement : String;
  231. FreferendumEffectOfAbstain : String;
  232. FreferendumPassageThreshold : String;
  233. FreferendumProStatement : String;
  234. FreferendumSubtitle : String;
  235. FreferendumText : String;
  236. FreferendumTitle : String;
  237. FreferendumUrl : String;
  238. Froles : TStringArray;
  239. Fsources : TContestTypesourcesArray;
  240. Fspecial : String;
  241. F_type : String;
  242. Protected
  243. Class Function ExportPropertyName(Const AName : String) : string; override;
  244. //Property setters
  245. Procedure SetballotPlacement(AIndex : Integer; const AValue : String); virtual;
  246. Procedure Setcandidates(AIndex : Integer; const AValue : TContestTypecandidatesArray); virtual;
  247. Procedure Setdistrict(AIndex : Integer; const AValue : TElectoralDistrict); virtual;
  248. Procedure SetelectorateSpecifications(AIndex : Integer; const AValue : String); virtual;
  249. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  250. Procedure Setlevel(AIndex : Integer; const AValue : TStringArray); virtual;
  251. Procedure SetnumberElected(AIndex : Integer; const AValue : String); virtual;
  252. Procedure SetnumberVotingFor(AIndex : Integer; const AValue : String); virtual;
  253. Procedure Setoffice(AIndex : Integer; const AValue : String); virtual;
  254. Procedure SetprimaryParty(AIndex : Integer; const AValue : String); virtual;
  255. Procedure SetreferendumBallotResponses(AIndex : Integer; const AValue : TStringArray); virtual;
  256. Procedure SetreferendumBrief(AIndex : Integer; const AValue : String); virtual;
  257. Procedure SetreferendumConStatement(AIndex : Integer; const AValue : String); virtual;
  258. Procedure SetreferendumEffectOfAbstain(AIndex : Integer; const AValue : String); virtual;
  259. Procedure SetreferendumPassageThreshold(AIndex : Integer; const AValue : String); virtual;
  260. Procedure SetreferendumProStatement(AIndex : Integer; const AValue : String); virtual;
  261. Procedure SetreferendumSubtitle(AIndex : Integer; const AValue : String); virtual;
  262. Procedure SetreferendumText(AIndex : Integer; const AValue : String); virtual;
  263. Procedure SetreferendumTitle(AIndex : Integer; const AValue : String); virtual;
  264. Procedure SetreferendumUrl(AIndex : Integer; const AValue : String); virtual;
  265. Procedure Setroles(AIndex : Integer; const AValue : TStringArray); virtual;
  266. Procedure Setsources(AIndex : Integer; const AValue : TContestTypesourcesArray); virtual;
  267. Procedure Setspecial(AIndex : Integer; const AValue : String); virtual;
  268. Procedure Set_type(AIndex : Integer; const AValue : String); virtual;
  269. //2.6.4. bug workaround
  270. {$IFDEF VER2_6}
  271. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  272. {$ENDIF VER2_6}
  273. Public
  274. Published
  275. Property ballotPlacement : String Index 0 Read FballotPlacement Write SetballotPlacement;
  276. Property candidates : TContestTypecandidatesArray Index 8 Read Fcandidates Write Setcandidates;
  277. Property district : TElectoralDistrict Index 16 Read Fdistrict Write Setdistrict;
  278. Property electorateSpecifications : String Index 24 Read FelectorateSpecifications Write SetelectorateSpecifications;
  279. Property id : String Index 32 Read Fid Write Setid;
  280. Property level : TStringArray Index 40 Read Flevel Write Setlevel;
  281. Property numberElected : String Index 48 Read FnumberElected Write SetnumberElected;
  282. Property numberVotingFor : String Index 56 Read FnumberVotingFor Write SetnumberVotingFor;
  283. Property office : String Index 64 Read Foffice Write Setoffice;
  284. Property primaryParty : String Index 72 Read FprimaryParty Write SetprimaryParty;
  285. Property referendumBallotResponses : TStringArray Index 80 Read FreferendumBallotResponses Write SetreferendumBallotResponses;
  286. Property referendumBrief : String Index 88 Read FreferendumBrief Write SetreferendumBrief;
  287. Property referendumConStatement : String Index 96 Read FreferendumConStatement Write SetreferendumConStatement;
  288. Property referendumEffectOfAbstain : String Index 104 Read FreferendumEffectOfAbstain Write SetreferendumEffectOfAbstain;
  289. Property referendumPassageThreshold : String Index 112 Read FreferendumPassageThreshold Write SetreferendumPassageThreshold;
  290. Property referendumProStatement : String Index 120 Read FreferendumProStatement Write SetreferendumProStatement;
  291. Property referendumSubtitle : String Index 128 Read FreferendumSubtitle Write SetreferendumSubtitle;
  292. Property referendumText : String Index 136 Read FreferendumText Write SetreferendumText;
  293. Property referendumTitle : String Index 144 Read FreferendumTitle Write SetreferendumTitle;
  294. Property referendumUrl : String Index 152 Read FreferendumUrl Write SetreferendumUrl;
  295. Property roles : TStringArray Index 160 Read Froles Write Setroles;
  296. Property sources : TContestTypesourcesArray Index 168 Read Fsources Write Setsources;
  297. Property special : String Index 176 Read Fspecial Write Setspecial;
  298. Property _type : String Index 184 Read F_type Write Set_type;
  299. end;
  300. TContestClass = Class of TContest;
  301. { --------------------------------------------------------------------
  302. TDivisionSearchResponse
  303. --------------------------------------------------------------------}
  304. TDivisionSearchResponse = Class(TGoogleBaseObject)
  305. Private
  306. Fkind : String;
  307. Fresults : TDivisionSearchResponseTyperesultsArray;
  308. Protected
  309. //Property setters
  310. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  311. Procedure Setresults(AIndex : Integer; const AValue : TDivisionSearchResponseTyperesultsArray); virtual;
  312. //2.6.4. bug workaround
  313. {$IFDEF VER2_6}
  314. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  315. {$ENDIF VER2_6}
  316. Public
  317. Published
  318. Property kind : String Index 0 Read Fkind Write Setkind;
  319. Property results : TDivisionSearchResponseTyperesultsArray Index 8 Read Fresults Write Setresults;
  320. end;
  321. TDivisionSearchResponseClass = Class of TDivisionSearchResponse;
  322. { --------------------------------------------------------------------
  323. TDivisionSearchResult
  324. --------------------------------------------------------------------}
  325. TDivisionSearchResult = Class(TGoogleBaseObject)
  326. Private
  327. Faliases : TStringArray;
  328. Fname : String;
  329. FocdId : String;
  330. Protected
  331. //Property setters
  332. Procedure Setaliases(AIndex : Integer; const AValue : TStringArray); virtual;
  333. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  334. Procedure SetocdId(AIndex : Integer; const AValue : String); virtual;
  335. //2.6.4. bug workaround
  336. {$IFDEF VER2_6}
  337. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  338. {$ENDIF VER2_6}
  339. Public
  340. Published
  341. Property aliases : TStringArray Index 0 Read Faliases Write Setaliases;
  342. Property name : String Index 8 Read Fname Write Setname;
  343. Property ocdId : String Index 16 Read FocdId Write SetocdId;
  344. end;
  345. TDivisionSearchResultClass = Class of TDivisionSearchResult;
  346. { --------------------------------------------------------------------
  347. TElection
  348. --------------------------------------------------------------------}
  349. TElection = Class(TGoogleBaseObject)
  350. Private
  351. FelectionDay : String;
  352. Fid : String;
  353. Fname : String;
  354. FocdDivisionId : String;
  355. Protected
  356. //Property setters
  357. Procedure SetelectionDay(AIndex : Integer; const AValue : String); virtual;
  358. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  359. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  360. Procedure SetocdDivisionId(AIndex : Integer; const AValue : String); virtual;
  361. Public
  362. Published
  363. Property electionDay : String Index 0 Read FelectionDay Write SetelectionDay;
  364. Property id : String Index 8 Read Fid Write Setid;
  365. Property name : String Index 16 Read Fname Write Setname;
  366. Property ocdDivisionId : String Index 24 Read FocdDivisionId Write SetocdDivisionId;
  367. end;
  368. TElectionClass = Class of TElection;
  369. { --------------------------------------------------------------------
  370. TElectionOfficial
  371. --------------------------------------------------------------------}
  372. TElectionOfficial = Class(TGoogleBaseObject)
  373. Private
  374. FemailAddress : String;
  375. FfaxNumber : String;
  376. Fname : String;
  377. FofficePhoneNumber : String;
  378. Ftitle : String;
  379. Protected
  380. //Property setters
  381. Procedure SetemailAddress(AIndex : Integer; const AValue : String); virtual;
  382. Procedure SetfaxNumber(AIndex : Integer; const AValue : String); virtual;
  383. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  384. Procedure SetofficePhoneNumber(AIndex : Integer; const AValue : String); virtual;
  385. Procedure Settitle(AIndex : Integer; const AValue : String); virtual;
  386. Public
  387. Published
  388. Property emailAddress : String Index 0 Read FemailAddress Write SetemailAddress;
  389. Property faxNumber : String Index 8 Read FfaxNumber Write SetfaxNumber;
  390. Property name : String Index 16 Read Fname Write Setname;
  391. Property officePhoneNumber : String Index 24 Read FofficePhoneNumber Write SetofficePhoneNumber;
  392. Property title : String Index 32 Read Ftitle Write Settitle;
  393. end;
  394. TElectionOfficialClass = Class of TElectionOfficial;
  395. { --------------------------------------------------------------------
  396. TElectionsQueryResponse
  397. --------------------------------------------------------------------}
  398. TElectionsQueryResponse = Class(TGoogleBaseObject)
  399. Private
  400. Felections : TElectionsQueryResponseTypeelectionsArray;
  401. Fkind : String;
  402. Protected
  403. //Property setters
  404. Procedure Setelections(AIndex : Integer; const AValue : TElectionsQueryResponseTypeelectionsArray); virtual;
  405. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  406. //2.6.4. bug workaround
  407. {$IFDEF VER2_6}
  408. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  409. {$ENDIF VER2_6}
  410. Public
  411. Published
  412. Property elections : TElectionsQueryResponseTypeelectionsArray Index 0 Read Felections Write Setelections;
  413. Property kind : String Index 8 Read Fkind Write Setkind;
  414. end;
  415. TElectionsQueryResponseClass = Class of TElectionsQueryResponse;
  416. { --------------------------------------------------------------------
  417. TElectoralDistrict
  418. --------------------------------------------------------------------}
  419. TElectoralDistrict = Class(TGoogleBaseObject)
  420. Private
  421. Fid : String;
  422. Fname : String;
  423. Fscope : String;
  424. Protected
  425. //Property setters
  426. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  427. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  428. Procedure Setscope(AIndex : Integer; const AValue : String); virtual;
  429. Public
  430. Published
  431. Property id : String Index 0 Read Fid Write Setid;
  432. Property name : String Index 8 Read Fname Write Setname;
  433. Property scope : String Index 16 Read Fscope Write Setscope;
  434. end;
  435. TElectoralDistrictClass = Class of TElectoralDistrict;
  436. { --------------------------------------------------------------------
  437. TGeographicDivision
  438. --------------------------------------------------------------------}
  439. TGeographicDivision = Class(TGoogleBaseObject)
  440. Private
  441. FalsoKnownAs : TStringArray;
  442. Fname : String;
  443. FofficeIndices : TintegerArray;
  444. Protected
  445. //Property setters
  446. Procedure SetalsoKnownAs(AIndex : Integer; const AValue : TStringArray); virtual;
  447. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  448. Procedure SetofficeIndices(AIndex : Integer; const AValue : TintegerArray); virtual;
  449. //2.6.4. bug workaround
  450. {$IFDEF VER2_6}
  451. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  452. {$ENDIF VER2_6}
  453. Public
  454. Published
  455. Property alsoKnownAs : TStringArray Index 0 Read FalsoKnownAs Write SetalsoKnownAs;
  456. Property name : String Index 8 Read Fname Write Setname;
  457. Property officeIndices : TintegerArray Index 16 Read FofficeIndices Write SetofficeIndices;
  458. end;
  459. TGeographicDivisionClass = Class of TGeographicDivision;
  460. { --------------------------------------------------------------------
  461. TOffice
  462. --------------------------------------------------------------------}
  463. TOffice = Class(TGoogleBaseObject)
  464. Private
  465. FdivisionId : String;
  466. Flevels : TStringArray;
  467. Fname : String;
  468. FofficialIndices : TintegerArray;
  469. Froles : TStringArray;
  470. Fsources : TOfficeTypesourcesArray;
  471. Protected
  472. //Property setters
  473. Procedure SetdivisionId(AIndex : Integer; const AValue : String); virtual;
  474. Procedure Setlevels(AIndex : Integer; const AValue : TStringArray); virtual;
  475. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  476. Procedure SetofficialIndices(AIndex : Integer; const AValue : TintegerArray); virtual;
  477. Procedure Setroles(AIndex : Integer; const AValue : TStringArray); virtual;
  478. Procedure Setsources(AIndex : Integer; const AValue : TOfficeTypesourcesArray); virtual;
  479. //2.6.4. bug workaround
  480. {$IFDEF VER2_6}
  481. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  482. {$ENDIF VER2_6}
  483. Public
  484. Published
  485. Property divisionId : String Index 0 Read FdivisionId Write SetdivisionId;
  486. Property levels : TStringArray Index 8 Read Flevels Write Setlevels;
  487. Property name : String Index 16 Read Fname Write Setname;
  488. Property officialIndices : TintegerArray Index 24 Read FofficialIndices Write SetofficialIndices;
  489. Property roles : TStringArray Index 32 Read Froles Write Setroles;
  490. Property sources : TOfficeTypesourcesArray Index 40 Read Fsources Write Setsources;
  491. end;
  492. TOfficeClass = Class of TOffice;
  493. { --------------------------------------------------------------------
  494. TOfficial
  495. --------------------------------------------------------------------}
  496. TOfficial = Class(TGoogleBaseObject)
  497. Private
  498. Faddress : TOfficialTypeaddressArray;
  499. Fchannels : TOfficialTypechannelsArray;
  500. Femails : TStringArray;
  501. Fname : String;
  502. Fparty : String;
  503. Fphones : TStringArray;
  504. FphotoUrl : String;
  505. Furls : TStringArray;
  506. Protected
  507. //Property setters
  508. Procedure Setaddress(AIndex : Integer; const AValue : TOfficialTypeaddressArray); virtual;
  509. Procedure Setchannels(AIndex : Integer; const AValue : TOfficialTypechannelsArray); virtual;
  510. Procedure Setemails(AIndex : Integer; const AValue : TStringArray); virtual;
  511. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  512. Procedure Setparty(AIndex : Integer; const AValue : String); virtual;
  513. Procedure Setphones(AIndex : Integer; const AValue : TStringArray); virtual;
  514. Procedure SetphotoUrl(AIndex : Integer; const AValue : String); virtual;
  515. Procedure Seturls(AIndex : Integer; const AValue : TStringArray); virtual;
  516. //2.6.4. bug workaround
  517. {$IFDEF VER2_6}
  518. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  519. {$ENDIF VER2_6}
  520. Public
  521. Published
  522. Property address : TOfficialTypeaddressArray Index 0 Read Faddress Write Setaddress;
  523. Property channels : TOfficialTypechannelsArray Index 8 Read Fchannels Write Setchannels;
  524. Property emails : TStringArray Index 16 Read Femails Write Setemails;
  525. Property name : String Index 24 Read Fname Write Setname;
  526. Property party : String Index 32 Read Fparty Write Setparty;
  527. Property phones : TStringArray Index 40 Read Fphones Write Setphones;
  528. Property photoUrl : String Index 48 Read FphotoUrl Write SetphotoUrl;
  529. Property urls : TStringArray Index 56 Read Furls Write Seturls;
  530. end;
  531. TOfficialClass = Class of TOfficial;
  532. { --------------------------------------------------------------------
  533. TPollingLocation
  534. --------------------------------------------------------------------}
  535. TPollingLocation = Class(TGoogleBaseObject)
  536. Private
  537. Faddress : TSimpleAddressType;
  538. FendDate : String;
  539. Fid : String;
  540. Fname : String;
  541. Fnotes : String;
  542. FpollingHours : String;
  543. Fsources : TPollingLocationTypesourcesArray;
  544. FstartDate : String;
  545. FvoterServices : String;
  546. Protected
  547. //Property setters
  548. Procedure Setaddress(AIndex : Integer; const AValue : TSimpleAddressType); virtual;
  549. Procedure SetendDate(AIndex : Integer; const AValue : String); virtual;
  550. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  551. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  552. Procedure Setnotes(AIndex : Integer; const AValue : String); virtual;
  553. Procedure SetpollingHours(AIndex : Integer; const AValue : String); virtual;
  554. Procedure Setsources(AIndex : Integer; const AValue : TPollingLocationTypesourcesArray); virtual;
  555. Procedure SetstartDate(AIndex : Integer; const AValue : String); virtual;
  556. Procedure SetvoterServices(AIndex : Integer; const AValue : String); virtual;
  557. //2.6.4. bug workaround
  558. {$IFDEF VER2_6}
  559. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  560. {$ENDIF VER2_6}
  561. Public
  562. Published
  563. Property address : TSimpleAddressType Index 0 Read Faddress Write Setaddress;
  564. Property endDate : String Index 8 Read FendDate Write SetendDate;
  565. Property id : String Index 16 Read Fid Write Setid;
  566. Property name : String Index 24 Read Fname Write Setname;
  567. Property notes : String Index 32 Read Fnotes Write Setnotes;
  568. Property pollingHours : String Index 40 Read FpollingHours Write SetpollingHours;
  569. Property sources : TPollingLocationTypesourcesArray Index 48 Read Fsources Write Setsources;
  570. Property startDate : String Index 56 Read FstartDate Write SetstartDate;
  571. Property voterServices : String Index 64 Read FvoterServices Write SetvoterServices;
  572. end;
  573. TPollingLocationClass = Class of TPollingLocation;
  574. { --------------------------------------------------------------------
  575. TRepresentativeInfoDataTypedivisions
  576. --------------------------------------------------------------------}
  577. TRepresentativeInfoDataTypedivisions = Class(TGoogleBaseObject)
  578. Private
  579. Protected
  580. //Property setters
  581. Public
  582. Class Function AllowAdditionalProperties : Boolean; override;
  583. Published
  584. end;
  585. TRepresentativeInfoDataTypedivisionsClass = Class of TRepresentativeInfoDataTypedivisions;
  586. { --------------------------------------------------------------------
  587. TRepresentativeInfoData
  588. --------------------------------------------------------------------}
  589. TRepresentativeInfoData = Class(TGoogleBaseObject)
  590. Private
  591. Fdivisions : TRepresentativeInfoDataTypedivisions;
  592. Foffices : TRepresentativeInfoDataTypeofficesArray;
  593. Fofficials : TRepresentativeInfoDataTypeofficialsArray;
  594. Protected
  595. //Property setters
  596. Procedure Setdivisions(AIndex : Integer; const AValue : TRepresentativeInfoDataTypedivisions); virtual;
  597. Procedure Setoffices(AIndex : Integer; const AValue : TRepresentativeInfoDataTypeofficesArray); virtual;
  598. Procedure Setofficials(AIndex : Integer; const AValue : TRepresentativeInfoDataTypeofficialsArray); virtual;
  599. //2.6.4. bug workaround
  600. {$IFDEF VER2_6}
  601. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  602. {$ENDIF VER2_6}
  603. Public
  604. Published
  605. Property divisions : TRepresentativeInfoDataTypedivisions Index 0 Read Fdivisions Write Setdivisions;
  606. Property offices : TRepresentativeInfoDataTypeofficesArray Index 8 Read Foffices Write Setoffices;
  607. Property officials : TRepresentativeInfoDataTypeofficialsArray Index 16 Read Fofficials Write Setofficials;
  608. end;
  609. TRepresentativeInfoDataClass = Class of TRepresentativeInfoData;
  610. { --------------------------------------------------------------------
  611. TRepresentativeInfoResponseTypedivisions
  612. --------------------------------------------------------------------}
  613. TRepresentativeInfoResponseTypedivisions = Class(TGoogleBaseObject)
  614. Private
  615. Protected
  616. //Property setters
  617. Public
  618. Class Function AllowAdditionalProperties : Boolean; override;
  619. Published
  620. end;
  621. TRepresentativeInfoResponseTypedivisionsClass = Class of TRepresentativeInfoResponseTypedivisions;
  622. { --------------------------------------------------------------------
  623. TRepresentativeInfoResponse
  624. --------------------------------------------------------------------}
  625. TRepresentativeInfoResponse = Class(TGoogleBaseObject)
  626. Private
  627. Fdivisions : TRepresentativeInfoResponseTypedivisions;
  628. Fkind : String;
  629. FnormalizedInput : TSimpleAddressType;
  630. Foffices : TRepresentativeInfoResponseTypeofficesArray;
  631. Fofficials : TRepresentativeInfoResponseTypeofficialsArray;
  632. Protected
  633. //Property setters
  634. Procedure Setdivisions(AIndex : Integer; const AValue : TRepresentativeInfoResponseTypedivisions); virtual;
  635. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  636. Procedure SetnormalizedInput(AIndex : Integer; const AValue : TSimpleAddressType); virtual;
  637. Procedure Setoffices(AIndex : Integer; const AValue : TRepresentativeInfoResponseTypeofficesArray); virtual;
  638. Procedure Setofficials(AIndex : Integer; const AValue : TRepresentativeInfoResponseTypeofficialsArray); virtual;
  639. //2.6.4. bug workaround
  640. {$IFDEF VER2_6}
  641. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  642. {$ENDIF VER2_6}
  643. Public
  644. Published
  645. Property divisions : TRepresentativeInfoResponseTypedivisions Index 0 Read Fdivisions Write Setdivisions;
  646. Property kind : String Index 8 Read Fkind Write Setkind;
  647. Property normalizedInput : TSimpleAddressType Index 16 Read FnormalizedInput Write SetnormalizedInput;
  648. Property offices : TRepresentativeInfoResponseTypeofficesArray Index 24 Read Foffices Write Setoffices;
  649. Property officials : TRepresentativeInfoResponseTypeofficialsArray Index 32 Read Fofficials Write Setofficials;
  650. end;
  651. TRepresentativeInfoResponseClass = Class of TRepresentativeInfoResponse;
  652. { --------------------------------------------------------------------
  653. TSimpleAddressType
  654. --------------------------------------------------------------------}
  655. TSimpleAddressType = Class(TGoogleBaseObject)
  656. Private
  657. Fcity : String;
  658. Fline1 : String;
  659. Fline2 : String;
  660. Fline3 : String;
  661. FlocationName : String;
  662. Fstate : String;
  663. Fzip : String;
  664. Protected
  665. //Property setters
  666. Procedure Setcity(AIndex : Integer; const AValue : String); virtual;
  667. Procedure Setline1(AIndex : Integer; const AValue : String); virtual;
  668. Procedure Setline2(AIndex : Integer; const AValue : String); virtual;
  669. Procedure Setline3(AIndex : Integer; const AValue : String); virtual;
  670. Procedure SetlocationName(AIndex : Integer; const AValue : String); virtual;
  671. Procedure Setstate(AIndex : Integer; const AValue : String); virtual;
  672. Procedure Setzip(AIndex : Integer; const AValue : String); virtual;
  673. Public
  674. Published
  675. Property city : String Index 0 Read Fcity Write Setcity;
  676. Property line1 : String Index 8 Read Fline1 Write Setline1;
  677. Property line2 : String Index 16 Read Fline2 Write Setline2;
  678. Property line3 : String Index 24 Read Fline3 Write Setline3;
  679. Property locationName : String Index 32 Read FlocationName Write SetlocationName;
  680. Property state : String Index 40 Read Fstate Write Setstate;
  681. Property zip : String Index 48 Read Fzip Write Setzip;
  682. end;
  683. TSimpleAddressTypeClass = Class of TSimpleAddressType;
  684. { --------------------------------------------------------------------
  685. TSource
  686. --------------------------------------------------------------------}
  687. TSource = Class(TGoogleBaseObject)
  688. Private
  689. Fname : String;
  690. Fofficial : boolean;
  691. Protected
  692. //Property setters
  693. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  694. Procedure Setofficial(AIndex : Integer; const AValue : boolean); virtual;
  695. Public
  696. Published
  697. Property name : String Index 0 Read Fname Write Setname;
  698. Property official : boolean Index 8 Read Fofficial Write Setofficial;
  699. end;
  700. TSourceClass = Class of TSource;
  701. { --------------------------------------------------------------------
  702. TVoterInfoResponse
  703. --------------------------------------------------------------------}
  704. TVoterInfoResponse = Class(TGoogleBaseObject)
  705. Private
  706. Fcontests : TVoterInfoResponseTypecontestsArray;
  707. FdropOffLocations : TVoterInfoResponseTypedropOffLocationsArray;
  708. FearlyVoteSites : TVoterInfoResponseTypeearlyVoteSitesArray;
  709. Felection : TElection;
  710. Fkind : String;
  711. FmailOnly : boolean;
  712. FnormalizedInput : TSimpleAddressType;
  713. FotherElections : TVoterInfoResponseTypeotherElectionsArray;
  714. FpollingLocations : TVoterInfoResponseTypepollingLocationsArray;
  715. FprecinctId : String;
  716. Fstate : TVoterInfoResponseTypestateArray;
  717. Protected
  718. //Property setters
  719. Procedure Setcontests(AIndex : Integer; const AValue : TVoterInfoResponseTypecontestsArray); virtual;
  720. Procedure SetdropOffLocations(AIndex : Integer; const AValue : TVoterInfoResponseTypedropOffLocationsArray); virtual;
  721. Procedure SetearlyVoteSites(AIndex : Integer; const AValue : TVoterInfoResponseTypeearlyVoteSitesArray); virtual;
  722. Procedure Setelection(AIndex : Integer; const AValue : TElection); virtual;
  723. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  724. Procedure SetmailOnly(AIndex : Integer; const AValue : boolean); virtual;
  725. Procedure SetnormalizedInput(AIndex : Integer; const AValue : TSimpleAddressType); virtual;
  726. Procedure SetotherElections(AIndex : Integer; const AValue : TVoterInfoResponseTypeotherElectionsArray); virtual;
  727. Procedure SetpollingLocations(AIndex : Integer; const AValue : TVoterInfoResponseTypepollingLocationsArray); virtual;
  728. Procedure SetprecinctId(AIndex : Integer; const AValue : String); virtual;
  729. Procedure Setstate(AIndex : Integer; const AValue : TVoterInfoResponseTypestateArray); virtual;
  730. //2.6.4. bug workaround
  731. {$IFDEF VER2_6}
  732. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  733. {$ENDIF VER2_6}
  734. Public
  735. Published
  736. Property contests : TVoterInfoResponseTypecontestsArray Index 0 Read Fcontests Write Setcontests;
  737. Property dropOffLocations : TVoterInfoResponseTypedropOffLocationsArray Index 8 Read FdropOffLocations Write SetdropOffLocations;
  738. Property earlyVoteSites : TVoterInfoResponseTypeearlyVoteSitesArray Index 16 Read FearlyVoteSites Write SetearlyVoteSites;
  739. Property election : TElection Index 24 Read Felection Write Setelection;
  740. Property kind : String Index 32 Read Fkind Write Setkind;
  741. Property mailOnly : boolean Index 40 Read FmailOnly Write SetmailOnly;
  742. Property normalizedInput : TSimpleAddressType Index 48 Read FnormalizedInput Write SetnormalizedInput;
  743. Property otherElections : TVoterInfoResponseTypeotherElectionsArray Index 56 Read FotherElections Write SetotherElections;
  744. Property pollingLocations : TVoterInfoResponseTypepollingLocationsArray Index 64 Read FpollingLocations Write SetpollingLocations;
  745. Property precinctId : String Index 72 Read FprecinctId Write SetprecinctId;
  746. Property state : TVoterInfoResponseTypestateArray Index 80 Read Fstate Write Setstate;
  747. end;
  748. TVoterInfoResponseClass = Class of TVoterInfoResponse;
  749. { --------------------------------------------------------------------
  750. TDivisionsResource
  751. --------------------------------------------------------------------}
  752. //Optional query Options for TDivisionsResource, method Search
  753. TDivisionsSearchOptions = Record
  754. query : String;
  755. end;
  756. TDivisionsResource = Class(TGoogleResource)
  757. Public
  758. Class Function ResourceName : String; override;
  759. Class Function DefaultAPI : TGoogleAPIClass; override;
  760. Function Search(AQuery : string = '') : TDivisionSearchResponse;
  761. Function Search(AQuery : TDivisionssearchOptions) : TDivisionSearchResponse;
  762. end;
  763. { --------------------------------------------------------------------
  764. TElectionsResource
  765. --------------------------------------------------------------------}
  766. //Optional query Options for TElectionsResource, method VoterInfoQuery
  767. TElectionsVoterInfoQueryOptions = Record
  768. address : String;
  769. electionId : int64;
  770. officialOnly : boolean;
  771. end;
  772. TElectionsResource = Class(TGoogleResource)
  773. Public
  774. Class Function ResourceName : String; override;
  775. Class Function DefaultAPI : TGoogleAPIClass; override;
  776. Function ElectionQuery : TElectionsQueryResponse;
  777. Function VoterInfoQuery(AQuery : string = '') : TVoterInfoResponse;
  778. Function VoterInfoQuery(AQuery : TElectionsvoterInfoQueryOptions) : TVoterInfoResponse;
  779. end;
  780. { --------------------------------------------------------------------
  781. TRepresentativesResource
  782. --------------------------------------------------------------------}
  783. //Optional query Options for TRepresentativesResource, method RepresentativeInfoByAddress
  784. TRepresentativesRepresentativeInfoByAddressOptions = Record
  785. address : String;
  786. includeOffices : boolean;
  787. levels : String;
  788. roles : String;
  789. end;
  790. //Optional query Options for TRepresentativesResource, method RepresentativeInfoByDivision
  791. TRepresentativesRepresentativeInfoByDivisionOptions = Record
  792. levels : String;
  793. recursive : boolean;
  794. roles : String;
  795. end;
  796. TRepresentativesResource = Class(TGoogleResource)
  797. Public
  798. Class Function ResourceName : String; override;
  799. Class Function DefaultAPI : TGoogleAPIClass; override;
  800. Function RepresentativeInfoByAddress(AQuery : string = '') : TRepresentativeInfoResponse;
  801. Function RepresentativeInfoByAddress(AQuery : TRepresentativesrepresentativeInfoByAddressOptions) : TRepresentativeInfoResponse;
  802. Function RepresentativeInfoByDivision(ocdId: string; AQuery : string = '') : TRepresentativeInfoData;
  803. Function RepresentativeInfoByDivision(ocdId: string; AQuery : TRepresentativesrepresentativeInfoByDivisionOptions) : TRepresentativeInfoData;
  804. end;
  805. { --------------------------------------------------------------------
  806. TCivicinfoAPI
  807. --------------------------------------------------------------------}
  808. TCivicinfoAPI = Class(TGoogleAPI)
  809. Private
  810. FDivisionsInstance : TDivisionsResource;
  811. FElectionsInstance : TElectionsResource;
  812. FRepresentativesInstance : TRepresentativesResource;
  813. Function GetDivisionsInstance : TDivisionsResource;virtual;
  814. Function GetElectionsInstance : TElectionsResource;virtual;
  815. Function GetRepresentativesInstance : TRepresentativesResource;virtual;
  816. Public
  817. //Override class functions with API info
  818. Class Function APIName : String; override;
  819. Class Function APIVersion : String; override;
  820. Class Function APIRevision : String; override;
  821. Class Function APIID : String; override;
  822. Class Function APITitle : String; override;
  823. Class Function APIDescription : String; override;
  824. Class Function APIOwnerDomain : String; override;
  825. Class Function APIOwnerName : String; override;
  826. Class Function APIIcon16 : String; override;
  827. Class Function APIIcon32 : String; override;
  828. Class Function APIdocumentationLink : String; override;
  829. Class Function APIrootUrl : string; override;
  830. Class Function APIbasePath : string;override;
  831. Class Function APIbaseURL : String;override;
  832. Class Function APIProtocol : string;override;
  833. Class Function APIservicePath : string;override;
  834. Class Function APIbatchPath : String;override;
  835. Class Function APIAuthScopes : TScopeInfoArray;override;
  836. Class Function APINeedsAuth : Boolean;override;
  837. Class Procedure RegisterAPIResources; override;
  838. //Add create function for resources
  839. Function CreateDivisionsResource(AOwner : TComponent) : TDivisionsResource;virtual;overload;
  840. Function CreateDivisionsResource : TDivisionsResource;virtual;overload;
  841. Function CreateElectionsResource(AOwner : TComponent) : TElectionsResource;virtual;overload;
  842. Function CreateElectionsResource : TElectionsResource;virtual;overload;
  843. Function CreateRepresentativesResource(AOwner : TComponent) : TRepresentativesResource;virtual;overload;
  844. Function CreateRepresentativesResource : TRepresentativesResource;virtual;overload;
  845. //Add default on-demand instances for resources
  846. Property DivisionsResource : TDivisionsResource Read GetDivisionsInstance;
  847. Property ElectionsResource : TElectionsResource Read GetElectionsInstance;
  848. Property RepresentativesResource : TRepresentativesResource Read GetRepresentativesInstance;
  849. end;
  850. implementation
  851. { --------------------------------------------------------------------
  852. TAdministrationRegion
  853. --------------------------------------------------------------------}
  854. Procedure TAdministrationRegion.SetelectionAdministrationBody(AIndex : Integer; const AValue : TAdministrativeBody);
  855. begin
  856. If (FelectionAdministrationBody=AValue) then exit;
  857. FelectionAdministrationBody:=AValue;
  858. MarkPropertyChanged(AIndex);
  859. end;
  860. Procedure TAdministrationRegion.Setid(AIndex : Integer; const AValue : String);
  861. begin
  862. If (Fid=AValue) then exit;
  863. Fid:=AValue;
  864. MarkPropertyChanged(AIndex);
  865. end;
  866. Procedure TAdministrationRegion.Setlocal_jurisdiction(AIndex : Integer; const AValue : TAdministrationRegion);
  867. begin
  868. If (Flocal_jurisdiction=AValue) then exit;
  869. Flocal_jurisdiction:=AValue;
  870. MarkPropertyChanged(AIndex);
  871. end;
  872. Procedure TAdministrationRegion.Setname(AIndex : Integer; const AValue : String);
  873. begin
  874. If (Fname=AValue) then exit;
  875. Fname:=AValue;
  876. MarkPropertyChanged(AIndex);
  877. end;
  878. Procedure TAdministrationRegion.Setsources(AIndex : Integer; const AValue : TAdministrationRegionTypesourcesArray);
  879. begin
  880. If (Fsources=AValue) then exit;
  881. Fsources:=AValue;
  882. MarkPropertyChanged(AIndex);
  883. end;
  884. //2.6.4. bug workaround
  885. {$IFDEF VER2_6}
  886. Procedure TAdministrationRegion.SetArrayLength(Const AName : String; ALength : Longint);
  887. begin
  888. Case AName of
  889. 'sources' : SetLength(Fsources,ALength);
  890. else
  891. Inherited SetArrayLength(AName,ALength);
  892. end;
  893. end;
  894. {$ENDIF VER2_6}
  895. { --------------------------------------------------------------------
  896. TAdministrativeBody
  897. --------------------------------------------------------------------}
  898. Procedure TAdministrativeBody.SetabsenteeVotingInfoUrl(AIndex : Integer; const AValue : String);
  899. begin
  900. If (FabsenteeVotingInfoUrl=AValue) then exit;
  901. FabsenteeVotingInfoUrl:=AValue;
  902. MarkPropertyChanged(AIndex);
  903. end;
  904. Procedure TAdministrativeBody.SetballotInfoUrl(AIndex : Integer; const AValue : String);
  905. begin
  906. If (FballotInfoUrl=AValue) then exit;
  907. FballotInfoUrl:=AValue;
  908. MarkPropertyChanged(AIndex);
  909. end;
  910. Procedure TAdministrativeBody.SetcorrespondenceAddress(AIndex : Integer; const AValue : TSimpleAddressType);
  911. begin
  912. If (FcorrespondenceAddress=AValue) then exit;
  913. FcorrespondenceAddress:=AValue;
  914. MarkPropertyChanged(AIndex);
  915. end;
  916. Procedure TAdministrativeBody.SetelectionInfoUrl(AIndex : Integer; const AValue : String);
  917. begin
  918. If (FelectionInfoUrl=AValue) then exit;
  919. FelectionInfoUrl:=AValue;
  920. MarkPropertyChanged(AIndex);
  921. end;
  922. Procedure TAdministrativeBody.SetelectionOfficials(AIndex : Integer; const AValue : TAdministrativeBodyTypeelectionOfficialsArray);
  923. begin
  924. If (FelectionOfficials=AValue) then exit;
  925. FelectionOfficials:=AValue;
  926. MarkPropertyChanged(AIndex);
  927. end;
  928. Procedure TAdministrativeBody.SetelectionRegistrationConfirmationUrl(AIndex : Integer; const AValue : String);
  929. begin
  930. If (FelectionRegistrationConfirmationUrl=AValue) then exit;
  931. FelectionRegistrationConfirmationUrl:=AValue;
  932. MarkPropertyChanged(AIndex);
  933. end;
  934. Procedure TAdministrativeBody.SetelectionRegistrationUrl(AIndex : Integer; const AValue : String);
  935. begin
  936. If (FelectionRegistrationUrl=AValue) then exit;
  937. FelectionRegistrationUrl:=AValue;
  938. MarkPropertyChanged(AIndex);
  939. end;
  940. Procedure TAdministrativeBody.SetelectionRulesUrl(AIndex : Integer; const AValue : String);
  941. begin
  942. If (FelectionRulesUrl=AValue) then exit;
  943. FelectionRulesUrl:=AValue;
  944. MarkPropertyChanged(AIndex);
  945. end;
  946. Procedure TAdministrativeBody.SethoursOfOperation(AIndex : Integer; const AValue : String);
  947. begin
  948. If (FhoursOfOperation=AValue) then exit;
  949. FhoursOfOperation:=AValue;
  950. MarkPropertyChanged(AIndex);
  951. end;
  952. Procedure TAdministrativeBody.Setname(AIndex : Integer; const AValue : String);
  953. begin
  954. If (Fname=AValue) then exit;
  955. Fname:=AValue;
  956. MarkPropertyChanged(AIndex);
  957. end;
  958. Procedure TAdministrativeBody.SetphysicalAddress(AIndex : Integer; const AValue : TSimpleAddressType);
  959. begin
  960. If (FphysicalAddress=AValue) then exit;
  961. FphysicalAddress:=AValue;
  962. MarkPropertyChanged(AIndex);
  963. end;
  964. Procedure TAdministrativeBody.Setvoter_services(AIndex : Integer; const AValue : TStringArray);
  965. begin
  966. If (Fvoter_services=AValue) then exit;
  967. Fvoter_services:=AValue;
  968. MarkPropertyChanged(AIndex);
  969. end;
  970. Procedure TAdministrativeBody.SetvotingLocationFinderUrl(AIndex : Integer; const AValue : String);
  971. begin
  972. If (FvotingLocationFinderUrl=AValue) then exit;
  973. FvotingLocationFinderUrl:=AValue;
  974. MarkPropertyChanged(AIndex);
  975. end;
  976. //2.6.4. bug workaround
  977. {$IFDEF VER2_6}
  978. Procedure TAdministrativeBody.SetArrayLength(Const AName : String; ALength : Longint);
  979. begin
  980. Case AName of
  981. 'electionofficials' : SetLength(FelectionOfficials,ALength);
  982. 'voter_services' : SetLength(Fvoter_services,ALength);
  983. else
  984. Inherited SetArrayLength(AName,ALength);
  985. end;
  986. end;
  987. {$ENDIF VER2_6}
  988. { --------------------------------------------------------------------
  989. TCandidate
  990. --------------------------------------------------------------------}
  991. Procedure TCandidate.SetcandidateUrl(AIndex : Integer; const AValue : String);
  992. begin
  993. If (FcandidateUrl=AValue) then exit;
  994. FcandidateUrl:=AValue;
  995. MarkPropertyChanged(AIndex);
  996. end;
  997. Procedure TCandidate.Setchannels(AIndex : Integer; const AValue : TCandidateTypechannelsArray);
  998. begin
  999. If (Fchannels=AValue) then exit;
  1000. Fchannels:=AValue;
  1001. MarkPropertyChanged(AIndex);
  1002. end;
  1003. Procedure TCandidate.Setemail(AIndex : Integer; const AValue : String);
  1004. begin
  1005. If (Femail=AValue) then exit;
  1006. Femail:=AValue;
  1007. MarkPropertyChanged(AIndex);
  1008. end;
  1009. Procedure TCandidate.Setname(AIndex : Integer; const AValue : String);
  1010. begin
  1011. If (Fname=AValue) then exit;
  1012. Fname:=AValue;
  1013. MarkPropertyChanged(AIndex);
  1014. end;
  1015. Procedure TCandidate.SetorderOnBallot(AIndex : Integer; const AValue : String);
  1016. begin
  1017. If (ForderOnBallot=AValue) then exit;
  1018. ForderOnBallot:=AValue;
  1019. MarkPropertyChanged(AIndex);
  1020. end;
  1021. Procedure TCandidate.Setparty(AIndex : Integer; const AValue : String);
  1022. begin
  1023. If (Fparty=AValue) then exit;
  1024. Fparty:=AValue;
  1025. MarkPropertyChanged(AIndex);
  1026. end;
  1027. Procedure TCandidate.Setphone(AIndex : Integer; const AValue : String);
  1028. begin
  1029. If (Fphone=AValue) then exit;
  1030. Fphone:=AValue;
  1031. MarkPropertyChanged(AIndex);
  1032. end;
  1033. Procedure TCandidate.SetphotoUrl(AIndex : Integer; const AValue : String);
  1034. begin
  1035. If (FphotoUrl=AValue) then exit;
  1036. FphotoUrl:=AValue;
  1037. MarkPropertyChanged(AIndex);
  1038. end;
  1039. //2.6.4. bug workaround
  1040. {$IFDEF VER2_6}
  1041. Procedure TCandidate.SetArrayLength(Const AName : String; ALength : Longint);
  1042. begin
  1043. Case AName of
  1044. 'channels' : SetLength(Fchannels,ALength);
  1045. else
  1046. Inherited SetArrayLength(AName,ALength);
  1047. end;
  1048. end;
  1049. {$ENDIF VER2_6}
  1050. { --------------------------------------------------------------------
  1051. TChannel
  1052. --------------------------------------------------------------------}
  1053. Procedure TChannel.Setid(AIndex : Integer; const AValue : String);
  1054. begin
  1055. If (Fid=AValue) then exit;
  1056. Fid:=AValue;
  1057. MarkPropertyChanged(AIndex);
  1058. end;
  1059. Procedure TChannel.Set_type(AIndex : Integer; const AValue : String);
  1060. begin
  1061. If (F_type=AValue) then exit;
  1062. F_type:=AValue;
  1063. MarkPropertyChanged(AIndex);
  1064. end;
  1065. Class Function TChannel.ExportPropertyName(Const AName : String) :String;
  1066. begin
  1067. Case AName of
  1068. '_type' : Result:='type';
  1069. else
  1070. Result:=Inherited ExportPropertyName(AName);
  1071. end;
  1072. end;
  1073. { --------------------------------------------------------------------
  1074. TContest
  1075. --------------------------------------------------------------------}
  1076. Procedure TContest.SetballotPlacement(AIndex : Integer; const AValue : String);
  1077. begin
  1078. If (FballotPlacement=AValue) then exit;
  1079. FballotPlacement:=AValue;
  1080. MarkPropertyChanged(AIndex);
  1081. end;
  1082. Procedure TContest.Setcandidates(AIndex : Integer; const AValue : TContestTypecandidatesArray);
  1083. begin
  1084. If (Fcandidates=AValue) then exit;
  1085. Fcandidates:=AValue;
  1086. MarkPropertyChanged(AIndex);
  1087. end;
  1088. Procedure TContest.Setdistrict(AIndex : Integer; const AValue : TElectoralDistrict);
  1089. begin
  1090. If (Fdistrict=AValue) then exit;
  1091. Fdistrict:=AValue;
  1092. MarkPropertyChanged(AIndex);
  1093. end;
  1094. Procedure TContest.SetelectorateSpecifications(AIndex : Integer; const AValue : String);
  1095. begin
  1096. If (FelectorateSpecifications=AValue) then exit;
  1097. FelectorateSpecifications:=AValue;
  1098. MarkPropertyChanged(AIndex);
  1099. end;
  1100. Procedure TContest.Setid(AIndex : Integer; const AValue : String);
  1101. begin
  1102. If (Fid=AValue) then exit;
  1103. Fid:=AValue;
  1104. MarkPropertyChanged(AIndex);
  1105. end;
  1106. Procedure TContest.Setlevel(AIndex : Integer; const AValue : TStringArray);
  1107. begin
  1108. If (Flevel=AValue) then exit;
  1109. Flevel:=AValue;
  1110. MarkPropertyChanged(AIndex);
  1111. end;
  1112. Procedure TContest.SetnumberElected(AIndex : Integer; const AValue : String);
  1113. begin
  1114. If (FnumberElected=AValue) then exit;
  1115. FnumberElected:=AValue;
  1116. MarkPropertyChanged(AIndex);
  1117. end;
  1118. Procedure TContest.SetnumberVotingFor(AIndex : Integer; const AValue : String);
  1119. begin
  1120. If (FnumberVotingFor=AValue) then exit;
  1121. FnumberVotingFor:=AValue;
  1122. MarkPropertyChanged(AIndex);
  1123. end;
  1124. Procedure TContest.Setoffice(AIndex : Integer; const AValue : String);
  1125. begin
  1126. If (Foffice=AValue) then exit;
  1127. Foffice:=AValue;
  1128. MarkPropertyChanged(AIndex);
  1129. end;
  1130. Procedure TContest.SetprimaryParty(AIndex : Integer; const AValue : String);
  1131. begin
  1132. If (FprimaryParty=AValue) then exit;
  1133. FprimaryParty:=AValue;
  1134. MarkPropertyChanged(AIndex);
  1135. end;
  1136. Procedure TContest.SetreferendumBallotResponses(AIndex : Integer; const AValue : TStringArray);
  1137. begin
  1138. If (FreferendumBallotResponses=AValue) then exit;
  1139. FreferendumBallotResponses:=AValue;
  1140. MarkPropertyChanged(AIndex);
  1141. end;
  1142. Procedure TContest.SetreferendumBrief(AIndex : Integer; const AValue : String);
  1143. begin
  1144. If (FreferendumBrief=AValue) then exit;
  1145. FreferendumBrief:=AValue;
  1146. MarkPropertyChanged(AIndex);
  1147. end;
  1148. Procedure TContest.SetreferendumConStatement(AIndex : Integer; const AValue : String);
  1149. begin
  1150. If (FreferendumConStatement=AValue) then exit;
  1151. FreferendumConStatement:=AValue;
  1152. MarkPropertyChanged(AIndex);
  1153. end;
  1154. Procedure TContest.SetreferendumEffectOfAbstain(AIndex : Integer; const AValue : String);
  1155. begin
  1156. If (FreferendumEffectOfAbstain=AValue) then exit;
  1157. FreferendumEffectOfAbstain:=AValue;
  1158. MarkPropertyChanged(AIndex);
  1159. end;
  1160. Procedure TContest.SetreferendumPassageThreshold(AIndex : Integer; const AValue : String);
  1161. begin
  1162. If (FreferendumPassageThreshold=AValue) then exit;
  1163. FreferendumPassageThreshold:=AValue;
  1164. MarkPropertyChanged(AIndex);
  1165. end;
  1166. Procedure TContest.SetreferendumProStatement(AIndex : Integer; const AValue : String);
  1167. begin
  1168. If (FreferendumProStatement=AValue) then exit;
  1169. FreferendumProStatement:=AValue;
  1170. MarkPropertyChanged(AIndex);
  1171. end;
  1172. Procedure TContest.SetreferendumSubtitle(AIndex : Integer; const AValue : String);
  1173. begin
  1174. If (FreferendumSubtitle=AValue) then exit;
  1175. FreferendumSubtitle:=AValue;
  1176. MarkPropertyChanged(AIndex);
  1177. end;
  1178. Procedure TContest.SetreferendumText(AIndex : Integer; const AValue : String);
  1179. begin
  1180. If (FreferendumText=AValue) then exit;
  1181. FreferendumText:=AValue;
  1182. MarkPropertyChanged(AIndex);
  1183. end;
  1184. Procedure TContest.SetreferendumTitle(AIndex : Integer; const AValue : String);
  1185. begin
  1186. If (FreferendumTitle=AValue) then exit;
  1187. FreferendumTitle:=AValue;
  1188. MarkPropertyChanged(AIndex);
  1189. end;
  1190. Procedure TContest.SetreferendumUrl(AIndex : Integer; const AValue : String);
  1191. begin
  1192. If (FreferendumUrl=AValue) then exit;
  1193. FreferendumUrl:=AValue;
  1194. MarkPropertyChanged(AIndex);
  1195. end;
  1196. Procedure TContest.Setroles(AIndex : Integer; const AValue : TStringArray);
  1197. begin
  1198. If (Froles=AValue) then exit;
  1199. Froles:=AValue;
  1200. MarkPropertyChanged(AIndex);
  1201. end;
  1202. Procedure TContest.Setsources(AIndex : Integer; const AValue : TContestTypesourcesArray);
  1203. begin
  1204. If (Fsources=AValue) then exit;
  1205. Fsources:=AValue;
  1206. MarkPropertyChanged(AIndex);
  1207. end;
  1208. Procedure TContest.Setspecial(AIndex : Integer; const AValue : String);
  1209. begin
  1210. If (Fspecial=AValue) then exit;
  1211. Fspecial:=AValue;
  1212. MarkPropertyChanged(AIndex);
  1213. end;
  1214. Procedure TContest.Set_type(AIndex : Integer; const AValue : String);
  1215. begin
  1216. If (F_type=AValue) then exit;
  1217. F_type:=AValue;
  1218. MarkPropertyChanged(AIndex);
  1219. end;
  1220. Class Function TContest.ExportPropertyName(Const AName : String) :String;
  1221. begin
  1222. Case AName of
  1223. '_type' : Result:='type';
  1224. else
  1225. Result:=Inherited ExportPropertyName(AName);
  1226. end;
  1227. end;
  1228. //2.6.4. bug workaround
  1229. {$IFDEF VER2_6}
  1230. Procedure TContest.SetArrayLength(Const AName : String; ALength : Longint);
  1231. begin
  1232. Case AName of
  1233. 'candidates' : SetLength(Fcandidates,ALength);
  1234. 'level' : SetLength(Flevel,ALength);
  1235. 'referendumballotresponses' : SetLength(FreferendumBallotResponses,ALength);
  1236. 'roles' : SetLength(Froles,ALength);
  1237. 'sources' : SetLength(Fsources,ALength);
  1238. else
  1239. Inherited SetArrayLength(AName,ALength);
  1240. end;
  1241. end;
  1242. {$ENDIF VER2_6}
  1243. { --------------------------------------------------------------------
  1244. TDivisionSearchResponse
  1245. --------------------------------------------------------------------}
  1246. Procedure TDivisionSearchResponse.Setkind(AIndex : Integer; const AValue : String);
  1247. begin
  1248. If (Fkind=AValue) then exit;
  1249. Fkind:=AValue;
  1250. MarkPropertyChanged(AIndex);
  1251. end;
  1252. Procedure TDivisionSearchResponse.Setresults(AIndex : Integer; const AValue : TDivisionSearchResponseTyperesultsArray);
  1253. begin
  1254. If (Fresults=AValue) then exit;
  1255. Fresults:=AValue;
  1256. MarkPropertyChanged(AIndex);
  1257. end;
  1258. //2.6.4. bug workaround
  1259. {$IFDEF VER2_6}
  1260. Procedure TDivisionSearchResponse.SetArrayLength(Const AName : String; ALength : Longint);
  1261. begin
  1262. Case AName of
  1263. 'results' : SetLength(Fresults,ALength);
  1264. else
  1265. Inherited SetArrayLength(AName,ALength);
  1266. end;
  1267. end;
  1268. {$ENDIF VER2_6}
  1269. { --------------------------------------------------------------------
  1270. TDivisionSearchResult
  1271. --------------------------------------------------------------------}
  1272. Procedure TDivisionSearchResult.Setaliases(AIndex : Integer; const AValue : TStringArray);
  1273. begin
  1274. If (Faliases=AValue) then exit;
  1275. Faliases:=AValue;
  1276. MarkPropertyChanged(AIndex);
  1277. end;
  1278. Procedure TDivisionSearchResult.Setname(AIndex : Integer; const AValue : String);
  1279. begin
  1280. If (Fname=AValue) then exit;
  1281. Fname:=AValue;
  1282. MarkPropertyChanged(AIndex);
  1283. end;
  1284. Procedure TDivisionSearchResult.SetocdId(AIndex : Integer; const AValue : String);
  1285. begin
  1286. If (FocdId=AValue) then exit;
  1287. FocdId:=AValue;
  1288. MarkPropertyChanged(AIndex);
  1289. end;
  1290. //2.6.4. bug workaround
  1291. {$IFDEF VER2_6}
  1292. Procedure TDivisionSearchResult.SetArrayLength(Const AName : String; ALength : Longint);
  1293. begin
  1294. Case AName of
  1295. 'aliases' : SetLength(Faliases,ALength);
  1296. else
  1297. Inherited SetArrayLength(AName,ALength);
  1298. end;
  1299. end;
  1300. {$ENDIF VER2_6}
  1301. { --------------------------------------------------------------------
  1302. TElection
  1303. --------------------------------------------------------------------}
  1304. Procedure TElection.SetelectionDay(AIndex : Integer; const AValue : String);
  1305. begin
  1306. If (FelectionDay=AValue) then exit;
  1307. FelectionDay:=AValue;
  1308. MarkPropertyChanged(AIndex);
  1309. end;
  1310. Procedure TElection.Setid(AIndex : Integer; const AValue : String);
  1311. begin
  1312. If (Fid=AValue) then exit;
  1313. Fid:=AValue;
  1314. MarkPropertyChanged(AIndex);
  1315. end;
  1316. Procedure TElection.Setname(AIndex : Integer; const AValue : String);
  1317. begin
  1318. If (Fname=AValue) then exit;
  1319. Fname:=AValue;
  1320. MarkPropertyChanged(AIndex);
  1321. end;
  1322. Procedure TElection.SetocdDivisionId(AIndex : Integer; const AValue : String);
  1323. begin
  1324. If (FocdDivisionId=AValue) then exit;
  1325. FocdDivisionId:=AValue;
  1326. MarkPropertyChanged(AIndex);
  1327. end;
  1328. { --------------------------------------------------------------------
  1329. TElectionOfficial
  1330. --------------------------------------------------------------------}
  1331. Procedure TElectionOfficial.SetemailAddress(AIndex : Integer; const AValue : String);
  1332. begin
  1333. If (FemailAddress=AValue) then exit;
  1334. FemailAddress:=AValue;
  1335. MarkPropertyChanged(AIndex);
  1336. end;
  1337. Procedure TElectionOfficial.SetfaxNumber(AIndex : Integer; const AValue : String);
  1338. begin
  1339. If (FfaxNumber=AValue) then exit;
  1340. FfaxNumber:=AValue;
  1341. MarkPropertyChanged(AIndex);
  1342. end;
  1343. Procedure TElectionOfficial.Setname(AIndex : Integer; const AValue : String);
  1344. begin
  1345. If (Fname=AValue) then exit;
  1346. Fname:=AValue;
  1347. MarkPropertyChanged(AIndex);
  1348. end;
  1349. Procedure TElectionOfficial.SetofficePhoneNumber(AIndex : Integer; const AValue : String);
  1350. begin
  1351. If (FofficePhoneNumber=AValue) then exit;
  1352. FofficePhoneNumber:=AValue;
  1353. MarkPropertyChanged(AIndex);
  1354. end;
  1355. Procedure TElectionOfficial.Settitle(AIndex : Integer; const AValue : String);
  1356. begin
  1357. If (Ftitle=AValue) then exit;
  1358. Ftitle:=AValue;
  1359. MarkPropertyChanged(AIndex);
  1360. end;
  1361. { --------------------------------------------------------------------
  1362. TElectionsQueryResponse
  1363. --------------------------------------------------------------------}
  1364. Procedure TElectionsQueryResponse.Setelections(AIndex : Integer; const AValue : TElectionsQueryResponseTypeelectionsArray);
  1365. begin
  1366. If (Felections=AValue) then exit;
  1367. Felections:=AValue;
  1368. MarkPropertyChanged(AIndex);
  1369. end;
  1370. Procedure TElectionsQueryResponse.Setkind(AIndex : Integer; const AValue : String);
  1371. begin
  1372. If (Fkind=AValue) then exit;
  1373. Fkind:=AValue;
  1374. MarkPropertyChanged(AIndex);
  1375. end;
  1376. //2.6.4. bug workaround
  1377. {$IFDEF VER2_6}
  1378. Procedure TElectionsQueryResponse.SetArrayLength(Const AName : String; ALength : Longint);
  1379. begin
  1380. Case AName of
  1381. 'elections' : SetLength(Felections,ALength);
  1382. else
  1383. Inherited SetArrayLength(AName,ALength);
  1384. end;
  1385. end;
  1386. {$ENDIF VER2_6}
  1387. { --------------------------------------------------------------------
  1388. TElectoralDistrict
  1389. --------------------------------------------------------------------}
  1390. Procedure TElectoralDistrict.Setid(AIndex : Integer; const AValue : String);
  1391. begin
  1392. If (Fid=AValue) then exit;
  1393. Fid:=AValue;
  1394. MarkPropertyChanged(AIndex);
  1395. end;
  1396. Procedure TElectoralDistrict.Setname(AIndex : Integer; const AValue : String);
  1397. begin
  1398. If (Fname=AValue) then exit;
  1399. Fname:=AValue;
  1400. MarkPropertyChanged(AIndex);
  1401. end;
  1402. Procedure TElectoralDistrict.Setscope(AIndex : Integer; const AValue : String);
  1403. begin
  1404. If (Fscope=AValue) then exit;
  1405. Fscope:=AValue;
  1406. MarkPropertyChanged(AIndex);
  1407. end;
  1408. { --------------------------------------------------------------------
  1409. TGeographicDivision
  1410. --------------------------------------------------------------------}
  1411. Procedure TGeographicDivision.SetalsoKnownAs(AIndex : Integer; const AValue : TStringArray);
  1412. begin
  1413. If (FalsoKnownAs=AValue) then exit;
  1414. FalsoKnownAs:=AValue;
  1415. MarkPropertyChanged(AIndex);
  1416. end;
  1417. Procedure TGeographicDivision.Setname(AIndex : Integer; const AValue : String);
  1418. begin
  1419. If (Fname=AValue) then exit;
  1420. Fname:=AValue;
  1421. MarkPropertyChanged(AIndex);
  1422. end;
  1423. Procedure TGeographicDivision.SetofficeIndices(AIndex : Integer; const AValue : TintegerArray);
  1424. begin
  1425. If (FofficeIndices=AValue) then exit;
  1426. FofficeIndices:=AValue;
  1427. MarkPropertyChanged(AIndex);
  1428. end;
  1429. //2.6.4. bug workaround
  1430. {$IFDEF VER2_6}
  1431. Procedure TGeographicDivision.SetArrayLength(Const AName : String; ALength : Longint);
  1432. begin
  1433. Case AName of
  1434. 'alsoknownas' : SetLength(FalsoKnownAs,ALength);
  1435. 'officeindices' : SetLength(FofficeIndices,ALength);
  1436. else
  1437. Inherited SetArrayLength(AName,ALength);
  1438. end;
  1439. end;
  1440. {$ENDIF VER2_6}
  1441. { --------------------------------------------------------------------
  1442. TOffice
  1443. --------------------------------------------------------------------}
  1444. Procedure TOffice.SetdivisionId(AIndex : Integer; const AValue : String);
  1445. begin
  1446. If (FdivisionId=AValue) then exit;
  1447. FdivisionId:=AValue;
  1448. MarkPropertyChanged(AIndex);
  1449. end;
  1450. Procedure TOffice.Setlevels(AIndex : Integer; const AValue : TStringArray);
  1451. begin
  1452. If (Flevels=AValue) then exit;
  1453. Flevels:=AValue;
  1454. MarkPropertyChanged(AIndex);
  1455. end;
  1456. Procedure TOffice.Setname(AIndex : Integer; const AValue : String);
  1457. begin
  1458. If (Fname=AValue) then exit;
  1459. Fname:=AValue;
  1460. MarkPropertyChanged(AIndex);
  1461. end;
  1462. Procedure TOffice.SetofficialIndices(AIndex : Integer; const AValue : TintegerArray);
  1463. begin
  1464. If (FofficialIndices=AValue) then exit;
  1465. FofficialIndices:=AValue;
  1466. MarkPropertyChanged(AIndex);
  1467. end;
  1468. Procedure TOffice.Setroles(AIndex : Integer; const AValue : TStringArray);
  1469. begin
  1470. If (Froles=AValue) then exit;
  1471. Froles:=AValue;
  1472. MarkPropertyChanged(AIndex);
  1473. end;
  1474. Procedure TOffice.Setsources(AIndex : Integer; const AValue : TOfficeTypesourcesArray);
  1475. begin
  1476. If (Fsources=AValue) then exit;
  1477. Fsources:=AValue;
  1478. MarkPropertyChanged(AIndex);
  1479. end;
  1480. //2.6.4. bug workaround
  1481. {$IFDEF VER2_6}
  1482. Procedure TOffice.SetArrayLength(Const AName : String; ALength : Longint);
  1483. begin
  1484. Case AName of
  1485. 'levels' : SetLength(Flevels,ALength);
  1486. 'officialindices' : SetLength(FofficialIndices,ALength);
  1487. 'roles' : SetLength(Froles,ALength);
  1488. 'sources' : SetLength(Fsources,ALength);
  1489. else
  1490. Inherited SetArrayLength(AName,ALength);
  1491. end;
  1492. end;
  1493. {$ENDIF VER2_6}
  1494. { --------------------------------------------------------------------
  1495. TOfficial
  1496. --------------------------------------------------------------------}
  1497. Procedure TOfficial.Setaddress(AIndex : Integer; const AValue : TOfficialTypeaddressArray);
  1498. begin
  1499. If (Faddress=AValue) then exit;
  1500. Faddress:=AValue;
  1501. MarkPropertyChanged(AIndex);
  1502. end;
  1503. Procedure TOfficial.Setchannels(AIndex : Integer; const AValue : TOfficialTypechannelsArray);
  1504. begin
  1505. If (Fchannels=AValue) then exit;
  1506. Fchannels:=AValue;
  1507. MarkPropertyChanged(AIndex);
  1508. end;
  1509. Procedure TOfficial.Setemails(AIndex : Integer; const AValue : TStringArray);
  1510. begin
  1511. If (Femails=AValue) then exit;
  1512. Femails:=AValue;
  1513. MarkPropertyChanged(AIndex);
  1514. end;
  1515. Procedure TOfficial.Setname(AIndex : Integer; const AValue : String);
  1516. begin
  1517. If (Fname=AValue) then exit;
  1518. Fname:=AValue;
  1519. MarkPropertyChanged(AIndex);
  1520. end;
  1521. Procedure TOfficial.Setparty(AIndex : Integer; const AValue : String);
  1522. begin
  1523. If (Fparty=AValue) then exit;
  1524. Fparty:=AValue;
  1525. MarkPropertyChanged(AIndex);
  1526. end;
  1527. Procedure TOfficial.Setphones(AIndex : Integer; const AValue : TStringArray);
  1528. begin
  1529. If (Fphones=AValue) then exit;
  1530. Fphones:=AValue;
  1531. MarkPropertyChanged(AIndex);
  1532. end;
  1533. Procedure TOfficial.SetphotoUrl(AIndex : Integer; const AValue : String);
  1534. begin
  1535. If (FphotoUrl=AValue) then exit;
  1536. FphotoUrl:=AValue;
  1537. MarkPropertyChanged(AIndex);
  1538. end;
  1539. Procedure TOfficial.Seturls(AIndex : Integer; const AValue : TStringArray);
  1540. begin
  1541. If (Furls=AValue) then exit;
  1542. Furls:=AValue;
  1543. MarkPropertyChanged(AIndex);
  1544. end;
  1545. //2.6.4. bug workaround
  1546. {$IFDEF VER2_6}
  1547. Procedure TOfficial.SetArrayLength(Const AName : String; ALength : Longint);
  1548. begin
  1549. Case AName of
  1550. 'address' : SetLength(Faddress,ALength);
  1551. 'channels' : SetLength(Fchannels,ALength);
  1552. 'emails' : SetLength(Femails,ALength);
  1553. 'phones' : SetLength(Fphones,ALength);
  1554. 'urls' : SetLength(Furls,ALength);
  1555. else
  1556. Inherited SetArrayLength(AName,ALength);
  1557. end;
  1558. end;
  1559. {$ENDIF VER2_6}
  1560. { --------------------------------------------------------------------
  1561. TPollingLocation
  1562. --------------------------------------------------------------------}
  1563. Procedure TPollingLocation.Setaddress(AIndex : Integer; const AValue : TSimpleAddressType);
  1564. begin
  1565. If (Faddress=AValue) then exit;
  1566. Faddress:=AValue;
  1567. MarkPropertyChanged(AIndex);
  1568. end;
  1569. Procedure TPollingLocation.SetendDate(AIndex : Integer; const AValue : String);
  1570. begin
  1571. If (FendDate=AValue) then exit;
  1572. FendDate:=AValue;
  1573. MarkPropertyChanged(AIndex);
  1574. end;
  1575. Procedure TPollingLocation.Setid(AIndex : Integer; const AValue : String);
  1576. begin
  1577. If (Fid=AValue) then exit;
  1578. Fid:=AValue;
  1579. MarkPropertyChanged(AIndex);
  1580. end;
  1581. Procedure TPollingLocation.Setname(AIndex : Integer; const AValue : String);
  1582. begin
  1583. If (Fname=AValue) then exit;
  1584. Fname:=AValue;
  1585. MarkPropertyChanged(AIndex);
  1586. end;
  1587. Procedure TPollingLocation.Setnotes(AIndex : Integer; const AValue : String);
  1588. begin
  1589. If (Fnotes=AValue) then exit;
  1590. Fnotes:=AValue;
  1591. MarkPropertyChanged(AIndex);
  1592. end;
  1593. Procedure TPollingLocation.SetpollingHours(AIndex : Integer; const AValue : String);
  1594. begin
  1595. If (FpollingHours=AValue) then exit;
  1596. FpollingHours:=AValue;
  1597. MarkPropertyChanged(AIndex);
  1598. end;
  1599. Procedure TPollingLocation.Setsources(AIndex : Integer; const AValue : TPollingLocationTypesourcesArray);
  1600. begin
  1601. If (Fsources=AValue) then exit;
  1602. Fsources:=AValue;
  1603. MarkPropertyChanged(AIndex);
  1604. end;
  1605. Procedure TPollingLocation.SetstartDate(AIndex : Integer; const AValue : String);
  1606. begin
  1607. If (FstartDate=AValue) then exit;
  1608. FstartDate:=AValue;
  1609. MarkPropertyChanged(AIndex);
  1610. end;
  1611. Procedure TPollingLocation.SetvoterServices(AIndex : Integer; const AValue : String);
  1612. begin
  1613. If (FvoterServices=AValue) then exit;
  1614. FvoterServices:=AValue;
  1615. MarkPropertyChanged(AIndex);
  1616. end;
  1617. //2.6.4. bug workaround
  1618. {$IFDEF VER2_6}
  1619. Procedure TPollingLocation.SetArrayLength(Const AName : String; ALength : Longint);
  1620. begin
  1621. Case AName of
  1622. 'sources' : SetLength(Fsources,ALength);
  1623. else
  1624. Inherited SetArrayLength(AName,ALength);
  1625. end;
  1626. end;
  1627. {$ENDIF VER2_6}
  1628. { --------------------------------------------------------------------
  1629. TRepresentativeInfoDataTypedivisions
  1630. --------------------------------------------------------------------}
  1631. Class Function TRepresentativeInfoDataTypedivisions.AllowAdditionalProperties : Boolean;
  1632. begin
  1633. Result:=True;
  1634. end;
  1635. { --------------------------------------------------------------------
  1636. TRepresentativeInfoData
  1637. --------------------------------------------------------------------}
  1638. Procedure TRepresentativeInfoData.Setdivisions(AIndex : Integer; const AValue : TRepresentativeInfoDataTypedivisions);
  1639. begin
  1640. If (Fdivisions=AValue) then exit;
  1641. Fdivisions:=AValue;
  1642. MarkPropertyChanged(AIndex);
  1643. end;
  1644. Procedure TRepresentativeInfoData.Setoffices(AIndex : Integer; const AValue : TRepresentativeInfoDataTypeofficesArray);
  1645. begin
  1646. If (Foffices=AValue) then exit;
  1647. Foffices:=AValue;
  1648. MarkPropertyChanged(AIndex);
  1649. end;
  1650. Procedure TRepresentativeInfoData.Setofficials(AIndex : Integer; const AValue : TRepresentativeInfoDataTypeofficialsArray);
  1651. begin
  1652. If (Fofficials=AValue) then exit;
  1653. Fofficials:=AValue;
  1654. MarkPropertyChanged(AIndex);
  1655. end;
  1656. //2.6.4. bug workaround
  1657. {$IFDEF VER2_6}
  1658. Procedure TRepresentativeInfoData.SetArrayLength(Const AName : String; ALength : Longint);
  1659. begin
  1660. Case AName of
  1661. 'offices' : SetLength(Foffices,ALength);
  1662. 'officials' : SetLength(Fofficials,ALength);
  1663. else
  1664. Inherited SetArrayLength(AName,ALength);
  1665. end;
  1666. end;
  1667. {$ENDIF VER2_6}
  1668. { --------------------------------------------------------------------
  1669. TRepresentativeInfoResponseTypedivisions
  1670. --------------------------------------------------------------------}
  1671. Class Function TRepresentativeInfoResponseTypedivisions.AllowAdditionalProperties : Boolean;
  1672. begin
  1673. Result:=True;
  1674. end;
  1675. { --------------------------------------------------------------------
  1676. TRepresentativeInfoResponse
  1677. --------------------------------------------------------------------}
  1678. Procedure TRepresentativeInfoResponse.Setdivisions(AIndex : Integer; const AValue : TRepresentativeInfoResponseTypedivisions);
  1679. begin
  1680. If (Fdivisions=AValue) then exit;
  1681. Fdivisions:=AValue;
  1682. MarkPropertyChanged(AIndex);
  1683. end;
  1684. Procedure TRepresentativeInfoResponse.Setkind(AIndex : Integer; const AValue : String);
  1685. begin
  1686. If (Fkind=AValue) then exit;
  1687. Fkind:=AValue;
  1688. MarkPropertyChanged(AIndex);
  1689. end;
  1690. Procedure TRepresentativeInfoResponse.SetnormalizedInput(AIndex : Integer; const AValue : TSimpleAddressType);
  1691. begin
  1692. If (FnormalizedInput=AValue) then exit;
  1693. FnormalizedInput:=AValue;
  1694. MarkPropertyChanged(AIndex);
  1695. end;
  1696. Procedure TRepresentativeInfoResponse.Setoffices(AIndex : Integer; const AValue : TRepresentativeInfoResponseTypeofficesArray);
  1697. begin
  1698. If (Foffices=AValue) then exit;
  1699. Foffices:=AValue;
  1700. MarkPropertyChanged(AIndex);
  1701. end;
  1702. Procedure TRepresentativeInfoResponse.Setofficials(AIndex : Integer; const AValue : TRepresentativeInfoResponseTypeofficialsArray);
  1703. begin
  1704. If (Fofficials=AValue) then exit;
  1705. Fofficials:=AValue;
  1706. MarkPropertyChanged(AIndex);
  1707. end;
  1708. //2.6.4. bug workaround
  1709. {$IFDEF VER2_6}
  1710. Procedure TRepresentativeInfoResponse.SetArrayLength(Const AName : String; ALength : Longint);
  1711. begin
  1712. Case AName of
  1713. 'offices' : SetLength(Foffices,ALength);
  1714. 'officials' : SetLength(Fofficials,ALength);
  1715. else
  1716. Inherited SetArrayLength(AName,ALength);
  1717. end;
  1718. end;
  1719. {$ENDIF VER2_6}
  1720. { --------------------------------------------------------------------
  1721. TSimpleAddressType
  1722. --------------------------------------------------------------------}
  1723. Procedure TSimpleAddressType.Setcity(AIndex : Integer; const AValue : String);
  1724. begin
  1725. If (Fcity=AValue) then exit;
  1726. Fcity:=AValue;
  1727. MarkPropertyChanged(AIndex);
  1728. end;
  1729. Procedure TSimpleAddressType.Setline1(AIndex : Integer; const AValue : String);
  1730. begin
  1731. If (Fline1=AValue) then exit;
  1732. Fline1:=AValue;
  1733. MarkPropertyChanged(AIndex);
  1734. end;
  1735. Procedure TSimpleAddressType.Setline2(AIndex : Integer; const AValue : String);
  1736. begin
  1737. If (Fline2=AValue) then exit;
  1738. Fline2:=AValue;
  1739. MarkPropertyChanged(AIndex);
  1740. end;
  1741. Procedure TSimpleAddressType.Setline3(AIndex : Integer; const AValue : String);
  1742. begin
  1743. If (Fline3=AValue) then exit;
  1744. Fline3:=AValue;
  1745. MarkPropertyChanged(AIndex);
  1746. end;
  1747. Procedure TSimpleAddressType.SetlocationName(AIndex : Integer; const AValue : String);
  1748. begin
  1749. If (FlocationName=AValue) then exit;
  1750. FlocationName:=AValue;
  1751. MarkPropertyChanged(AIndex);
  1752. end;
  1753. Procedure TSimpleAddressType.Setstate(AIndex : Integer; const AValue : String);
  1754. begin
  1755. If (Fstate=AValue) then exit;
  1756. Fstate:=AValue;
  1757. MarkPropertyChanged(AIndex);
  1758. end;
  1759. Procedure TSimpleAddressType.Setzip(AIndex : Integer; const AValue : String);
  1760. begin
  1761. If (Fzip=AValue) then exit;
  1762. Fzip:=AValue;
  1763. MarkPropertyChanged(AIndex);
  1764. end;
  1765. { --------------------------------------------------------------------
  1766. TSource
  1767. --------------------------------------------------------------------}
  1768. Procedure TSource.Setname(AIndex : Integer; const AValue : String);
  1769. begin
  1770. If (Fname=AValue) then exit;
  1771. Fname:=AValue;
  1772. MarkPropertyChanged(AIndex);
  1773. end;
  1774. Procedure TSource.Setofficial(AIndex : Integer; const AValue : boolean);
  1775. begin
  1776. If (Fofficial=AValue) then exit;
  1777. Fofficial:=AValue;
  1778. MarkPropertyChanged(AIndex);
  1779. end;
  1780. { --------------------------------------------------------------------
  1781. TVoterInfoResponse
  1782. --------------------------------------------------------------------}
  1783. Procedure TVoterInfoResponse.Setcontests(AIndex : Integer; const AValue : TVoterInfoResponseTypecontestsArray);
  1784. begin
  1785. If (Fcontests=AValue) then exit;
  1786. Fcontests:=AValue;
  1787. MarkPropertyChanged(AIndex);
  1788. end;
  1789. Procedure TVoterInfoResponse.SetdropOffLocations(AIndex : Integer; const AValue : TVoterInfoResponseTypedropOffLocationsArray);
  1790. begin
  1791. If (FdropOffLocations=AValue) then exit;
  1792. FdropOffLocations:=AValue;
  1793. MarkPropertyChanged(AIndex);
  1794. end;
  1795. Procedure TVoterInfoResponse.SetearlyVoteSites(AIndex : Integer; const AValue : TVoterInfoResponseTypeearlyVoteSitesArray);
  1796. begin
  1797. If (FearlyVoteSites=AValue) then exit;
  1798. FearlyVoteSites:=AValue;
  1799. MarkPropertyChanged(AIndex);
  1800. end;
  1801. Procedure TVoterInfoResponse.Setelection(AIndex : Integer; const AValue : TElection);
  1802. begin
  1803. If (Felection=AValue) then exit;
  1804. Felection:=AValue;
  1805. MarkPropertyChanged(AIndex);
  1806. end;
  1807. Procedure TVoterInfoResponse.Setkind(AIndex : Integer; const AValue : String);
  1808. begin
  1809. If (Fkind=AValue) then exit;
  1810. Fkind:=AValue;
  1811. MarkPropertyChanged(AIndex);
  1812. end;
  1813. Procedure TVoterInfoResponse.SetmailOnly(AIndex : Integer; const AValue : boolean);
  1814. begin
  1815. If (FmailOnly=AValue) then exit;
  1816. FmailOnly:=AValue;
  1817. MarkPropertyChanged(AIndex);
  1818. end;
  1819. Procedure TVoterInfoResponse.SetnormalizedInput(AIndex : Integer; const AValue : TSimpleAddressType);
  1820. begin
  1821. If (FnormalizedInput=AValue) then exit;
  1822. FnormalizedInput:=AValue;
  1823. MarkPropertyChanged(AIndex);
  1824. end;
  1825. Procedure TVoterInfoResponse.SetotherElections(AIndex : Integer; const AValue : TVoterInfoResponseTypeotherElectionsArray);
  1826. begin
  1827. If (FotherElections=AValue) then exit;
  1828. FotherElections:=AValue;
  1829. MarkPropertyChanged(AIndex);
  1830. end;
  1831. Procedure TVoterInfoResponse.SetpollingLocations(AIndex : Integer; const AValue : TVoterInfoResponseTypepollingLocationsArray);
  1832. begin
  1833. If (FpollingLocations=AValue) then exit;
  1834. FpollingLocations:=AValue;
  1835. MarkPropertyChanged(AIndex);
  1836. end;
  1837. Procedure TVoterInfoResponse.SetprecinctId(AIndex : Integer; const AValue : String);
  1838. begin
  1839. If (FprecinctId=AValue) then exit;
  1840. FprecinctId:=AValue;
  1841. MarkPropertyChanged(AIndex);
  1842. end;
  1843. Procedure TVoterInfoResponse.Setstate(AIndex : Integer; const AValue : TVoterInfoResponseTypestateArray);
  1844. begin
  1845. If (Fstate=AValue) then exit;
  1846. Fstate:=AValue;
  1847. MarkPropertyChanged(AIndex);
  1848. end;
  1849. //2.6.4. bug workaround
  1850. {$IFDEF VER2_6}
  1851. Procedure TVoterInfoResponse.SetArrayLength(Const AName : String; ALength : Longint);
  1852. begin
  1853. Case AName of
  1854. 'contests' : SetLength(Fcontests,ALength);
  1855. 'dropofflocations' : SetLength(FdropOffLocations,ALength);
  1856. 'earlyvotesites' : SetLength(FearlyVoteSites,ALength);
  1857. 'otherelections' : SetLength(FotherElections,ALength);
  1858. 'pollinglocations' : SetLength(FpollingLocations,ALength);
  1859. 'state' : SetLength(Fstate,ALength);
  1860. else
  1861. Inherited SetArrayLength(AName,ALength);
  1862. end;
  1863. end;
  1864. {$ENDIF VER2_6}
  1865. { --------------------------------------------------------------------
  1866. TDivisionsResource
  1867. --------------------------------------------------------------------}
  1868. Class Function TDivisionsResource.ResourceName : String;
  1869. begin
  1870. Result:='divisions';
  1871. end;
  1872. Class Function TDivisionsResource.DefaultAPI : TGoogleAPIClass;
  1873. begin
  1874. Result:=TcivicinfoAPI;
  1875. end;
  1876. Function TDivisionsResource.Search(AQuery : string = '') : TDivisionSearchResponse;
  1877. Const
  1878. _HTTPMethod = 'GET';
  1879. _Path = 'divisions';
  1880. _Methodid = 'civicinfo.divisions.search';
  1881. begin
  1882. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,Nil,TDivisionSearchResponse) as TDivisionSearchResponse;
  1883. end;
  1884. Function TDivisionsResource.Search(AQuery : TDivisionssearchOptions) : TDivisionSearchResponse;
  1885. Var
  1886. _Q : String;
  1887. begin
  1888. _Q:='';
  1889. AddToQuery(_Q,'query',AQuery.query);
  1890. Result:=Search(_Q);
  1891. end;
  1892. { --------------------------------------------------------------------
  1893. TElectionsResource
  1894. --------------------------------------------------------------------}
  1895. Class Function TElectionsResource.ResourceName : String;
  1896. begin
  1897. Result:='elections';
  1898. end;
  1899. Class Function TElectionsResource.DefaultAPI : TGoogleAPIClass;
  1900. begin
  1901. Result:=TcivicinfoAPI;
  1902. end;
  1903. Function TElectionsResource.ElectionQuery : TElectionsQueryResponse;
  1904. Const
  1905. _HTTPMethod = 'GET';
  1906. _Path = 'elections';
  1907. _Methodid = 'civicinfo.elections.electionQuery';
  1908. begin
  1909. Result:=ServiceCall(_HTTPMethod,_Path,'',Nil,TElectionsQueryResponse) as TElectionsQueryResponse;
  1910. end;
  1911. Function TElectionsResource.VoterInfoQuery(AQuery : string = '') : TVoterInfoResponse;
  1912. Const
  1913. _HTTPMethod = 'GET';
  1914. _Path = 'voterinfo';
  1915. _Methodid = 'civicinfo.elections.voterInfoQuery';
  1916. begin
  1917. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,Nil,TVoterInfoResponse) as TVoterInfoResponse;
  1918. end;
  1919. Function TElectionsResource.VoterInfoQuery(AQuery : TElectionsvoterInfoQueryOptions) : TVoterInfoResponse;
  1920. Var
  1921. _Q : String;
  1922. begin
  1923. _Q:='';
  1924. AddToQuery(_Q,'address',AQuery.address);
  1925. AddToQuery(_Q,'electionId',AQuery.electionId);
  1926. AddToQuery(_Q,'officialOnly',AQuery.officialOnly);
  1927. Result:=VoterInfoQuery(_Q);
  1928. end;
  1929. { --------------------------------------------------------------------
  1930. TRepresentativesResource
  1931. --------------------------------------------------------------------}
  1932. Class Function TRepresentativesResource.ResourceName : String;
  1933. begin
  1934. Result:='representatives';
  1935. end;
  1936. Class Function TRepresentativesResource.DefaultAPI : TGoogleAPIClass;
  1937. begin
  1938. Result:=TcivicinfoAPI;
  1939. end;
  1940. Function TRepresentativesResource.RepresentativeInfoByAddress(AQuery : string = '') : TRepresentativeInfoResponse;
  1941. Const
  1942. _HTTPMethod = 'GET';
  1943. _Path = 'representatives';
  1944. _Methodid = 'civicinfo.representatives.representativeInfoByAddress';
  1945. begin
  1946. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,Nil,TRepresentativeInfoResponse) as TRepresentativeInfoResponse;
  1947. end;
  1948. Function TRepresentativesResource.RepresentativeInfoByAddress(AQuery : TRepresentativesrepresentativeInfoByAddressOptions) : TRepresentativeInfoResponse;
  1949. Var
  1950. _Q : String;
  1951. begin
  1952. _Q:='';
  1953. AddToQuery(_Q,'address',AQuery.address);
  1954. AddToQuery(_Q,'includeOffices',AQuery.includeOffices);
  1955. AddToQuery(_Q,'levels',AQuery.levels);
  1956. AddToQuery(_Q,'roles',AQuery.roles);
  1957. Result:=RepresentativeInfoByAddress(_Q);
  1958. end;
  1959. Function TRepresentativesResource.RepresentativeInfoByDivision(ocdId: string; AQuery : string = '') : TRepresentativeInfoData;
  1960. Const
  1961. _HTTPMethod = 'GET';
  1962. _Path = 'representatives/{ocdId}';
  1963. _Methodid = 'civicinfo.representatives.representativeInfoByDivision';
  1964. Var
  1965. _P : String;
  1966. begin
  1967. _P:=SubstitutePath(_Path,['ocdId',ocdId]);
  1968. Result:=ServiceCall(_HTTPMethod,_P,AQuery,Nil,TRepresentativeInfoData) as TRepresentativeInfoData;
  1969. end;
  1970. Function TRepresentativesResource.RepresentativeInfoByDivision(ocdId: string; AQuery : TRepresentativesrepresentativeInfoByDivisionOptions) : TRepresentativeInfoData;
  1971. Var
  1972. _Q : String;
  1973. begin
  1974. _Q:='';
  1975. AddToQuery(_Q,'levels',AQuery.levels);
  1976. AddToQuery(_Q,'recursive',AQuery.recursive);
  1977. AddToQuery(_Q,'roles',AQuery.roles);
  1978. Result:=RepresentativeInfoByDivision(ocdId,_Q);
  1979. end;
  1980. { --------------------------------------------------------------------
  1981. TCivicinfoAPI
  1982. --------------------------------------------------------------------}
  1983. Class Function TCivicinfoAPI.APIName : String;
  1984. begin
  1985. Result:='civicinfo';
  1986. end;
  1987. Class Function TCivicinfoAPI.APIVersion : String;
  1988. begin
  1989. Result:='v2';
  1990. end;
  1991. Class Function TCivicinfoAPI.APIRevision : String;
  1992. begin
  1993. Result:='20150820';
  1994. end;
  1995. Class Function TCivicinfoAPI.APIID : String;
  1996. begin
  1997. Result:='civicinfo:v2';
  1998. end;
  1999. Class Function TCivicinfoAPI.APITitle : String;
  2000. begin
  2001. Result:='Google Civic Information API';
  2002. end;
  2003. Class Function TCivicinfoAPI.APIDescription : String;
  2004. begin
  2005. Result:='An API for accessing civic information.';
  2006. end;
  2007. Class Function TCivicinfoAPI.APIOwnerDomain : String;
  2008. begin
  2009. Result:='google.com';
  2010. end;
  2011. Class Function TCivicinfoAPI.APIOwnerName : String;
  2012. begin
  2013. Result:='Google';
  2014. end;
  2015. Class Function TCivicinfoAPI.APIIcon16 : String;
  2016. begin
  2017. Result:='http://www.google.com/images/icons/product/search-16.gif';
  2018. end;
  2019. Class Function TCivicinfoAPI.APIIcon32 : String;
  2020. begin
  2021. Result:='http://www.google.com/images/icons/product/search-32.gif';
  2022. end;
  2023. Class Function TCivicinfoAPI.APIdocumentationLink : String;
  2024. begin
  2025. Result:='https://developers.google.com/civic-information';
  2026. end;
  2027. Class Function TCivicinfoAPI.APIrootUrl : string;
  2028. begin
  2029. Result:='https://www.googleapis.com/';
  2030. end;
  2031. Class Function TCivicinfoAPI.APIbasePath : string;
  2032. begin
  2033. Result:='/civicinfo/v2/';
  2034. end;
  2035. Class Function TCivicinfoAPI.APIbaseURL : String;
  2036. begin
  2037. Result:='https://www.googleapis.com/civicinfo/v2/';
  2038. end;
  2039. Class Function TCivicinfoAPI.APIProtocol : string;
  2040. begin
  2041. Result:='rest';
  2042. end;
  2043. Class Function TCivicinfoAPI.APIservicePath : string;
  2044. begin
  2045. Result:='civicinfo/v2/';
  2046. end;
  2047. Class Function TCivicinfoAPI.APIbatchPath : String;
  2048. begin
  2049. Result:='batch';
  2050. end;
  2051. Class Function TCivicinfoAPI.APIAuthScopes : TScopeInfoArray;
  2052. begin
  2053. SetLength(Result,0);
  2054. end;
  2055. Class Function TCivicinfoAPI.APINeedsAuth : Boolean;
  2056. begin
  2057. Result:=False;
  2058. end;
  2059. Class Procedure TCivicinfoAPI.RegisterAPIResources;
  2060. begin
  2061. TAdministrationRegion.RegisterObject;
  2062. TAdministrativeBody.RegisterObject;
  2063. TCandidate.RegisterObject;
  2064. TChannel.RegisterObject;
  2065. TContest.RegisterObject;
  2066. TDivisionSearchResponse.RegisterObject;
  2067. TDivisionSearchResult.RegisterObject;
  2068. TElection.RegisterObject;
  2069. TElectionOfficial.RegisterObject;
  2070. TElectionsQueryResponse.RegisterObject;
  2071. TElectoralDistrict.RegisterObject;
  2072. TGeographicDivision.RegisterObject;
  2073. TOffice.RegisterObject;
  2074. TOfficial.RegisterObject;
  2075. TPollingLocation.RegisterObject;
  2076. TRepresentativeInfoDataTypedivisions.RegisterObject;
  2077. TRepresentativeInfoData.RegisterObject;
  2078. TRepresentativeInfoResponseTypedivisions.RegisterObject;
  2079. TRepresentativeInfoResponse.RegisterObject;
  2080. TSimpleAddressType.RegisterObject;
  2081. TSource.RegisterObject;
  2082. TVoterInfoResponse.RegisterObject;
  2083. end;
  2084. Function TCivicinfoAPI.GetDivisionsInstance : TDivisionsResource;
  2085. begin
  2086. if (FDivisionsInstance=Nil) then
  2087. FDivisionsInstance:=CreateDivisionsResource;
  2088. Result:=FDivisionsInstance;
  2089. end;
  2090. Function TCivicinfoAPI.CreateDivisionsResource : TDivisionsResource;
  2091. begin
  2092. Result:=CreateDivisionsResource(Self);
  2093. end;
  2094. Function TCivicinfoAPI.CreateDivisionsResource(AOwner : TComponent) : TDivisionsResource;
  2095. begin
  2096. Result:=TDivisionsResource.Create(AOwner);
  2097. Result.API:=Self.API;
  2098. end;
  2099. Function TCivicinfoAPI.GetElectionsInstance : TElectionsResource;
  2100. begin
  2101. if (FElectionsInstance=Nil) then
  2102. FElectionsInstance:=CreateElectionsResource;
  2103. Result:=FElectionsInstance;
  2104. end;
  2105. Function TCivicinfoAPI.CreateElectionsResource : TElectionsResource;
  2106. begin
  2107. Result:=CreateElectionsResource(Self);
  2108. end;
  2109. Function TCivicinfoAPI.CreateElectionsResource(AOwner : TComponent) : TElectionsResource;
  2110. begin
  2111. Result:=TElectionsResource.Create(AOwner);
  2112. Result.API:=Self.API;
  2113. end;
  2114. Function TCivicinfoAPI.GetRepresentativesInstance : TRepresentativesResource;
  2115. begin
  2116. if (FRepresentativesInstance=Nil) then
  2117. FRepresentativesInstance:=CreateRepresentativesResource;
  2118. Result:=FRepresentativesInstance;
  2119. end;
  2120. Function TCivicinfoAPI.CreateRepresentativesResource : TRepresentativesResource;
  2121. begin
  2122. Result:=CreateRepresentativesResource(Self);
  2123. end;
  2124. Function TCivicinfoAPI.CreateRepresentativesResource(AOwner : TComponent) : TRepresentativesResource;
  2125. begin
  2126. Result:=TRepresentativesResource.Create(AOwner);
  2127. Result.API:=Self.API;
  2128. end;
  2129. initialization
  2130. TCivicinfoAPI.RegisterAPI;
  2131. end.