googlecoordinate.pp 63 KB

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