googlecoordinate.pp 64 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435
  1. unit googlecoordinate;
  2. {
  3. **********************************************************************
  4. This file is part of the Free Component Library (FCL)
  5. Copyright (c) 2015 The free pascal team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************
  12. }
  13. //Generated on: 16-5-15 08:53:01
  14. {$MODE objfpc}
  15. {$H+}
  16. interface
  17. uses sysutils, classes, googleservice, restbase, googlebase;
  18. type
  19. //Top-level schema types
  20. TCustomField = Class;
  21. TCustomFieldDef = Class;
  22. TCustomFieldDefListResponse = Class;
  23. TCustomFields = Class;
  24. TEnumItemDef = Class;
  25. TJob = Class;
  26. TJobChange = Class;
  27. TJobListResponse = Class;
  28. TJobState = Class;
  29. TLocation = Class;
  30. TLocationListResponse = Class;
  31. TLocationRecord = Class;
  32. TSchedule = Class;
  33. TTeam = Class;
  34. TTeamListResponse = Class;
  35. TTokenPagination = Class;
  36. TWorker = Class;
  37. TWorkerListResponse = Class;
  38. TCustomFieldArray = Array of TCustomField;
  39. TCustomFieldDefArray = Array of TCustomFieldDef;
  40. TCustomFieldDefListResponseArray = Array of TCustomFieldDefListResponse;
  41. TCustomFieldsArray = Array of TCustomFields;
  42. TEnumItemDefArray = Array of TEnumItemDef;
  43. TJobArray = Array of TJob;
  44. TJobChangeArray = Array of TJobChange;
  45. TJobListResponseArray = Array of TJobListResponse;
  46. TJobStateArray = Array of TJobState;
  47. TLocationArray = Array of TLocation;
  48. TLocationListResponseArray = Array of TLocationListResponse;
  49. TLocationRecordArray = Array of TLocationRecord;
  50. TScheduleArray = Array of TSchedule;
  51. TTeamArray = Array of TTeam;
  52. TTeamListResponseArray = Array of TTeamListResponse;
  53. TTokenPaginationArray = Array of TTokenPagination;
  54. TWorkerArray = Array of TWorker;
  55. TWorkerListResponseArray = Array of TWorkerListResponse;
  56. //Anonymous types, using auto-generated names
  57. TCustomFieldDefTypeenumitemsArray = Array of TEnumItemDef;
  58. TCustomFieldDefListResponseTypeitemsArray = Array of TCustomFieldDef;
  59. TCustomFieldsTypecustomFieldArray = Array of TCustomField;
  60. TJobTypejobChangeArray = Array of TJobChange;
  61. TJobListResponseTypeitemsArray = Array of TJob;
  62. TLocationListResponseTypeitemsArray = Array of TLocationRecord;
  63. TTeamListResponseTypeitemsArray = Array of TTeam;
  64. TWorkerListResponseTypeitemsArray = Array of TWorker;
  65. { --------------------------------------------------------------------
  66. TCustomField
  67. --------------------------------------------------------------------}
  68. TCustomField = Class(TGoogleBaseObject)
  69. Private
  70. FcustomFieldId : String;
  71. Fkind : String;
  72. Fvalue : String;
  73. Protected
  74. //Property setters
  75. Procedure SetcustomFieldId(AIndex : Integer; const AValue : String); virtual;
  76. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  77. Procedure Setvalue(AIndex : Integer; const AValue : String); virtual;
  78. Public
  79. Published
  80. Property customFieldId : String Index 0 Read FcustomFieldId Write SetcustomFieldId;
  81. Property kind : String Index 8 Read Fkind Write Setkind;
  82. Property value : String Index 16 Read Fvalue Write Setvalue;
  83. end;
  84. TCustomFieldClass = Class of TCustomField;
  85. { --------------------------------------------------------------------
  86. TCustomFieldDef
  87. --------------------------------------------------------------------}
  88. TCustomFieldDef = Class(TGoogleBaseObject)
  89. Private
  90. Fenabled : boolean;
  91. Fenumitems : TCustomFieldDefTypeenumitemsArray;
  92. Fid : String;
  93. Fkind : String;
  94. Fname : String;
  95. FrequiredForCheckout : boolean;
  96. F_type : String;
  97. Protected
  98. Class Function ExportPropertyName(Const AName : String) : string; override;
  99. //Property setters
  100. Procedure Setenabled(AIndex : Integer; AValue : boolean); virtual;
  101. Procedure Setenumitems(AIndex : Integer; AValue : TCustomFieldDefTypeenumitemsArray); virtual;
  102. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  103. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  104. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  105. Procedure SetrequiredForCheckout(AIndex : Integer; AValue : boolean); virtual;
  106. Procedure Set_type(AIndex : Integer; const AValue : String); virtual;
  107. //2.6.4. bug workaround
  108. {$IFDEF VER2_6}
  109. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  110. {$ENDIF VER2_6}
  111. Public
  112. Published
  113. Property enabled : boolean Index 0 Read Fenabled Write Setenabled;
  114. Property enumitems : TCustomFieldDefTypeenumitemsArray Index 8 Read Fenumitems Write Setenumitems;
  115. Property id : String Index 16 Read Fid Write Setid;
  116. Property kind : String Index 24 Read Fkind Write Setkind;
  117. Property name : String Index 32 Read Fname Write Setname;
  118. Property requiredForCheckout : boolean Index 40 Read FrequiredForCheckout Write SetrequiredForCheckout;
  119. Property _type : String Index 48 Read F_type Write Set_type;
  120. end;
  121. TCustomFieldDefClass = Class of TCustomFieldDef;
  122. { --------------------------------------------------------------------
  123. TCustomFieldDefListResponse
  124. --------------------------------------------------------------------}
  125. TCustomFieldDefListResponse = Class(TGoogleBaseObject)
  126. Private
  127. Fitems : TCustomFieldDefListResponseTypeitemsArray;
  128. Fkind : String;
  129. Protected
  130. //Property setters
  131. Procedure Setitems(AIndex : Integer; AValue : TCustomFieldDefListResponseTypeitemsArray); virtual;
  132. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  133. //2.6.4. bug workaround
  134. {$IFDEF VER2_6}
  135. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  136. {$ENDIF VER2_6}
  137. Public
  138. Published
  139. Property items : TCustomFieldDefListResponseTypeitemsArray Index 0 Read Fitems Write Setitems;
  140. Property kind : String Index 8 Read Fkind Write Setkind;
  141. end;
  142. TCustomFieldDefListResponseClass = Class of TCustomFieldDefListResponse;
  143. { --------------------------------------------------------------------
  144. TCustomFields
  145. --------------------------------------------------------------------}
  146. TCustomFields = Class(TGoogleBaseObject)
  147. Private
  148. FcustomField : TCustomFieldsTypecustomFieldArray;
  149. Fkind : String;
  150. Protected
  151. //Property setters
  152. Procedure SetcustomField(AIndex : Integer; AValue : TCustomFieldsTypecustomFieldArray); virtual;
  153. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  154. //2.6.4. bug workaround
  155. {$IFDEF VER2_6}
  156. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  157. {$ENDIF VER2_6}
  158. Public
  159. Published
  160. Property customField : TCustomFieldsTypecustomFieldArray Index 0 Read FcustomField Write SetcustomField;
  161. Property kind : String Index 8 Read Fkind Write Setkind;
  162. end;
  163. TCustomFieldsClass = Class of TCustomFields;
  164. { --------------------------------------------------------------------
  165. TEnumItemDef
  166. --------------------------------------------------------------------}
  167. TEnumItemDef = Class(TGoogleBaseObject)
  168. Private
  169. Factive : boolean;
  170. Fkind : String;
  171. Fvalue : String;
  172. Protected
  173. //Property setters
  174. Procedure Setactive(AIndex : Integer; AValue : boolean); virtual;
  175. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  176. Procedure Setvalue(AIndex : Integer; const AValue : String); virtual;
  177. Public
  178. Published
  179. Property active : boolean Index 0 Read Factive Write Setactive;
  180. Property kind : String Index 8 Read Fkind Write Setkind;
  181. Property value : String Index 16 Read Fvalue Write Setvalue;
  182. end;
  183. TEnumItemDefClass = Class of TEnumItemDef;
  184. { --------------------------------------------------------------------
  185. TJob
  186. --------------------------------------------------------------------}
  187. TJob = Class(TGoogleBaseObject)
  188. Private
  189. Fid : String;
  190. FjobChange : TJobTypejobChangeArray;
  191. Fkind : String;
  192. Fstate : TJobState;
  193. Protected
  194. //Property setters
  195. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  196. Procedure SetjobChange(AIndex : Integer; AValue : TJobTypejobChangeArray); virtual;
  197. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  198. Procedure Setstate(AIndex : Integer; AValue : TJobState); virtual;
  199. //2.6.4. bug workaround
  200. {$IFDEF VER2_6}
  201. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  202. {$ENDIF VER2_6}
  203. Public
  204. Published
  205. Property id : String Index 0 Read Fid Write Setid;
  206. Property jobChange : TJobTypejobChangeArray Index 8 Read FjobChange Write SetjobChange;
  207. Property kind : String Index 16 Read Fkind Write Setkind;
  208. Property state : TJobState Index 24 Read Fstate Write Setstate;
  209. end;
  210. TJobClass = Class of TJob;
  211. { --------------------------------------------------------------------
  212. TJobChange
  213. --------------------------------------------------------------------}
  214. TJobChange = Class(TGoogleBaseObject)
  215. Private
  216. Fkind : String;
  217. Fstate : TJobState;
  218. Ftimestamp : String;
  219. Protected
  220. //Property setters
  221. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  222. Procedure Setstate(AIndex : Integer; AValue : TJobState); virtual;
  223. Procedure Settimestamp(AIndex : Integer; const AValue : String); virtual;
  224. Public
  225. Published
  226. Property kind : String Index 0 Read Fkind Write Setkind;
  227. Property state : TJobState Index 8 Read Fstate Write Setstate;
  228. Property timestamp : String Index 16 Read Ftimestamp Write Settimestamp;
  229. end;
  230. TJobChangeClass = Class of TJobChange;
  231. { --------------------------------------------------------------------
  232. TJobListResponse
  233. --------------------------------------------------------------------}
  234. TJobListResponse = Class(TGoogleBaseObject)
  235. Private
  236. Fitems : TJobListResponseTypeitemsArray;
  237. Fkind : String;
  238. FnextPageToken : String;
  239. Protected
  240. //Property setters
  241. Procedure Setitems(AIndex : Integer; AValue : TJobListResponseTypeitemsArray); virtual;
  242. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  243. Procedure SetnextPageToken(AIndex : Integer; const AValue : String); virtual;
  244. //2.6.4. bug workaround
  245. {$IFDEF VER2_6}
  246. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  247. {$ENDIF VER2_6}
  248. Public
  249. Published
  250. Property items : TJobListResponseTypeitemsArray Index 0 Read Fitems Write Setitems;
  251. Property kind : String Index 8 Read Fkind Write Setkind;
  252. Property nextPageToken : String Index 16 Read FnextPageToken Write SetnextPageToken;
  253. end;
  254. TJobListResponseClass = Class of TJobListResponse;
  255. { --------------------------------------------------------------------
  256. TJobState
  257. --------------------------------------------------------------------}
  258. TJobState = Class(TGoogleBaseObject)
  259. Private
  260. Fassignee : String;
  261. FcustomFields : TCustomFields;
  262. FcustomerName : String;
  263. FcustomerPhoneNumber : String;
  264. Fkind : String;
  265. Flocation : TLocation;
  266. Fnote : TStringArray;
  267. Fprogress : String;
  268. Ftitle : String;
  269. Protected
  270. //Property setters
  271. Procedure Setassignee(AIndex : Integer; const AValue : String); virtual;
  272. Procedure SetcustomFields(AIndex : Integer; AValue : TCustomFields); virtual;
  273. Procedure SetcustomerName(AIndex : Integer; const AValue : String); virtual;
  274. Procedure SetcustomerPhoneNumber(AIndex : Integer; const AValue : String); virtual;
  275. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  276. Procedure Setlocation(AIndex : Integer; AValue : TLocation); virtual;
  277. Procedure Setnote(AIndex : Integer; AValue : TStringArray); virtual;
  278. Procedure Setprogress(AIndex : Integer; const AValue : String); virtual;
  279. Procedure Settitle(AIndex : Integer; const AValue : String); virtual;
  280. //2.6.4. bug workaround
  281. {$IFDEF VER2_6}
  282. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  283. {$ENDIF VER2_6}
  284. Public
  285. Published
  286. Property assignee : String Index 0 Read Fassignee Write Setassignee;
  287. Property customFields : TCustomFields Index 8 Read FcustomFields Write SetcustomFields;
  288. Property customerName : String Index 16 Read FcustomerName Write SetcustomerName;
  289. Property customerPhoneNumber : String Index 24 Read FcustomerPhoneNumber Write SetcustomerPhoneNumber;
  290. Property kind : String Index 32 Read Fkind Write Setkind;
  291. Property location : TLocation Index 40 Read Flocation Write Setlocation;
  292. Property note : TStringArray Index 48 Read Fnote Write Setnote;
  293. Property progress : String Index 56 Read Fprogress Write Setprogress;
  294. Property title : String Index 64 Read Ftitle Write Settitle;
  295. end;
  296. TJobStateClass = Class of TJobState;
  297. { --------------------------------------------------------------------
  298. TLocation
  299. --------------------------------------------------------------------}
  300. TLocation = Class(TGoogleBaseObject)
  301. Private
  302. FaddressLine : TStringArray;
  303. Fkind : String;
  304. Flat : double;
  305. Flng : double;
  306. Protected
  307. //Property setters
  308. Procedure SetaddressLine(AIndex : Integer; AValue : TStringArray); virtual;
  309. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  310. Procedure Setlat(AIndex : Integer; AValue : double); virtual;
  311. Procedure Setlng(AIndex : Integer; AValue : double); 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 addressLine : TStringArray Index 0 Read FaddressLine Write SetaddressLine;
  319. Property kind : String Index 8 Read Fkind Write Setkind;
  320. Property lat : double Index 16 Read Flat Write Setlat;
  321. Property lng : double Index 24 Read Flng Write Setlng;
  322. end;
  323. TLocationClass = Class of TLocation;
  324. { --------------------------------------------------------------------
  325. TLocationListResponse
  326. --------------------------------------------------------------------}
  327. TLocationListResponse = Class(TGoogleBaseObject)
  328. Private
  329. Fitems : TLocationListResponseTypeitemsArray;
  330. Fkind : String;
  331. FnextPageToken : String;
  332. FtokenPagination : TTokenPagination;
  333. Protected
  334. //Property setters
  335. Procedure Setitems(AIndex : Integer; AValue : TLocationListResponseTypeitemsArray); virtual;
  336. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  337. Procedure SetnextPageToken(AIndex : Integer; const AValue : String); virtual;
  338. Procedure SettokenPagination(AIndex : Integer; AValue : TTokenPagination); virtual;
  339. //2.6.4. bug workaround
  340. {$IFDEF VER2_6}
  341. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  342. {$ENDIF VER2_6}
  343. Public
  344. Published
  345. Property items : TLocationListResponseTypeitemsArray Index 0 Read Fitems Write Setitems;
  346. Property kind : String Index 8 Read Fkind Write Setkind;
  347. Property nextPageToken : String Index 16 Read FnextPageToken Write SetnextPageToken;
  348. Property tokenPagination : TTokenPagination Index 24 Read FtokenPagination Write SettokenPagination;
  349. end;
  350. TLocationListResponseClass = Class of TLocationListResponse;
  351. { --------------------------------------------------------------------
  352. TLocationRecord
  353. --------------------------------------------------------------------}
  354. TLocationRecord = Class(TGoogleBaseObject)
  355. Private
  356. FcollectionTime : String;
  357. FconfidenceRadius : double;
  358. Fkind : String;
  359. Flatitude : double;
  360. Flongitude : double;
  361. Protected
  362. //Property setters
  363. Procedure SetcollectionTime(AIndex : Integer; const AValue : String); virtual;
  364. Procedure SetconfidenceRadius(AIndex : Integer; AValue : double); virtual;
  365. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  366. Procedure Setlatitude(AIndex : Integer; AValue : double); virtual;
  367. Procedure Setlongitude(AIndex : Integer; AValue : double); virtual;
  368. Public
  369. Published
  370. Property collectionTime : String Index 0 Read FcollectionTime Write SetcollectionTime;
  371. Property confidenceRadius : double Index 8 Read FconfidenceRadius Write SetconfidenceRadius;
  372. Property kind : String Index 16 Read Fkind Write Setkind;
  373. Property latitude : double Index 24 Read Flatitude Write Setlatitude;
  374. Property longitude : double Index 32 Read Flongitude Write Setlongitude;
  375. end;
  376. TLocationRecordClass = Class of TLocationRecord;
  377. { --------------------------------------------------------------------
  378. TSchedule
  379. --------------------------------------------------------------------}
  380. TSchedule = Class(TGoogleBaseObject)
  381. Private
  382. FallDay : boolean;
  383. Fduration : String;
  384. FendTime : String;
  385. Fkind : String;
  386. FstartTime : String;
  387. Protected
  388. //Property setters
  389. Procedure SetallDay(AIndex : Integer; AValue : boolean); virtual;
  390. Procedure Setduration(AIndex : Integer; const AValue : String); virtual;
  391. Procedure SetendTime(AIndex : Integer; const AValue : String); virtual;
  392. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  393. Procedure SetstartTime(AIndex : Integer; const AValue : String); virtual;
  394. Public
  395. Published
  396. Property allDay : boolean Index 0 Read FallDay Write SetallDay;
  397. Property duration : String Index 8 Read Fduration Write Setduration;
  398. Property endTime : String Index 16 Read FendTime Write SetendTime;
  399. Property kind : String Index 24 Read Fkind Write Setkind;
  400. Property startTime : String Index 32 Read FstartTime Write SetstartTime;
  401. end;
  402. TScheduleClass = Class of TSchedule;
  403. { --------------------------------------------------------------------
  404. TTeam
  405. --------------------------------------------------------------------}
  406. TTeam = Class(TGoogleBaseObject)
  407. Private
  408. Fid : String;
  409. Fkind : String;
  410. Fname : String;
  411. Protected
  412. //Property setters
  413. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  414. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  415. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  416. Public
  417. Published
  418. Property id : String Index 0 Read Fid Write Setid;
  419. Property kind : String Index 8 Read Fkind Write Setkind;
  420. Property name : String Index 16 Read Fname Write Setname;
  421. end;
  422. TTeamClass = Class of TTeam;
  423. { --------------------------------------------------------------------
  424. TTeamListResponse
  425. --------------------------------------------------------------------}
  426. TTeamListResponse = Class(TGoogleBaseObject)
  427. Private
  428. Fitems : TTeamListResponseTypeitemsArray;
  429. Fkind : String;
  430. Protected
  431. //Property setters
  432. Procedure Setitems(AIndex : Integer; AValue : TTeamListResponseTypeitemsArray); virtual;
  433. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  434. //2.6.4. bug workaround
  435. {$IFDEF VER2_6}
  436. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  437. {$ENDIF VER2_6}
  438. Public
  439. Published
  440. Property items : TTeamListResponseTypeitemsArray Index 0 Read Fitems Write Setitems;
  441. Property kind : String Index 8 Read Fkind Write Setkind;
  442. end;
  443. TTeamListResponseClass = Class of TTeamListResponse;
  444. { --------------------------------------------------------------------
  445. TTokenPagination
  446. --------------------------------------------------------------------}
  447. TTokenPagination = Class(TGoogleBaseObject)
  448. Private
  449. Fkind : String;
  450. FnextPageToken : String;
  451. FpreviousPageToken : String;
  452. Protected
  453. //Property setters
  454. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  455. Procedure SetnextPageToken(AIndex : Integer; const AValue : String); virtual;
  456. Procedure SetpreviousPageToken(AIndex : Integer; const AValue : String); virtual;
  457. Public
  458. Published
  459. Property kind : String Index 0 Read Fkind Write Setkind;
  460. Property nextPageToken : String Index 8 Read FnextPageToken Write SetnextPageToken;
  461. Property previousPageToken : String Index 16 Read FpreviousPageToken Write SetpreviousPageToken;
  462. end;
  463. TTokenPaginationClass = Class of TTokenPagination;
  464. { --------------------------------------------------------------------
  465. TWorker
  466. --------------------------------------------------------------------}
  467. TWorker = Class(TGoogleBaseObject)
  468. Private
  469. Fid : String;
  470. Fkind : String;
  471. Protected
  472. //Property setters
  473. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  474. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  475. Public
  476. Published
  477. Property id : String Index 0 Read Fid Write Setid;
  478. Property kind : String Index 8 Read Fkind Write Setkind;
  479. end;
  480. TWorkerClass = Class of TWorker;
  481. { --------------------------------------------------------------------
  482. TWorkerListResponse
  483. --------------------------------------------------------------------}
  484. TWorkerListResponse = Class(TGoogleBaseObject)
  485. Private
  486. Fitems : TWorkerListResponseTypeitemsArray;
  487. Fkind : String;
  488. Protected
  489. //Property setters
  490. Procedure Setitems(AIndex : Integer; AValue : TWorkerListResponseTypeitemsArray); virtual;
  491. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  492. //2.6.4. bug workaround
  493. {$IFDEF VER2_6}
  494. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  495. {$ENDIF VER2_6}
  496. Public
  497. Published
  498. Property items : TWorkerListResponseTypeitemsArray Index 0 Read Fitems Write Setitems;
  499. Property kind : String Index 8 Read Fkind Write Setkind;
  500. end;
  501. TWorkerListResponseClass = Class of TWorkerListResponse;
  502. { --------------------------------------------------------------------
  503. TCustomFieldDefResource
  504. --------------------------------------------------------------------}
  505. TCustomFieldDefResource = Class(TGoogleResource)
  506. Public
  507. Class Function ResourceName : String; override;
  508. Class Function DefaultAPI : TGoogleAPIClass; override;
  509. Function List(teamId: string) : TCustomFieldDefListResponse;
  510. end;
  511. { --------------------------------------------------------------------
  512. TJobsResource
  513. --------------------------------------------------------------------}
  514. //Optional query Options for TJobsResource, method Insert
  515. TJobsInsertOptions = Record
  516. address : String;
  517. assignee : String;
  518. customField : String;
  519. customerName : String;
  520. customerPhoneNumber : String;
  521. lat : double;
  522. lng : double;
  523. note : String;
  524. title : String;
  525. end;
  526. //Optional query Options for TJobsResource, method List
  527. TJobsListOptions = Record
  528. maxResults : integer;
  529. minModifiedTimestampMs : String;
  530. pageToken : String;
  531. end;
  532. //Optional query Options for TJobsResource, method Patch
  533. TJobsPatchOptions = Record
  534. address : String;
  535. assignee : String;
  536. customField : String;
  537. customerName : String;
  538. customerPhoneNumber : String;
  539. lat : double;
  540. lng : double;
  541. note : String;
  542. progress : String;
  543. title : String;
  544. end;
  545. //Optional query Options for TJobsResource, method Update
  546. TJobsUpdateOptions = Record
  547. address : String;
  548. assignee : String;
  549. customField : String;
  550. customerName : String;
  551. customerPhoneNumber : String;
  552. lat : double;
  553. lng : double;
  554. note : String;
  555. progress : String;
  556. title : String;
  557. end;
  558. TJobsResource = Class(TGoogleResource)
  559. Public
  560. Class Function ResourceName : String; override;
  561. Class Function DefaultAPI : TGoogleAPIClass; override;
  562. Function Get(jobId: string; teamId: string) : TJob;
  563. Function Insert(teamId: string; aJob : TJob; AQuery : string = '') : TJob;
  564. Function Insert(teamId: string; aJob : TJob; AQuery : TJobsinsertOptions) : TJob;
  565. Function List(teamId: string; AQuery : string = '') : TJobListResponse;
  566. Function List(teamId: string; AQuery : TJobslistOptions) : TJobListResponse;
  567. Function Patch(jobId: string; teamId: string; aJob : TJob; AQuery : string = '') : TJob;
  568. Function Patch(jobId: string; teamId: string; aJob : TJob; AQuery : TJobspatchOptions) : TJob;
  569. Function Update(jobId: string; teamId: string; aJob : TJob; AQuery : string = '') : TJob;
  570. Function Update(jobId: string; teamId: string; aJob : TJob; AQuery : TJobsupdateOptions) : TJob;
  571. end;
  572. { --------------------------------------------------------------------
  573. TLocationResource
  574. --------------------------------------------------------------------}
  575. //Optional query Options for TLocationResource, method List
  576. TLocationListOptions = Record
  577. maxResults : integer;
  578. pageToken : String;
  579. startTimestampMs : String;
  580. end;
  581. TLocationResource = Class(TGoogleResource)
  582. Public
  583. Class Function ResourceName : String; override;
  584. Class Function DefaultAPI : TGoogleAPIClass; override;
  585. Function List(teamId: string; workerEmail: string; AQuery : string = '') : TLocationListResponse;
  586. Function List(teamId: string; workerEmail: string; AQuery : TLocationlistOptions) : TLocationListResponse;
  587. end;
  588. { --------------------------------------------------------------------
  589. TScheduleResource
  590. --------------------------------------------------------------------}
  591. //Optional query Options for TScheduleResource, method Patch
  592. TSchedulePatchOptions = Record
  593. allDay : boolean;
  594. duration : String;
  595. endTime : String;
  596. startTime : String;
  597. end;
  598. //Optional query Options for TScheduleResource, method Update
  599. TScheduleUpdateOptions = Record
  600. allDay : boolean;
  601. duration : String;
  602. endTime : String;
  603. startTime : String;
  604. end;
  605. TScheduleResource = Class(TGoogleResource)
  606. Public
  607. Class Function ResourceName : String; override;
  608. Class Function DefaultAPI : TGoogleAPIClass; override;
  609. Function Get(jobId: string; teamId: string) : TSchedule;
  610. Function Patch(jobId: string; teamId: string; aSchedule : TSchedule; AQuery : string = '') : TSchedule;
  611. Function Patch(jobId: string; teamId: string; aSchedule : TSchedule; AQuery : TSchedulepatchOptions) : TSchedule;
  612. Function Update(jobId: string; teamId: string; aSchedule : TSchedule; AQuery : string = '') : TSchedule;
  613. Function Update(jobId: string; teamId: string; aSchedule : TSchedule; AQuery : TScheduleupdateOptions) : TSchedule;
  614. end;
  615. { --------------------------------------------------------------------
  616. TTeamResource
  617. --------------------------------------------------------------------}
  618. //Optional query Options for TTeamResource, method List
  619. TTeamListOptions = Record
  620. admin : boolean;
  621. dispatcher : boolean;
  622. worker : boolean;
  623. end;
  624. TTeamResource = Class(TGoogleResource)
  625. Public
  626. Class Function ResourceName : String; override;
  627. Class Function DefaultAPI : TGoogleAPIClass; override;
  628. Function List(AQuery : string = '') : TTeamListResponse;
  629. Function List(AQuery : TTeamlistOptions) : TTeamListResponse;
  630. end;
  631. { --------------------------------------------------------------------
  632. TWorkerResource
  633. --------------------------------------------------------------------}
  634. TWorkerResource = Class(TGoogleResource)
  635. Public
  636. Class Function ResourceName : String; override;
  637. Class Function DefaultAPI : TGoogleAPIClass; override;
  638. Function List(teamId: string) : TWorkerListResponse;
  639. end;
  640. { --------------------------------------------------------------------
  641. TCoordinateAPI
  642. --------------------------------------------------------------------}
  643. TCoordinateAPI = Class(TGoogleAPI)
  644. Private
  645. FCustomFieldDefInstance : TCustomFieldDefResource;
  646. FJobsInstance : TJobsResource;
  647. FLocationInstance : TLocationResource;
  648. FScheduleInstance : TScheduleResource;
  649. FTeamInstance : TTeamResource;
  650. FWorkerInstance : TWorkerResource;
  651. Function GetCustomFieldDefInstance : TCustomFieldDefResource;virtual;
  652. Function GetJobsInstance : TJobsResource;virtual;
  653. Function GetLocationInstance : TLocationResource;virtual;
  654. Function GetScheduleInstance : TScheduleResource;virtual;
  655. Function GetTeamInstance : TTeamResource;virtual;
  656. Function GetWorkerInstance : TWorkerResource;virtual;
  657. Public
  658. //Override class functions with API info
  659. Class Function APIName : String; override;
  660. Class Function APIVersion : String; override;
  661. Class Function APIRevision : String; override;
  662. Class Function APIID : String; override;
  663. Class Function APITitle : String; override;
  664. Class Function APIDescription : String; override;
  665. Class Function APIOwnerDomain : String; override;
  666. Class Function APIOwnerName : String; override;
  667. Class Function APIIcon16 : String; override;
  668. Class Function APIIcon32 : String; override;
  669. Class Function APIdocumentationLink : String; override;
  670. Class Function APIrootUrl : string; override;
  671. Class Function APIbasePath : string;override;
  672. Class Function APIbaseURL : String;override;
  673. Class Function APIProtocol : string;override;
  674. Class Function APIservicePath : string;override;
  675. Class Function APIbatchPath : String;override;
  676. Class Function APIAuthScopes : TScopeInfoArray;override;
  677. Class Function APINeedsAuth : Boolean;override;
  678. Class Procedure RegisterAPIResources; override;
  679. //Add create function for resources
  680. Function CreateCustomFieldDefResource(AOwner : TComponent) : TCustomFieldDefResource;virtual;overload;
  681. Function CreateCustomFieldDefResource : TCustomFieldDefResource;virtual;overload;
  682. Function CreateJobsResource(AOwner : TComponent) : TJobsResource;virtual;overload;
  683. Function CreateJobsResource : TJobsResource;virtual;overload;
  684. Function CreateLocationResource(AOwner : TComponent) : TLocationResource;virtual;overload;
  685. Function CreateLocationResource : TLocationResource;virtual;overload;
  686. Function CreateScheduleResource(AOwner : TComponent) : TScheduleResource;virtual;overload;
  687. Function CreateScheduleResource : TScheduleResource;virtual;overload;
  688. Function CreateTeamResource(AOwner : TComponent) : TTeamResource;virtual;overload;
  689. Function CreateTeamResource : TTeamResource;virtual;overload;
  690. Function CreateWorkerResource(AOwner : TComponent) : TWorkerResource;virtual;overload;
  691. Function CreateWorkerResource : TWorkerResource;virtual;overload;
  692. //Add default on-demand instances for resources
  693. Property CustomFieldDefResource : TCustomFieldDefResource Read GetCustomFieldDefInstance;
  694. Property JobsResource : TJobsResource Read GetJobsInstance;
  695. Property LocationResource : TLocationResource Read GetLocationInstance;
  696. Property ScheduleResource : TScheduleResource Read GetScheduleInstance;
  697. Property TeamResource : TTeamResource Read GetTeamInstance;
  698. Property WorkerResource : TWorkerResource Read GetWorkerInstance;
  699. end;
  700. implementation
  701. { --------------------------------------------------------------------
  702. TCustomField
  703. --------------------------------------------------------------------}
  704. Procedure TCustomField.SetcustomFieldId(AIndex : Integer; const AValue : String);
  705. begin
  706. If (FcustomFieldId=AValue) then exit;
  707. FcustomFieldId:=AValue;
  708. MarkPropertyChanged(AIndex);
  709. end;
  710. Procedure TCustomField.Setkind(AIndex : Integer; const AValue : String);
  711. begin
  712. If (Fkind=AValue) then exit;
  713. Fkind:=AValue;
  714. MarkPropertyChanged(AIndex);
  715. end;
  716. Procedure TCustomField.Setvalue(AIndex : Integer; const AValue : String);
  717. begin
  718. If (Fvalue=AValue) then exit;
  719. Fvalue:=AValue;
  720. MarkPropertyChanged(AIndex);
  721. end;
  722. { --------------------------------------------------------------------
  723. TCustomFieldDef
  724. --------------------------------------------------------------------}
  725. Procedure TCustomFieldDef.Setenabled(AIndex : Integer; AValue : boolean);
  726. begin
  727. If (Fenabled=AValue) then exit;
  728. Fenabled:=AValue;
  729. MarkPropertyChanged(AIndex);
  730. end;
  731. Procedure TCustomFieldDef.Setenumitems(AIndex : Integer; AValue : TCustomFieldDefTypeenumitemsArray);
  732. begin
  733. If (Fenumitems=AValue) then exit;
  734. Fenumitems:=AValue;
  735. MarkPropertyChanged(AIndex);
  736. end;
  737. Procedure TCustomFieldDef.Setid(AIndex : Integer; const AValue : String);
  738. begin
  739. If (Fid=AValue) then exit;
  740. Fid:=AValue;
  741. MarkPropertyChanged(AIndex);
  742. end;
  743. Procedure TCustomFieldDef.Setkind(AIndex : Integer; const AValue : String);
  744. begin
  745. If (Fkind=AValue) then exit;
  746. Fkind:=AValue;
  747. MarkPropertyChanged(AIndex);
  748. end;
  749. Procedure TCustomFieldDef.Setname(AIndex : Integer; const AValue : String);
  750. begin
  751. If (Fname=AValue) then exit;
  752. Fname:=AValue;
  753. MarkPropertyChanged(AIndex);
  754. end;
  755. Procedure TCustomFieldDef.SetrequiredForCheckout(AIndex : Integer; AValue : boolean);
  756. begin
  757. If (FrequiredForCheckout=AValue) then exit;
  758. FrequiredForCheckout:=AValue;
  759. MarkPropertyChanged(AIndex);
  760. end;
  761. Procedure TCustomFieldDef.Set_type(AIndex : Integer; const AValue : String);
  762. begin
  763. If (F_type=AValue) then exit;
  764. F_type:=AValue;
  765. MarkPropertyChanged(AIndex);
  766. end;
  767. Class Function TCustomFieldDef.ExportPropertyName(Const AName : String) :String;
  768. begin
  769. Case AName of
  770. '_type' : Result:='type';
  771. else
  772. Result:=Inherited ExportPropertyName(AName);
  773. end;
  774. end;
  775. //2.6.4. bug workaround
  776. {$IFDEF VER2_6}
  777. Procedure TCustomFieldDef.SetArrayLength(Const AName : String; ALength : Longint);
  778. begin
  779. Case AName of
  780. 'enumitems' : SetLength(Fenumitems,ALength);
  781. else
  782. Inherited SetArrayLength(AName,ALength);
  783. end;
  784. end;
  785. {$ENDIF VER2_6}
  786. { --------------------------------------------------------------------
  787. TCustomFieldDefListResponse
  788. --------------------------------------------------------------------}
  789. Procedure TCustomFieldDefListResponse.Setitems(AIndex : Integer; AValue : TCustomFieldDefListResponseTypeitemsArray);
  790. begin
  791. If (Fitems=AValue) then exit;
  792. Fitems:=AValue;
  793. MarkPropertyChanged(AIndex);
  794. end;
  795. Procedure TCustomFieldDefListResponse.Setkind(AIndex : Integer; const AValue : String);
  796. begin
  797. If (Fkind=AValue) then exit;
  798. Fkind:=AValue;
  799. MarkPropertyChanged(AIndex);
  800. end;
  801. //2.6.4. bug workaround
  802. {$IFDEF VER2_6}
  803. Procedure TCustomFieldDefListResponse.SetArrayLength(Const AName : String; ALength : Longint);
  804. begin
  805. Case AName of
  806. 'items' : SetLength(Fitems,ALength);
  807. else
  808. Inherited SetArrayLength(AName,ALength);
  809. end;
  810. end;
  811. {$ENDIF VER2_6}
  812. { --------------------------------------------------------------------
  813. TCustomFields
  814. --------------------------------------------------------------------}
  815. Procedure TCustomFields.SetcustomField(AIndex : Integer; AValue : TCustomFieldsTypecustomFieldArray);
  816. begin
  817. If (FcustomField=AValue) then exit;
  818. FcustomField:=AValue;
  819. MarkPropertyChanged(AIndex);
  820. end;
  821. Procedure TCustomFields.Setkind(AIndex : Integer; const AValue : String);
  822. begin
  823. If (Fkind=AValue) then exit;
  824. Fkind:=AValue;
  825. MarkPropertyChanged(AIndex);
  826. end;
  827. //2.6.4. bug workaround
  828. {$IFDEF VER2_6}
  829. Procedure TCustomFields.SetArrayLength(Const AName : String; ALength : Longint);
  830. begin
  831. Case AName of
  832. 'customfield' : SetLength(FcustomField,ALength);
  833. else
  834. Inherited SetArrayLength(AName,ALength);
  835. end;
  836. end;
  837. {$ENDIF VER2_6}
  838. { --------------------------------------------------------------------
  839. TEnumItemDef
  840. --------------------------------------------------------------------}
  841. Procedure TEnumItemDef.Setactive(AIndex : Integer; AValue : boolean);
  842. begin
  843. If (Factive=AValue) then exit;
  844. Factive:=AValue;
  845. MarkPropertyChanged(AIndex);
  846. end;
  847. Procedure TEnumItemDef.Setkind(AIndex : Integer; const AValue : String);
  848. begin
  849. If (Fkind=AValue) then exit;
  850. Fkind:=AValue;
  851. MarkPropertyChanged(AIndex);
  852. end;
  853. Procedure TEnumItemDef.Setvalue(AIndex : Integer; const AValue : String);
  854. begin
  855. If (Fvalue=AValue) then exit;
  856. Fvalue:=AValue;
  857. MarkPropertyChanged(AIndex);
  858. end;
  859. { --------------------------------------------------------------------
  860. TJob
  861. --------------------------------------------------------------------}
  862. Procedure TJob.Setid(AIndex : Integer; const AValue : String);
  863. begin
  864. If (Fid=AValue) then exit;
  865. Fid:=AValue;
  866. MarkPropertyChanged(AIndex);
  867. end;
  868. Procedure TJob.SetjobChange(AIndex : Integer; AValue : TJobTypejobChangeArray);
  869. begin
  870. If (FjobChange=AValue) then exit;
  871. FjobChange:=AValue;
  872. MarkPropertyChanged(AIndex);
  873. end;
  874. Procedure TJob.Setkind(AIndex : Integer; const AValue : String);
  875. begin
  876. If (Fkind=AValue) then exit;
  877. Fkind:=AValue;
  878. MarkPropertyChanged(AIndex);
  879. end;
  880. Procedure TJob.Setstate(AIndex : Integer; AValue : TJobState);
  881. begin
  882. If (Fstate=AValue) then exit;
  883. Fstate:=AValue;
  884. MarkPropertyChanged(AIndex);
  885. end;
  886. //2.6.4. bug workaround
  887. {$IFDEF VER2_6}
  888. Procedure TJob.SetArrayLength(Const AName : String; ALength : Longint);
  889. begin
  890. Case AName of
  891. 'jobchange' : SetLength(FjobChange,ALength);
  892. else
  893. Inherited SetArrayLength(AName,ALength);
  894. end;
  895. end;
  896. {$ENDIF VER2_6}
  897. { --------------------------------------------------------------------
  898. TJobChange
  899. --------------------------------------------------------------------}
  900. Procedure TJobChange.Setkind(AIndex : Integer; const AValue : String);
  901. begin
  902. If (Fkind=AValue) then exit;
  903. Fkind:=AValue;
  904. MarkPropertyChanged(AIndex);
  905. end;
  906. Procedure TJobChange.Setstate(AIndex : Integer; AValue : TJobState);
  907. begin
  908. If (Fstate=AValue) then exit;
  909. Fstate:=AValue;
  910. MarkPropertyChanged(AIndex);
  911. end;
  912. Procedure TJobChange.Settimestamp(AIndex : Integer; const AValue : String);
  913. begin
  914. If (Ftimestamp=AValue) then exit;
  915. Ftimestamp:=AValue;
  916. MarkPropertyChanged(AIndex);
  917. end;
  918. { --------------------------------------------------------------------
  919. TJobListResponse
  920. --------------------------------------------------------------------}
  921. Procedure TJobListResponse.Setitems(AIndex : Integer; AValue : TJobListResponseTypeitemsArray);
  922. begin
  923. If (Fitems=AValue) then exit;
  924. Fitems:=AValue;
  925. MarkPropertyChanged(AIndex);
  926. end;
  927. Procedure TJobListResponse.Setkind(AIndex : Integer; const AValue : String);
  928. begin
  929. If (Fkind=AValue) then exit;
  930. Fkind:=AValue;
  931. MarkPropertyChanged(AIndex);
  932. end;
  933. Procedure TJobListResponse.SetnextPageToken(AIndex : Integer; const AValue : String);
  934. begin
  935. If (FnextPageToken=AValue) then exit;
  936. FnextPageToken:=AValue;
  937. MarkPropertyChanged(AIndex);
  938. end;
  939. //2.6.4. bug workaround
  940. {$IFDEF VER2_6}
  941. Procedure TJobListResponse.SetArrayLength(Const AName : String; ALength : Longint);
  942. begin
  943. Case AName of
  944. 'items' : SetLength(Fitems,ALength);
  945. else
  946. Inherited SetArrayLength(AName,ALength);
  947. end;
  948. end;
  949. {$ENDIF VER2_6}
  950. { --------------------------------------------------------------------
  951. TJobState
  952. --------------------------------------------------------------------}
  953. Procedure TJobState.Setassignee(AIndex : Integer; const AValue : String);
  954. begin
  955. If (Fassignee=AValue) then exit;
  956. Fassignee:=AValue;
  957. MarkPropertyChanged(AIndex);
  958. end;
  959. Procedure TJobState.SetcustomFields(AIndex : Integer; AValue : TCustomFields);
  960. begin
  961. If (FcustomFields=AValue) then exit;
  962. FcustomFields:=AValue;
  963. MarkPropertyChanged(AIndex);
  964. end;
  965. Procedure TJobState.SetcustomerName(AIndex : Integer; const AValue : String);
  966. begin
  967. If (FcustomerName=AValue) then exit;
  968. FcustomerName:=AValue;
  969. MarkPropertyChanged(AIndex);
  970. end;
  971. Procedure TJobState.SetcustomerPhoneNumber(AIndex : Integer; const AValue : String);
  972. begin
  973. If (FcustomerPhoneNumber=AValue) then exit;
  974. FcustomerPhoneNumber:=AValue;
  975. MarkPropertyChanged(AIndex);
  976. end;
  977. Procedure TJobState.Setkind(AIndex : Integer; const AValue : String);
  978. begin
  979. If (Fkind=AValue) then exit;
  980. Fkind:=AValue;
  981. MarkPropertyChanged(AIndex);
  982. end;
  983. Procedure TJobState.Setlocation(AIndex : Integer; AValue : TLocation);
  984. begin
  985. If (Flocation=AValue) then exit;
  986. Flocation:=AValue;
  987. MarkPropertyChanged(AIndex);
  988. end;
  989. Procedure TJobState.Setnote(AIndex : Integer; AValue : TStringArray);
  990. begin
  991. If (Fnote=AValue) then exit;
  992. Fnote:=AValue;
  993. MarkPropertyChanged(AIndex);
  994. end;
  995. Procedure TJobState.Setprogress(AIndex : Integer; const AValue : String);
  996. begin
  997. If (Fprogress=AValue) then exit;
  998. Fprogress:=AValue;
  999. MarkPropertyChanged(AIndex);
  1000. end;
  1001. Procedure TJobState.Settitle(AIndex : Integer; const AValue : String);
  1002. begin
  1003. If (Ftitle=AValue) then exit;
  1004. Ftitle:=AValue;
  1005. MarkPropertyChanged(AIndex);
  1006. end;
  1007. //2.6.4. bug workaround
  1008. {$IFDEF VER2_6}
  1009. Procedure TJobState.SetArrayLength(Const AName : String; ALength : Longint);
  1010. begin
  1011. Case AName of
  1012. 'note' : SetLength(Fnote,ALength);
  1013. else
  1014. Inherited SetArrayLength(AName,ALength);
  1015. end;
  1016. end;
  1017. {$ENDIF VER2_6}
  1018. { --------------------------------------------------------------------
  1019. TLocation
  1020. --------------------------------------------------------------------}
  1021. Procedure TLocation.SetaddressLine(AIndex : Integer; AValue : TStringArray);
  1022. begin
  1023. If (FaddressLine=AValue) then exit;
  1024. FaddressLine:=AValue;
  1025. MarkPropertyChanged(AIndex);
  1026. end;
  1027. Procedure TLocation.Setkind(AIndex : Integer; const AValue : String);
  1028. begin
  1029. If (Fkind=AValue) then exit;
  1030. Fkind:=AValue;
  1031. MarkPropertyChanged(AIndex);
  1032. end;
  1033. Procedure TLocation.Setlat(AIndex : Integer; AValue : double);
  1034. begin
  1035. If (Flat=AValue) then exit;
  1036. Flat:=AValue;
  1037. MarkPropertyChanged(AIndex);
  1038. end;
  1039. Procedure TLocation.Setlng(AIndex : Integer; AValue : double);
  1040. begin
  1041. If (Flng=AValue) then exit;
  1042. Flng:=AValue;
  1043. MarkPropertyChanged(AIndex);
  1044. end;
  1045. //2.6.4. bug workaround
  1046. {$IFDEF VER2_6}
  1047. Procedure TLocation.SetArrayLength(Const AName : String; ALength : Longint);
  1048. begin
  1049. Case AName of
  1050. 'addressline' : SetLength(FaddressLine,ALength);
  1051. else
  1052. Inherited SetArrayLength(AName,ALength);
  1053. end;
  1054. end;
  1055. {$ENDIF VER2_6}
  1056. { --------------------------------------------------------------------
  1057. TLocationListResponse
  1058. --------------------------------------------------------------------}
  1059. Procedure TLocationListResponse.Setitems(AIndex : Integer; AValue : TLocationListResponseTypeitemsArray);
  1060. begin
  1061. If (Fitems=AValue) then exit;
  1062. Fitems:=AValue;
  1063. MarkPropertyChanged(AIndex);
  1064. end;
  1065. Procedure TLocationListResponse.Setkind(AIndex : Integer; const AValue : String);
  1066. begin
  1067. If (Fkind=AValue) then exit;
  1068. Fkind:=AValue;
  1069. MarkPropertyChanged(AIndex);
  1070. end;
  1071. Procedure TLocationListResponse.SetnextPageToken(AIndex : Integer; const AValue : String);
  1072. begin
  1073. If (FnextPageToken=AValue) then exit;
  1074. FnextPageToken:=AValue;
  1075. MarkPropertyChanged(AIndex);
  1076. end;
  1077. Procedure TLocationListResponse.SettokenPagination(AIndex : Integer; AValue : TTokenPagination);
  1078. begin
  1079. If (FtokenPagination=AValue) then exit;
  1080. FtokenPagination:=AValue;
  1081. MarkPropertyChanged(AIndex);
  1082. end;
  1083. //2.6.4. bug workaround
  1084. {$IFDEF VER2_6}
  1085. Procedure TLocationListResponse.SetArrayLength(Const AName : String; ALength : Longint);
  1086. begin
  1087. Case AName of
  1088. 'items' : SetLength(Fitems,ALength);
  1089. else
  1090. Inherited SetArrayLength(AName,ALength);
  1091. end;
  1092. end;
  1093. {$ENDIF VER2_6}
  1094. { --------------------------------------------------------------------
  1095. TLocationRecord
  1096. --------------------------------------------------------------------}
  1097. Procedure TLocationRecord.SetcollectionTime(AIndex : Integer; const AValue : String);
  1098. begin
  1099. If (FcollectionTime=AValue) then exit;
  1100. FcollectionTime:=AValue;
  1101. MarkPropertyChanged(AIndex);
  1102. end;
  1103. Procedure TLocationRecord.SetconfidenceRadius(AIndex : Integer; AValue : double);
  1104. begin
  1105. If (FconfidenceRadius=AValue) then exit;
  1106. FconfidenceRadius:=AValue;
  1107. MarkPropertyChanged(AIndex);
  1108. end;
  1109. Procedure TLocationRecord.Setkind(AIndex : Integer; const AValue : String);
  1110. begin
  1111. If (Fkind=AValue) then exit;
  1112. Fkind:=AValue;
  1113. MarkPropertyChanged(AIndex);
  1114. end;
  1115. Procedure TLocationRecord.Setlatitude(AIndex : Integer; AValue : double);
  1116. begin
  1117. If (Flatitude=AValue) then exit;
  1118. Flatitude:=AValue;
  1119. MarkPropertyChanged(AIndex);
  1120. end;
  1121. Procedure TLocationRecord.Setlongitude(AIndex : Integer; AValue : double);
  1122. begin
  1123. If (Flongitude=AValue) then exit;
  1124. Flongitude:=AValue;
  1125. MarkPropertyChanged(AIndex);
  1126. end;
  1127. { --------------------------------------------------------------------
  1128. TSchedule
  1129. --------------------------------------------------------------------}
  1130. Procedure TSchedule.SetallDay(AIndex : Integer; AValue : boolean);
  1131. begin
  1132. If (FallDay=AValue) then exit;
  1133. FallDay:=AValue;
  1134. MarkPropertyChanged(AIndex);
  1135. end;
  1136. Procedure TSchedule.Setduration(AIndex : Integer; const AValue : String);
  1137. begin
  1138. If (Fduration=AValue) then exit;
  1139. Fduration:=AValue;
  1140. MarkPropertyChanged(AIndex);
  1141. end;
  1142. Procedure TSchedule.SetendTime(AIndex : Integer; const AValue : String);
  1143. begin
  1144. If (FendTime=AValue) then exit;
  1145. FendTime:=AValue;
  1146. MarkPropertyChanged(AIndex);
  1147. end;
  1148. Procedure TSchedule.Setkind(AIndex : Integer; const AValue : String);
  1149. begin
  1150. If (Fkind=AValue) then exit;
  1151. Fkind:=AValue;
  1152. MarkPropertyChanged(AIndex);
  1153. end;
  1154. Procedure TSchedule.SetstartTime(AIndex : Integer; const AValue : String);
  1155. begin
  1156. If (FstartTime=AValue) then exit;
  1157. FstartTime:=AValue;
  1158. MarkPropertyChanged(AIndex);
  1159. end;
  1160. { --------------------------------------------------------------------
  1161. TTeam
  1162. --------------------------------------------------------------------}
  1163. Procedure TTeam.Setid(AIndex : Integer; const AValue : String);
  1164. begin
  1165. If (Fid=AValue) then exit;
  1166. Fid:=AValue;
  1167. MarkPropertyChanged(AIndex);
  1168. end;
  1169. Procedure TTeam.Setkind(AIndex : Integer; const AValue : String);
  1170. begin
  1171. If (Fkind=AValue) then exit;
  1172. Fkind:=AValue;
  1173. MarkPropertyChanged(AIndex);
  1174. end;
  1175. Procedure TTeam.Setname(AIndex : Integer; const AValue : String);
  1176. begin
  1177. If (Fname=AValue) then exit;
  1178. Fname:=AValue;
  1179. MarkPropertyChanged(AIndex);
  1180. end;
  1181. { --------------------------------------------------------------------
  1182. TTeamListResponse
  1183. --------------------------------------------------------------------}
  1184. Procedure TTeamListResponse.Setitems(AIndex : Integer; AValue : TTeamListResponseTypeitemsArray);
  1185. begin
  1186. If (Fitems=AValue) then exit;
  1187. Fitems:=AValue;
  1188. MarkPropertyChanged(AIndex);
  1189. end;
  1190. Procedure TTeamListResponse.Setkind(AIndex : Integer; const AValue : String);
  1191. begin
  1192. If (Fkind=AValue) then exit;
  1193. Fkind:=AValue;
  1194. MarkPropertyChanged(AIndex);
  1195. end;
  1196. //2.6.4. bug workaround
  1197. {$IFDEF VER2_6}
  1198. Procedure TTeamListResponse.SetArrayLength(Const AName : String; ALength : Longint);
  1199. begin
  1200. Case AName of
  1201. 'items' : SetLength(Fitems,ALength);
  1202. else
  1203. Inherited SetArrayLength(AName,ALength);
  1204. end;
  1205. end;
  1206. {$ENDIF VER2_6}
  1207. { --------------------------------------------------------------------
  1208. TTokenPagination
  1209. --------------------------------------------------------------------}
  1210. Procedure TTokenPagination.Setkind(AIndex : Integer; const AValue : String);
  1211. begin
  1212. If (Fkind=AValue) then exit;
  1213. Fkind:=AValue;
  1214. MarkPropertyChanged(AIndex);
  1215. end;
  1216. Procedure TTokenPagination.SetnextPageToken(AIndex : Integer; const AValue : String);
  1217. begin
  1218. If (FnextPageToken=AValue) then exit;
  1219. FnextPageToken:=AValue;
  1220. MarkPropertyChanged(AIndex);
  1221. end;
  1222. Procedure TTokenPagination.SetpreviousPageToken(AIndex : Integer; const AValue : String);
  1223. begin
  1224. If (FpreviousPageToken=AValue) then exit;
  1225. FpreviousPageToken:=AValue;
  1226. MarkPropertyChanged(AIndex);
  1227. end;
  1228. { --------------------------------------------------------------------
  1229. TWorker
  1230. --------------------------------------------------------------------}
  1231. Procedure TWorker.Setid(AIndex : Integer; const AValue : String);
  1232. begin
  1233. If (Fid=AValue) then exit;
  1234. Fid:=AValue;
  1235. MarkPropertyChanged(AIndex);
  1236. end;
  1237. Procedure TWorker.Setkind(AIndex : Integer; const AValue : String);
  1238. begin
  1239. If (Fkind=AValue) then exit;
  1240. Fkind:=AValue;
  1241. MarkPropertyChanged(AIndex);
  1242. end;
  1243. { --------------------------------------------------------------------
  1244. TWorkerListResponse
  1245. --------------------------------------------------------------------}
  1246. Procedure TWorkerListResponse.Setitems(AIndex : Integer; AValue : TWorkerListResponseTypeitemsArray);
  1247. begin
  1248. If (Fitems=AValue) then exit;
  1249. Fitems:=AValue;
  1250. MarkPropertyChanged(AIndex);
  1251. end;
  1252. Procedure TWorkerListResponse.Setkind(AIndex : Integer; const AValue : String);
  1253. begin
  1254. If (Fkind=AValue) then exit;
  1255. Fkind:=AValue;
  1256. MarkPropertyChanged(AIndex);
  1257. end;
  1258. //2.6.4. bug workaround
  1259. {$IFDEF VER2_6}
  1260. Procedure TWorkerListResponse.SetArrayLength(Const AName : String; ALength : Longint);
  1261. begin
  1262. Case AName of
  1263. 'items' : SetLength(Fitems,ALength);
  1264. else
  1265. Inherited SetArrayLength(AName,ALength);
  1266. end;
  1267. end;
  1268. {$ENDIF VER2_6}
  1269. { --------------------------------------------------------------------
  1270. TCustomFieldDefResource
  1271. --------------------------------------------------------------------}
  1272. Class Function TCustomFieldDefResource.ResourceName : String;
  1273. begin
  1274. Result:='customFieldDef';
  1275. end;
  1276. Class Function TCustomFieldDefResource.DefaultAPI : TGoogleAPIClass;
  1277. begin
  1278. Result:=TcoordinateAPI;
  1279. end;
  1280. Function TCustomFieldDefResource.List(teamId: string) : TCustomFieldDefListResponse;
  1281. Const
  1282. _HTTPMethod = 'GET';
  1283. _Path = 'teams/{teamId}/custom_fields';
  1284. _Methodid = 'coordinate.customFieldDef.list';
  1285. Var
  1286. _P : String;
  1287. begin
  1288. _P:=SubstitutePath(_Path,['teamId',teamId]);
  1289. Result:=ServiceCall(_HTTPMethod,_P,'',Nil,TCustomFieldDefListResponse) as TCustomFieldDefListResponse;
  1290. end;
  1291. { --------------------------------------------------------------------
  1292. TJobsResource
  1293. --------------------------------------------------------------------}
  1294. Class Function TJobsResource.ResourceName : String;
  1295. begin
  1296. Result:='jobs';
  1297. end;
  1298. Class Function TJobsResource.DefaultAPI : TGoogleAPIClass;
  1299. begin
  1300. Result:=TcoordinateAPI;
  1301. end;
  1302. Function TJobsResource.Get(jobId: string; teamId: string) : TJob;
  1303. Const
  1304. _HTTPMethod = 'GET';
  1305. _Path = 'teams/{teamId}/jobs/{jobId}';
  1306. _Methodid = 'coordinate.jobs.get';
  1307. Var
  1308. _P : String;
  1309. begin
  1310. _P:=SubstitutePath(_Path,['jobId',jobId,'teamId',teamId]);
  1311. Result:=ServiceCall(_HTTPMethod,_P,'',Nil,TJob) as TJob;
  1312. end;
  1313. Function TJobsResource.Insert(teamId: string; aJob : TJob; AQuery : string = '') : TJob;
  1314. Const
  1315. _HTTPMethod = 'POST';
  1316. _Path = 'teams/{teamId}/jobs';
  1317. _Methodid = 'coordinate.jobs.insert';
  1318. Var
  1319. _P : String;
  1320. begin
  1321. _P:=SubstitutePath(_Path,['teamId',teamId]);
  1322. Result:=ServiceCall(_HTTPMethod,_P,AQuery,aJob,TJob) as TJob;
  1323. end;
  1324. Function TJobsResource.Insert(teamId: string; aJob : TJob; AQuery : TJobsinsertOptions) : TJob;
  1325. Var
  1326. _Q : String;
  1327. begin
  1328. _Q:='';
  1329. AddToQuery(_Q,'address',AQuery.address);
  1330. AddToQuery(_Q,'assignee',AQuery.assignee);
  1331. AddToQuery(_Q,'customField',AQuery.customField);
  1332. AddToQuery(_Q,'customerName',AQuery.customerName);
  1333. AddToQuery(_Q,'customerPhoneNumber',AQuery.customerPhoneNumber);
  1334. AddToQuery(_Q,'lat',AQuery.lat);
  1335. AddToQuery(_Q,'lng',AQuery.lng);
  1336. AddToQuery(_Q,'note',AQuery.note);
  1337. AddToQuery(_Q,'title',AQuery.title);
  1338. Result:=Insert(teamId,aJob,_Q);
  1339. end;
  1340. Function TJobsResource.List(teamId: string; AQuery : string = '') : TJobListResponse;
  1341. Const
  1342. _HTTPMethod = 'GET';
  1343. _Path = 'teams/{teamId}/jobs';
  1344. _Methodid = 'coordinate.jobs.list';
  1345. Var
  1346. _P : String;
  1347. begin
  1348. _P:=SubstitutePath(_Path,['teamId',teamId]);
  1349. Result:=ServiceCall(_HTTPMethod,_P,AQuery,Nil,TJobListResponse) as TJobListResponse;
  1350. end;
  1351. Function TJobsResource.List(teamId: string; AQuery : TJobslistOptions) : TJobListResponse;
  1352. Var
  1353. _Q : String;
  1354. begin
  1355. _Q:='';
  1356. AddToQuery(_Q,'maxResults',AQuery.maxResults);
  1357. AddToQuery(_Q,'minModifiedTimestampMs',AQuery.minModifiedTimestampMs);
  1358. AddToQuery(_Q,'pageToken',AQuery.pageToken);
  1359. Result:=List(teamId,_Q);
  1360. end;
  1361. Function TJobsResource.Patch(jobId: string; teamId: string; aJob : TJob; AQuery : string = '') : TJob;
  1362. Const
  1363. _HTTPMethod = 'PATCH';
  1364. _Path = 'teams/{teamId}/jobs/{jobId}';
  1365. _Methodid = 'coordinate.jobs.patch';
  1366. Var
  1367. _P : String;
  1368. begin
  1369. _P:=SubstitutePath(_Path,['jobId',jobId,'teamId',teamId]);
  1370. Result:=ServiceCall(_HTTPMethod,_P,AQuery,aJob,TJob) as TJob;
  1371. end;
  1372. Function TJobsResource.Patch(jobId: string; teamId: string; aJob : TJob; AQuery : TJobspatchOptions) : TJob;
  1373. Var
  1374. _Q : String;
  1375. begin
  1376. _Q:='';
  1377. AddToQuery(_Q,'address',AQuery.address);
  1378. AddToQuery(_Q,'assignee',AQuery.assignee);
  1379. AddToQuery(_Q,'customField',AQuery.customField);
  1380. AddToQuery(_Q,'customerName',AQuery.customerName);
  1381. AddToQuery(_Q,'customerPhoneNumber',AQuery.customerPhoneNumber);
  1382. AddToQuery(_Q,'lat',AQuery.lat);
  1383. AddToQuery(_Q,'lng',AQuery.lng);
  1384. AddToQuery(_Q,'note',AQuery.note);
  1385. AddToQuery(_Q,'progress',AQuery.progress);
  1386. AddToQuery(_Q,'title',AQuery.title);
  1387. Result:=Patch(jobId,teamId,aJob,_Q);
  1388. end;
  1389. Function TJobsResource.Update(jobId: string; teamId: string; aJob : TJob; AQuery : string = '') : TJob;
  1390. Const
  1391. _HTTPMethod = 'PUT';
  1392. _Path = 'teams/{teamId}/jobs/{jobId}';
  1393. _Methodid = 'coordinate.jobs.update';
  1394. Var
  1395. _P : String;
  1396. begin
  1397. _P:=SubstitutePath(_Path,['jobId',jobId,'teamId',teamId]);
  1398. Result:=ServiceCall(_HTTPMethod,_P,AQuery,aJob,TJob) as TJob;
  1399. end;
  1400. Function TJobsResource.Update(jobId: string; teamId: string; aJob : TJob; AQuery : TJobsupdateOptions) : TJob;
  1401. Var
  1402. _Q : String;
  1403. begin
  1404. _Q:='';
  1405. AddToQuery(_Q,'address',AQuery.address);
  1406. AddToQuery(_Q,'assignee',AQuery.assignee);
  1407. AddToQuery(_Q,'customField',AQuery.customField);
  1408. AddToQuery(_Q,'customerName',AQuery.customerName);
  1409. AddToQuery(_Q,'customerPhoneNumber',AQuery.customerPhoneNumber);
  1410. AddToQuery(_Q,'lat',AQuery.lat);
  1411. AddToQuery(_Q,'lng',AQuery.lng);
  1412. AddToQuery(_Q,'note',AQuery.note);
  1413. AddToQuery(_Q,'progress',AQuery.progress);
  1414. AddToQuery(_Q,'title',AQuery.title);
  1415. Result:=Update(jobId,teamId,aJob,_Q);
  1416. end;
  1417. { --------------------------------------------------------------------
  1418. TLocationResource
  1419. --------------------------------------------------------------------}
  1420. Class Function TLocationResource.ResourceName : String;
  1421. begin
  1422. Result:='location';
  1423. end;
  1424. Class Function TLocationResource.DefaultAPI : TGoogleAPIClass;
  1425. begin
  1426. Result:=TcoordinateAPI;
  1427. end;
  1428. Function TLocationResource.List(teamId: string; workerEmail: string; AQuery : string = '') : TLocationListResponse;
  1429. Const
  1430. _HTTPMethod = 'GET';
  1431. _Path = 'teams/{teamId}/workers/{workerEmail}/locations';
  1432. _Methodid = 'coordinate.location.list';
  1433. Var
  1434. _P : String;
  1435. begin
  1436. _P:=SubstitutePath(_Path,['teamId',teamId,'workerEmail',workerEmail]);
  1437. Result:=ServiceCall(_HTTPMethod,_P,AQuery,Nil,TLocationListResponse) as TLocationListResponse;
  1438. end;
  1439. Function TLocationResource.List(teamId: string; workerEmail: string; AQuery : TLocationlistOptions) : TLocationListResponse;
  1440. Var
  1441. _Q : String;
  1442. begin
  1443. _Q:='';
  1444. AddToQuery(_Q,'maxResults',AQuery.maxResults);
  1445. AddToQuery(_Q,'pageToken',AQuery.pageToken);
  1446. AddToQuery(_Q,'startTimestampMs',AQuery.startTimestampMs);
  1447. Result:=List(teamId,workerEmail,_Q);
  1448. end;
  1449. { --------------------------------------------------------------------
  1450. TScheduleResource
  1451. --------------------------------------------------------------------}
  1452. Class Function TScheduleResource.ResourceName : String;
  1453. begin
  1454. Result:='schedule';
  1455. end;
  1456. Class Function TScheduleResource.DefaultAPI : TGoogleAPIClass;
  1457. begin
  1458. Result:=TcoordinateAPI;
  1459. end;
  1460. Function TScheduleResource.Get(jobId: string; teamId: string) : TSchedule;
  1461. Const
  1462. _HTTPMethod = 'GET';
  1463. _Path = 'teams/{teamId}/jobs/{jobId}/schedule';
  1464. _Methodid = 'coordinate.schedule.get';
  1465. Var
  1466. _P : String;
  1467. begin
  1468. _P:=SubstitutePath(_Path,['jobId',jobId,'teamId',teamId]);
  1469. Result:=ServiceCall(_HTTPMethod,_P,'',Nil,TSchedule) as TSchedule;
  1470. end;
  1471. Function TScheduleResource.Patch(jobId: string; teamId: string; aSchedule : TSchedule; AQuery : string = '') : TSchedule;
  1472. Const
  1473. _HTTPMethod = 'PATCH';
  1474. _Path = 'teams/{teamId}/jobs/{jobId}/schedule';
  1475. _Methodid = 'coordinate.schedule.patch';
  1476. Var
  1477. _P : String;
  1478. begin
  1479. _P:=SubstitutePath(_Path,['jobId',jobId,'teamId',teamId]);
  1480. Result:=ServiceCall(_HTTPMethod,_P,AQuery,aSchedule,TSchedule) as TSchedule;
  1481. end;
  1482. Function TScheduleResource.Patch(jobId: string; teamId: string; aSchedule : TSchedule; AQuery : TSchedulepatchOptions) : TSchedule;
  1483. Var
  1484. _Q : String;
  1485. begin
  1486. _Q:='';
  1487. AddToQuery(_Q,'allDay',AQuery.allDay);
  1488. AddToQuery(_Q,'duration',AQuery.duration);
  1489. AddToQuery(_Q,'endTime',AQuery.endTime);
  1490. AddToQuery(_Q,'startTime',AQuery.startTime);
  1491. Result:=Patch(jobId,teamId,aSchedule,_Q);
  1492. end;
  1493. Function TScheduleResource.Update(jobId: string; teamId: string; aSchedule : TSchedule; AQuery : string = '') : TSchedule;
  1494. Const
  1495. _HTTPMethod = 'PUT';
  1496. _Path = 'teams/{teamId}/jobs/{jobId}/schedule';
  1497. _Methodid = 'coordinate.schedule.update';
  1498. Var
  1499. _P : String;
  1500. begin
  1501. _P:=SubstitutePath(_Path,['jobId',jobId,'teamId',teamId]);
  1502. Result:=ServiceCall(_HTTPMethod,_P,AQuery,aSchedule,TSchedule) as TSchedule;
  1503. end;
  1504. Function TScheduleResource.Update(jobId: string; teamId: string; aSchedule : TSchedule; AQuery : TScheduleupdateOptions) : TSchedule;
  1505. Var
  1506. _Q : String;
  1507. begin
  1508. _Q:='';
  1509. AddToQuery(_Q,'allDay',AQuery.allDay);
  1510. AddToQuery(_Q,'duration',AQuery.duration);
  1511. AddToQuery(_Q,'endTime',AQuery.endTime);
  1512. AddToQuery(_Q,'startTime',AQuery.startTime);
  1513. Result:=Update(jobId,teamId,aSchedule,_Q);
  1514. end;
  1515. { --------------------------------------------------------------------
  1516. TTeamResource
  1517. --------------------------------------------------------------------}
  1518. Class Function TTeamResource.ResourceName : String;
  1519. begin
  1520. Result:='team';
  1521. end;
  1522. Class Function TTeamResource.DefaultAPI : TGoogleAPIClass;
  1523. begin
  1524. Result:=TcoordinateAPI;
  1525. end;
  1526. Function TTeamResource.List(AQuery : string = '') : TTeamListResponse;
  1527. Const
  1528. _HTTPMethod = 'GET';
  1529. _Path = 'teams';
  1530. _Methodid = 'coordinate.team.list';
  1531. begin
  1532. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,Nil,TTeamListResponse) as TTeamListResponse;
  1533. end;
  1534. Function TTeamResource.List(AQuery : TTeamlistOptions) : TTeamListResponse;
  1535. Var
  1536. _Q : String;
  1537. begin
  1538. _Q:='';
  1539. AddToQuery(_Q,'admin',AQuery.admin);
  1540. AddToQuery(_Q,'dispatcher',AQuery.dispatcher);
  1541. AddToQuery(_Q,'worker',AQuery.worker);
  1542. Result:=List(_Q);
  1543. end;
  1544. { --------------------------------------------------------------------
  1545. TWorkerResource
  1546. --------------------------------------------------------------------}
  1547. Class Function TWorkerResource.ResourceName : String;
  1548. begin
  1549. Result:='worker';
  1550. end;
  1551. Class Function TWorkerResource.DefaultAPI : TGoogleAPIClass;
  1552. begin
  1553. Result:=TcoordinateAPI;
  1554. end;
  1555. Function TWorkerResource.List(teamId: string) : TWorkerListResponse;
  1556. Const
  1557. _HTTPMethod = 'GET';
  1558. _Path = 'teams/{teamId}/workers';
  1559. _Methodid = 'coordinate.worker.list';
  1560. Var
  1561. _P : String;
  1562. begin
  1563. _P:=SubstitutePath(_Path,['teamId',teamId]);
  1564. Result:=ServiceCall(_HTTPMethod,_P,'',Nil,TWorkerListResponse) as TWorkerListResponse;
  1565. end;
  1566. { --------------------------------------------------------------------
  1567. TCoordinateAPI
  1568. --------------------------------------------------------------------}
  1569. Class Function TCoordinateAPI.APIName : String;
  1570. begin
  1571. Result:='coordinate';
  1572. end;
  1573. Class Function TCoordinateAPI.APIVersion : String;
  1574. begin
  1575. Result:='v1';
  1576. end;
  1577. Class Function TCoordinateAPI.APIRevision : String;
  1578. begin
  1579. Result:='20141215';
  1580. end;
  1581. Class Function TCoordinateAPI.APIID : String;
  1582. begin
  1583. Result:='coordinate:v1';
  1584. end;
  1585. Class Function TCoordinateAPI.APITitle : String;
  1586. begin
  1587. Result:='Google Maps Coordinate API';
  1588. end;
  1589. Class Function TCoordinateAPI.APIDescription : String;
  1590. begin
  1591. Result:='Lets you view and manage jobs in a Coordinate team.';
  1592. end;
  1593. Class Function TCoordinateAPI.APIOwnerDomain : String;
  1594. begin
  1595. Result:='google.com';
  1596. end;
  1597. Class Function TCoordinateAPI.APIOwnerName : String;
  1598. begin
  1599. Result:='Google';
  1600. end;
  1601. Class Function TCoordinateAPI.APIIcon16 : String;
  1602. begin
  1603. Result:='http://www.google.com/images/icons/product/search-16.gif';
  1604. end;
  1605. Class Function TCoordinateAPI.APIIcon32 : String;
  1606. begin
  1607. Result:='http://www.google.com/images/icons/product/search-32.gif';
  1608. end;
  1609. Class Function TCoordinateAPI.APIdocumentationLink : String;
  1610. begin
  1611. Result:='https://developers.google.com/coordinate/';
  1612. end;
  1613. Class Function TCoordinateAPI.APIrootUrl : string;
  1614. begin
  1615. Result:='https://www.googleapis.com:443/';
  1616. end;
  1617. Class Function TCoordinateAPI.APIbasePath : string;
  1618. begin
  1619. Result:='/coordinate/v1/';
  1620. end;
  1621. Class Function TCoordinateAPI.APIbaseURL : String;
  1622. begin
  1623. Result:='https://www.googleapis.com:443/coordinate/v1/';
  1624. end;
  1625. Class Function TCoordinateAPI.APIProtocol : string;
  1626. begin
  1627. Result:='rest';
  1628. end;
  1629. Class Function TCoordinateAPI.APIservicePath : string;
  1630. begin
  1631. Result:='coordinate/v1/';
  1632. end;
  1633. Class Function TCoordinateAPI.APIbatchPath : String;
  1634. begin
  1635. Result:='batch';
  1636. end;
  1637. Class Function TCoordinateAPI.APIAuthScopes : TScopeInfoArray;
  1638. begin
  1639. SetLength(Result,2);
  1640. Result[0].Name:='https://www.googleapis.com/auth/coordinate';
  1641. Result[0].Description:='View and manage your Google Maps Coordinate jobs';
  1642. Result[1].Name:='https://www.googleapis.com/auth/coordinate.readonly';
  1643. Result[1].Description:='View your Google Coordinate jobs';
  1644. end;
  1645. Class Function TCoordinateAPI.APINeedsAuth : Boolean;
  1646. begin
  1647. Result:=True;
  1648. end;
  1649. Class Procedure TCoordinateAPI.RegisterAPIResources;
  1650. begin
  1651. TCustomField.RegisterObject;
  1652. TCustomFieldDef.RegisterObject;
  1653. TCustomFieldDefListResponse.RegisterObject;
  1654. TCustomFields.RegisterObject;
  1655. TEnumItemDef.RegisterObject;
  1656. TJob.RegisterObject;
  1657. TJobChange.RegisterObject;
  1658. TJobListResponse.RegisterObject;
  1659. TJobState.RegisterObject;
  1660. TLocation.RegisterObject;
  1661. TLocationListResponse.RegisterObject;
  1662. TLocationRecord.RegisterObject;
  1663. TSchedule.RegisterObject;
  1664. TTeam.RegisterObject;
  1665. TTeamListResponse.RegisterObject;
  1666. TTokenPagination.RegisterObject;
  1667. TWorker.RegisterObject;
  1668. TWorkerListResponse.RegisterObject;
  1669. end;
  1670. Function TCoordinateAPI.GetCustomFieldDefInstance : TCustomFieldDefResource;
  1671. begin
  1672. if (FCustomFieldDefInstance=Nil) then
  1673. FCustomFieldDefInstance:=CreateCustomFieldDefResource;
  1674. Result:=FCustomFieldDefInstance;
  1675. end;
  1676. Function TCoordinateAPI.CreateCustomFieldDefResource : TCustomFieldDefResource;
  1677. begin
  1678. Result:=CreateCustomFieldDefResource(Self);
  1679. end;
  1680. Function TCoordinateAPI.CreateCustomFieldDefResource(AOwner : TComponent) : TCustomFieldDefResource;
  1681. begin
  1682. Result:=TCustomFieldDefResource.Create(AOwner);
  1683. Result.API:=Self.API;
  1684. end;
  1685. Function TCoordinateAPI.GetJobsInstance : TJobsResource;
  1686. begin
  1687. if (FJobsInstance=Nil) then
  1688. FJobsInstance:=CreateJobsResource;
  1689. Result:=FJobsInstance;
  1690. end;
  1691. Function TCoordinateAPI.CreateJobsResource : TJobsResource;
  1692. begin
  1693. Result:=CreateJobsResource(Self);
  1694. end;
  1695. Function TCoordinateAPI.CreateJobsResource(AOwner : TComponent) : TJobsResource;
  1696. begin
  1697. Result:=TJobsResource.Create(AOwner);
  1698. Result.API:=Self.API;
  1699. end;
  1700. Function TCoordinateAPI.GetLocationInstance : TLocationResource;
  1701. begin
  1702. if (FLocationInstance=Nil) then
  1703. FLocationInstance:=CreateLocationResource;
  1704. Result:=FLocationInstance;
  1705. end;
  1706. Function TCoordinateAPI.CreateLocationResource : TLocationResource;
  1707. begin
  1708. Result:=CreateLocationResource(Self);
  1709. end;
  1710. Function TCoordinateAPI.CreateLocationResource(AOwner : TComponent) : TLocationResource;
  1711. begin
  1712. Result:=TLocationResource.Create(AOwner);
  1713. Result.API:=Self.API;
  1714. end;
  1715. Function TCoordinateAPI.GetScheduleInstance : TScheduleResource;
  1716. begin
  1717. if (FScheduleInstance=Nil) then
  1718. FScheduleInstance:=CreateScheduleResource;
  1719. Result:=FScheduleInstance;
  1720. end;
  1721. Function TCoordinateAPI.CreateScheduleResource : TScheduleResource;
  1722. begin
  1723. Result:=CreateScheduleResource(Self);
  1724. end;
  1725. Function TCoordinateAPI.CreateScheduleResource(AOwner : TComponent) : TScheduleResource;
  1726. begin
  1727. Result:=TScheduleResource.Create(AOwner);
  1728. Result.API:=Self.API;
  1729. end;
  1730. Function TCoordinateAPI.GetTeamInstance : TTeamResource;
  1731. begin
  1732. if (FTeamInstance=Nil) then
  1733. FTeamInstance:=CreateTeamResource;
  1734. Result:=FTeamInstance;
  1735. end;
  1736. Function TCoordinateAPI.CreateTeamResource : TTeamResource;
  1737. begin
  1738. Result:=CreateTeamResource(Self);
  1739. end;
  1740. Function TCoordinateAPI.CreateTeamResource(AOwner : TComponent) : TTeamResource;
  1741. begin
  1742. Result:=TTeamResource.Create(AOwner);
  1743. Result.API:=Self.API;
  1744. end;
  1745. Function TCoordinateAPI.GetWorkerInstance : TWorkerResource;
  1746. begin
  1747. if (FWorkerInstance=Nil) then
  1748. FWorkerInstance:=CreateWorkerResource;
  1749. Result:=FWorkerInstance;
  1750. end;
  1751. Function TCoordinateAPI.CreateWorkerResource : TWorkerResource;
  1752. begin
  1753. Result:=CreateWorkerResource(Self);
  1754. end;
  1755. Function TCoordinateAPI.CreateWorkerResource(AOwner : TComponent) : TWorkerResource;
  1756. begin
  1757. Result:=TWorkerResource.Create(AOwner);
  1758. Result.API:=Self.API;
  1759. end;
  1760. initialization
  1761. TCoordinateAPI.RegisterAPI;
  1762. end.