googleappsactivity.pp 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117
  1. unit googleappsactivity;
  2. {$MODE objfpc}
  3. {$H+}
  4. interface
  5. uses sysutils, classes, googleservice, restbase, googlebase;
  6. type
  7. //Top-level schema types
  8. TActivity = Class;
  9. TEvent = Class;
  10. TListActivitiesResponse = Class;
  11. TMove = Class;
  12. TParent = Class;
  13. TPermission = Class;
  14. TPermissionChange = Class;
  15. TPhoto = Class;
  16. TRename = Class;
  17. TTarget = Class;
  18. TUser = Class;
  19. TActivityArray = Array of TActivity;
  20. TEventArray = Array of TEvent;
  21. TListActivitiesResponseArray = Array of TListActivitiesResponse;
  22. TMoveArray = Array of TMove;
  23. TParentArray = Array of TParent;
  24. TPermissionArray = Array of TPermission;
  25. TPermissionChangeArray = Array of TPermissionChange;
  26. TPhotoArray = Array of TPhoto;
  27. TRenameArray = Array of TRename;
  28. TTargetArray = Array of TTarget;
  29. TUserArray = Array of TUser;
  30. //Anonymous types, using auto-generated names
  31. TActivityTypesingleEventsArray = Array of TEvent;
  32. TEventTypepermissionChangesArray = Array of TPermissionChange;
  33. TListActivitiesResponseTypeactivitiesArray = Array of TActivity;
  34. TMoveTypeaddedParentsArray = Array of TParent;
  35. TMoveTyperemovedParentsArray = Array of TParent;
  36. TPermissionChangeTypeaddedPermissionsArray = Array of TPermission;
  37. TPermissionChangeTyperemovedPermissionsArray = Array of TPermission;
  38. { --------------------------------------------------------------------
  39. TActivity
  40. --------------------------------------------------------------------}
  41. TActivity = Class(TGoogleBaseObject)
  42. Private
  43. FcombinedEvent : TEvent;
  44. FsingleEvents : TActivityTypesingleEventsArray;
  45. Protected
  46. //Property setters
  47. Procedure SetcombinedEvent(AIndex : Integer; const AValue : TEvent); virtual;
  48. Procedure SetsingleEvents(AIndex : Integer; const AValue : TActivityTypesingleEventsArray); virtual;
  49. //2.6.4. bug workaround
  50. {$IFDEF VER2_6}
  51. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  52. {$ENDIF VER2_6}
  53. Public
  54. Published
  55. Property combinedEvent : TEvent Index 0 Read FcombinedEvent Write SetcombinedEvent;
  56. Property singleEvents : TActivityTypesingleEventsArray Index 8 Read FsingleEvents Write SetsingleEvents;
  57. end;
  58. TActivityClass = Class of TActivity;
  59. { --------------------------------------------------------------------
  60. TEvent
  61. --------------------------------------------------------------------}
  62. TEvent = Class(TGoogleBaseObject)
  63. Private
  64. FadditionalEventTypes : TStringArray;
  65. FeventTimeMillis : String;
  66. FfromUserDeletion : boolean;
  67. Fmove : TMove;
  68. FpermissionChanges : TEventTypepermissionChangesArray;
  69. FprimaryEventType : String;
  70. Frename : TRename;
  71. Ftarget : TTarget;
  72. Fuser : TUser;
  73. Protected
  74. //Property setters
  75. Procedure SetadditionalEventTypes(AIndex : Integer; const AValue : TStringArray); virtual;
  76. Procedure SeteventTimeMillis(AIndex : Integer; const AValue : String); virtual;
  77. Procedure SetfromUserDeletion(AIndex : Integer; const AValue : boolean); virtual;
  78. Procedure Setmove(AIndex : Integer; const AValue : TMove); virtual;
  79. Procedure SetpermissionChanges(AIndex : Integer; const AValue : TEventTypepermissionChangesArray); virtual;
  80. Procedure SetprimaryEventType(AIndex : Integer; const AValue : String); virtual;
  81. Procedure Setrename(AIndex : Integer; const AValue : TRename); virtual;
  82. Procedure Settarget(AIndex : Integer; const AValue : TTarget); virtual;
  83. Procedure Setuser(AIndex : Integer; const AValue : TUser); virtual;
  84. //2.6.4. bug workaround
  85. {$IFDEF VER2_6}
  86. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  87. {$ENDIF VER2_6}
  88. Public
  89. Published
  90. Property additionalEventTypes : TStringArray Index 0 Read FadditionalEventTypes Write SetadditionalEventTypes;
  91. Property eventTimeMillis : String Index 8 Read FeventTimeMillis Write SeteventTimeMillis;
  92. Property fromUserDeletion : boolean Index 16 Read FfromUserDeletion Write SetfromUserDeletion;
  93. Property move : TMove Index 24 Read Fmove Write Setmove;
  94. Property permissionChanges : TEventTypepermissionChangesArray Index 32 Read FpermissionChanges Write SetpermissionChanges;
  95. Property primaryEventType : String Index 40 Read FprimaryEventType Write SetprimaryEventType;
  96. Property rename : TRename Index 48 Read Frename Write Setrename;
  97. Property target : TTarget Index 56 Read Ftarget Write Settarget;
  98. Property user : TUser Index 64 Read Fuser Write Setuser;
  99. end;
  100. TEventClass = Class of TEvent;
  101. { --------------------------------------------------------------------
  102. TListActivitiesResponse
  103. --------------------------------------------------------------------}
  104. TListActivitiesResponse = Class(TGoogleBaseObject)
  105. Private
  106. Factivities : TListActivitiesResponseTypeactivitiesArray;
  107. FnextPageToken : String;
  108. Protected
  109. //Property setters
  110. Procedure Setactivities(AIndex : Integer; const AValue : TListActivitiesResponseTypeactivitiesArray); virtual;
  111. Procedure SetnextPageToken(AIndex : Integer; const AValue : String); virtual;
  112. //2.6.4. bug workaround
  113. {$IFDEF VER2_6}
  114. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  115. {$ENDIF VER2_6}
  116. Public
  117. Published
  118. Property activities : TListActivitiesResponseTypeactivitiesArray Index 0 Read Factivities Write Setactivities;
  119. Property nextPageToken : String Index 8 Read FnextPageToken Write SetnextPageToken;
  120. end;
  121. TListActivitiesResponseClass = Class of TListActivitiesResponse;
  122. { --------------------------------------------------------------------
  123. TMove
  124. --------------------------------------------------------------------}
  125. TMove = Class(TGoogleBaseObject)
  126. Private
  127. FaddedParents : TMoveTypeaddedParentsArray;
  128. FremovedParents : TMoveTyperemovedParentsArray;
  129. Protected
  130. //Property setters
  131. Procedure SetaddedParents(AIndex : Integer; const AValue : TMoveTypeaddedParentsArray); virtual;
  132. Procedure SetremovedParents(AIndex : Integer; const AValue : TMoveTyperemovedParentsArray); 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 addedParents : TMoveTypeaddedParentsArray Index 0 Read FaddedParents Write SetaddedParents;
  140. Property removedParents : TMoveTyperemovedParentsArray Index 8 Read FremovedParents Write SetremovedParents;
  141. end;
  142. TMoveClass = Class of TMove;
  143. { --------------------------------------------------------------------
  144. TParent
  145. --------------------------------------------------------------------}
  146. TParent = Class(TGoogleBaseObject)
  147. Private
  148. Fid : String;
  149. FisRoot : boolean;
  150. Ftitle : String;
  151. Protected
  152. //Property setters
  153. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  154. Procedure SetisRoot(AIndex : Integer; const AValue : boolean); virtual;
  155. Procedure Settitle(AIndex : Integer; const AValue : String); virtual;
  156. Public
  157. Published
  158. Property id : String Index 0 Read Fid Write Setid;
  159. Property isRoot : boolean Index 8 Read FisRoot Write SetisRoot;
  160. Property title : String Index 16 Read Ftitle Write Settitle;
  161. end;
  162. TParentClass = Class of TParent;
  163. { --------------------------------------------------------------------
  164. TPermission
  165. --------------------------------------------------------------------}
  166. TPermission = Class(TGoogleBaseObject)
  167. Private
  168. Fname : String;
  169. FpermissionId : String;
  170. Frole : String;
  171. F_type : String;
  172. Fuser : TUser;
  173. FwithLink : boolean;
  174. Protected
  175. Class Function ExportPropertyName(Const AName : String) : string; override;
  176. //Property setters
  177. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  178. Procedure SetpermissionId(AIndex : Integer; const AValue : String); virtual;
  179. Procedure Setrole(AIndex : Integer; const AValue : String); virtual;
  180. Procedure Set_type(AIndex : Integer; const AValue : String); virtual;
  181. Procedure Setuser(AIndex : Integer; const AValue : TUser); virtual;
  182. Procedure SetwithLink(AIndex : Integer; const AValue : boolean); virtual;
  183. Public
  184. Published
  185. Property name : String Index 0 Read Fname Write Setname;
  186. Property permissionId : String Index 8 Read FpermissionId Write SetpermissionId;
  187. Property role : String Index 16 Read Frole Write Setrole;
  188. Property _type : String Index 24 Read F_type Write Set_type;
  189. Property user : TUser Index 32 Read Fuser Write Setuser;
  190. Property withLink : boolean Index 40 Read FwithLink Write SetwithLink;
  191. end;
  192. TPermissionClass = Class of TPermission;
  193. { --------------------------------------------------------------------
  194. TPermissionChange
  195. --------------------------------------------------------------------}
  196. TPermissionChange = Class(TGoogleBaseObject)
  197. Private
  198. FaddedPermissions : TPermissionChangeTypeaddedPermissionsArray;
  199. FremovedPermissions : TPermissionChangeTyperemovedPermissionsArray;
  200. Protected
  201. //Property setters
  202. Procedure SetaddedPermissions(AIndex : Integer; const AValue : TPermissionChangeTypeaddedPermissionsArray); virtual;
  203. Procedure SetremovedPermissions(AIndex : Integer; const AValue : TPermissionChangeTyperemovedPermissionsArray); virtual;
  204. //2.6.4. bug workaround
  205. {$IFDEF VER2_6}
  206. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  207. {$ENDIF VER2_6}
  208. Public
  209. Published
  210. Property addedPermissions : TPermissionChangeTypeaddedPermissionsArray Index 0 Read FaddedPermissions Write SetaddedPermissions;
  211. Property removedPermissions : TPermissionChangeTyperemovedPermissionsArray Index 8 Read FremovedPermissions Write SetremovedPermissions;
  212. end;
  213. TPermissionChangeClass = Class of TPermissionChange;
  214. { --------------------------------------------------------------------
  215. TPhoto
  216. --------------------------------------------------------------------}
  217. TPhoto = Class(TGoogleBaseObject)
  218. Private
  219. Furl : String;
  220. Protected
  221. //Property setters
  222. Procedure Seturl(AIndex : Integer; const AValue : String); virtual;
  223. Public
  224. Published
  225. Property url : String Index 0 Read Furl Write Seturl;
  226. end;
  227. TPhotoClass = Class of TPhoto;
  228. { --------------------------------------------------------------------
  229. TRename
  230. --------------------------------------------------------------------}
  231. TRename = Class(TGoogleBaseObject)
  232. Private
  233. FnewTitle : String;
  234. FoldTitle : String;
  235. Protected
  236. //Property setters
  237. Procedure SetnewTitle(AIndex : Integer; const AValue : String); virtual;
  238. Procedure SetoldTitle(AIndex : Integer; const AValue : String); virtual;
  239. Public
  240. Published
  241. Property newTitle : String Index 0 Read FnewTitle Write SetnewTitle;
  242. Property oldTitle : String Index 8 Read FoldTitle Write SetoldTitle;
  243. end;
  244. TRenameClass = Class of TRename;
  245. { --------------------------------------------------------------------
  246. TTarget
  247. --------------------------------------------------------------------}
  248. TTarget = Class(TGoogleBaseObject)
  249. Private
  250. Fid : String;
  251. FmimeType : String;
  252. Fname : String;
  253. Protected
  254. //Property setters
  255. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  256. Procedure SetmimeType(AIndex : Integer; const AValue : String); virtual;
  257. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  258. Public
  259. Published
  260. Property id : String Index 0 Read Fid Write Setid;
  261. Property mimeType : String Index 8 Read FmimeType Write SetmimeType;
  262. Property name : String Index 16 Read Fname Write Setname;
  263. end;
  264. TTargetClass = Class of TTarget;
  265. { --------------------------------------------------------------------
  266. TUser
  267. --------------------------------------------------------------------}
  268. TUser = Class(TGoogleBaseObject)
  269. Private
  270. FisDeleted : boolean;
  271. Fname : String;
  272. FpermissionId : String;
  273. Fphoto : TPhoto;
  274. Protected
  275. //Property setters
  276. Procedure SetisDeleted(AIndex : Integer; const AValue : boolean); virtual;
  277. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  278. Procedure SetpermissionId(AIndex : Integer; const AValue : String); virtual;
  279. Procedure Setphoto(AIndex : Integer; const AValue : TPhoto); virtual;
  280. Public
  281. Published
  282. Property isDeleted : boolean Index 0 Read FisDeleted Write SetisDeleted;
  283. Property name : String Index 8 Read Fname Write Setname;
  284. Property permissionId : String Index 16 Read FpermissionId Write SetpermissionId;
  285. Property photo : TPhoto Index 24 Read Fphoto Write Setphoto;
  286. end;
  287. TUserClass = Class of TUser;
  288. { --------------------------------------------------------------------
  289. TActivitiesResource
  290. --------------------------------------------------------------------}
  291. //Optional query Options for TActivitiesResource, method List
  292. TActivitiesListOptions = Record
  293. driveancestorId : String;
  294. drivefileId : String;
  295. groupingStrategy : String;
  296. pageSize : integer;
  297. pageToken : String;
  298. source : String;
  299. userId : String;
  300. end;
  301. TActivitiesResource = Class(TGoogleResource)
  302. Public
  303. Class Function ResourceName : String; override;
  304. Class Function DefaultAPI : TGoogleAPIClass; override;
  305. Function List(AQuery : string = '') : TListActivitiesResponse;
  306. Function List(AQuery : TActivitieslistOptions) : TListActivitiesResponse;
  307. end;
  308. { --------------------------------------------------------------------
  309. TAppsactivityAPI
  310. --------------------------------------------------------------------}
  311. TAppsactivityAPI = Class(TGoogleAPI)
  312. Private
  313. FActivitiesInstance : TActivitiesResource;
  314. Function GetActivitiesInstance : TActivitiesResource;virtual;
  315. Public
  316. //Override class functions with API info
  317. Class Function APIName : String; override;
  318. Class Function APIVersion : String; override;
  319. Class Function APIRevision : String; override;
  320. Class Function APIID : String; override;
  321. Class Function APITitle : String; override;
  322. Class Function APIDescription : String; override;
  323. Class Function APIOwnerDomain : String; override;
  324. Class Function APIOwnerName : String; override;
  325. Class Function APIIcon16 : String; override;
  326. Class Function APIIcon32 : String; override;
  327. Class Function APIdocumentationLink : String; override;
  328. Class Function APIrootUrl : string; override;
  329. Class Function APIbasePath : string;override;
  330. Class Function APIbaseURL : String;override;
  331. Class Function APIProtocol : string;override;
  332. Class Function APIservicePath : string;override;
  333. Class Function APIbatchPath : String;override;
  334. Class Function APIAuthScopes : TScopeInfoArray;override;
  335. Class Function APINeedsAuth : Boolean;override;
  336. Class Procedure RegisterAPIResources; override;
  337. //Add create function for resources
  338. Function CreateActivitiesResource(AOwner : TComponent) : TActivitiesResource;virtual;overload;
  339. Function CreateActivitiesResource : TActivitiesResource;virtual;overload;
  340. //Add default on-demand instances for resources
  341. Property ActivitiesResource : TActivitiesResource Read GetActivitiesInstance;
  342. end;
  343. implementation
  344. { --------------------------------------------------------------------
  345. TActivity
  346. --------------------------------------------------------------------}
  347. Procedure TActivity.SetcombinedEvent(AIndex : Integer; const AValue : TEvent);
  348. begin
  349. If (FcombinedEvent=AValue) then exit;
  350. FcombinedEvent:=AValue;
  351. MarkPropertyChanged(AIndex);
  352. end;
  353. Procedure TActivity.SetsingleEvents(AIndex : Integer; const AValue : TActivityTypesingleEventsArray);
  354. begin
  355. If (FsingleEvents=AValue) then exit;
  356. FsingleEvents:=AValue;
  357. MarkPropertyChanged(AIndex);
  358. end;
  359. //2.6.4. bug workaround
  360. {$IFDEF VER2_6}
  361. Procedure TActivity.SetArrayLength(Const AName : String; ALength : Longint);
  362. begin
  363. Case AName of
  364. 'singleevents' : SetLength(FsingleEvents,ALength);
  365. else
  366. Inherited SetArrayLength(AName,ALength);
  367. end;
  368. end;
  369. {$ENDIF VER2_6}
  370. { --------------------------------------------------------------------
  371. TEvent
  372. --------------------------------------------------------------------}
  373. Procedure TEvent.SetadditionalEventTypes(AIndex : Integer; const AValue : TStringArray);
  374. begin
  375. If (FadditionalEventTypes=AValue) then exit;
  376. FadditionalEventTypes:=AValue;
  377. MarkPropertyChanged(AIndex);
  378. end;
  379. Procedure TEvent.SeteventTimeMillis(AIndex : Integer; const AValue : String);
  380. begin
  381. If (FeventTimeMillis=AValue) then exit;
  382. FeventTimeMillis:=AValue;
  383. MarkPropertyChanged(AIndex);
  384. end;
  385. Procedure TEvent.SetfromUserDeletion(AIndex : Integer; const AValue : boolean);
  386. begin
  387. If (FfromUserDeletion=AValue) then exit;
  388. FfromUserDeletion:=AValue;
  389. MarkPropertyChanged(AIndex);
  390. end;
  391. Procedure TEvent.Setmove(AIndex : Integer; const AValue : TMove);
  392. begin
  393. If (Fmove=AValue) then exit;
  394. Fmove:=AValue;
  395. MarkPropertyChanged(AIndex);
  396. end;
  397. Procedure TEvent.SetpermissionChanges(AIndex : Integer; const AValue : TEventTypepermissionChangesArray);
  398. begin
  399. If (FpermissionChanges=AValue) then exit;
  400. FpermissionChanges:=AValue;
  401. MarkPropertyChanged(AIndex);
  402. end;
  403. Procedure TEvent.SetprimaryEventType(AIndex : Integer; const AValue : String);
  404. begin
  405. If (FprimaryEventType=AValue) then exit;
  406. FprimaryEventType:=AValue;
  407. MarkPropertyChanged(AIndex);
  408. end;
  409. Procedure TEvent.Setrename(AIndex : Integer; const AValue : TRename);
  410. begin
  411. If (Frename=AValue) then exit;
  412. Frename:=AValue;
  413. MarkPropertyChanged(AIndex);
  414. end;
  415. Procedure TEvent.Settarget(AIndex : Integer; const AValue : TTarget);
  416. begin
  417. If (Ftarget=AValue) then exit;
  418. Ftarget:=AValue;
  419. MarkPropertyChanged(AIndex);
  420. end;
  421. Procedure TEvent.Setuser(AIndex : Integer; const AValue : TUser);
  422. begin
  423. If (Fuser=AValue) then exit;
  424. Fuser:=AValue;
  425. MarkPropertyChanged(AIndex);
  426. end;
  427. //2.6.4. bug workaround
  428. {$IFDEF VER2_6}
  429. Procedure TEvent.SetArrayLength(Const AName : String; ALength : Longint);
  430. begin
  431. Case AName of
  432. 'additionaleventtypes' : SetLength(FadditionalEventTypes,ALength);
  433. 'permissionchanges' : SetLength(FpermissionChanges,ALength);
  434. else
  435. Inherited SetArrayLength(AName,ALength);
  436. end;
  437. end;
  438. {$ENDIF VER2_6}
  439. { --------------------------------------------------------------------
  440. TListActivitiesResponse
  441. --------------------------------------------------------------------}
  442. Procedure TListActivitiesResponse.Setactivities(AIndex : Integer; const AValue : TListActivitiesResponseTypeactivitiesArray);
  443. begin
  444. If (Factivities=AValue) then exit;
  445. Factivities:=AValue;
  446. MarkPropertyChanged(AIndex);
  447. end;
  448. Procedure TListActivitiesResponse.SetnextPageToken(AIndex : Integer; const AValue : String);
  449. begin
  450. If (FnextPageToken=AValue) then exit;
  451. FnextPageToken:=AValue;
  452. MarkPropertyChanged(AIndex);
  453. end;
  454. //2.6.4. bug workaround
  455. {$IFDEF VER2_6}
  456. Procedure TListActivitiesResponse.SetArrayLength(Const AName : String; ALength : Longint);
  457. begin
  458. Case AName of
  459. 'activities' : SetLength(Factivities,ALength);
  460. else
  461. Inherited SetArrayLength(AName,ALength);
  462. end;
  463. end;
  464. {$ENDIF VER2_6}
  465. { --------------------------------------------------------------------
  466. TMove
  467. --------------------------------------------------------------------}
  468. Procedure TMove.SetaddedParents(AIndex : Integer; const AValue : TMoveTypeaddedParentsArray);
  469. begin
  470. If (FaddedParents=AValue) then exit;
  471. FaddedParents:=AValue;
  472. MarkPropertyChanged(AIndex);
  473. end;
  474. Procedure TMove.SetremovedParents(AIndex : Integer; const AValue : TMoveTyperemovedParentsArray);
  475. begin
  476. If (FremovedParents=AValue) then exit;
  477. FremovedParents:=AValue;
  478. MarkPropertyChanged(AIndex);
  479. end;
  480. //2.6.4. bug workaround
  481. {$IFDEF VER2_6}
  482. Procedure TMove.SetArrayLength(Const AName : String; ALength : Longint);
  483. begin
  484. Case AName of
  485. 'addedparents' : SetLength(FaddedParents,ALength);
  486. 'removedparents' : SetLength(FremovedParents,ALength);
  487. else
  488. Inherited SetArrayLength(AName,ALength);
  489. end;
  490. end;
  491. {$ENDIF VER2_6}
  492. { --------------------------------------------------------------------
  493. TParent
  494. --------------------------------------------------------------------}
  495. Procedure TParent.Setid(AIndex : Integer; const AValue : String);
  496. begin
  497. If (Fid=AValue) then exit;
  498. Fid:=AValue;
  499. MarkPropertyChanged(AIndex);
  500. end;
  501. Procedure TParent.SetisRoot(AIndex : Integer; const AValue : boolean);
  502. begin
  503. If (FisRoot=AValue) then exit;
  504. FisRoot:=AValue;
  505. MarkPropertyChanged(AIndex);
  506. end;
  507. Procedure TParent.Settitle(AIndex : Integer; const AValue : String);
  508. begin
  509. If (Ftitle=AValue) then exit;
  510. Ftitle:=AValue;
  511. MarkPropertyChanged(AIndex);
  512. end;
  513. { --------------------------------------------------------------------
  514. TPermission
  515. --------------------------------------------------------------------}
  516. Procedure TPermission.Setname(AIndex : Integer; const AValue : String);
  517. begin
  518. If (Fname=AValue) then exit;
  519. Fname:=AValue;
  520. MarkPropertyChanged(AIndex);
  521. end;
  522. Procedure TPermission.SetpermissionId(AIndex : Integer; const AValue : String);
  523. begin
  524. If (FpermissionId=AValue) then exit;
  525. FpermissionId:=AValue;
  526. MarkPropertyChanged(AIndex);
  527. end;
  528. Procedure TPermission.Setrole(AIndex : Integer; const AValue : String);
  529. begin
  530. If (Frole=AValue) then exit;
  531. Frole:=AValue;
  532. MarkPropertyChanged(AIndex);
  533. end;
  534. Procedure TPermission.Set_type(AIndex : Integer; const AValue : String);
  535. begin
  536. If (F_type=AValue) then exit;
  537. F_type:=AValue;
  538. MarkPropertyChanged(AIndex);
  539. end;
  540. Procedure TPermission.Setuser(AIndex : Integer; const AValue : TUser);
  541. begin
  542. If (Fuser=AValue) then exit;
  543. Fuser:=AValue;
  544. MarkPropertyChanged(AIndex);
  545. end;
  546. Procedure TPermission.SetwithLink(AIndex : Integer; const AValue : boolean);
  547. begin
  548. If (FwithLink=AValue) then exit;
  549. FwithLink:=AValue;
  550. MarkPropertyChanged(AIndex);
  551. end;
  552. Class Function TPermission.ExportPropertyName(Const AName : String) :String;
  553. begin
  554. Case AName of
  555. '_type' : Result:='type';
  556. else
  557. Result:=Inherited ExportPropertyName(AName);
  558. end;
  559. end;
  560. { --------------------------------------------------------------------
  561. TPermissionChange
  562. --------------------------------------------------------------------}
  563. Procedure TPermissionChange.SetaddedPermissions(AIndex : Integer; const AValue : TPermissionChangeTypeaddedPermissionsArray);
  564. begin
  565. If (FaddedPermissions=AValue) then exit;
  566. FaddedPermissions:=AValue;
  567. MarkPropertyChanged(AIndex);
  568. end;
  569. Procedure TPermissionChange.SetremovedPermissions(AIndex : Integer; const AValue : TPermissionChangeTyperemovedPermissionsArray);
  570. begin
  571. If (FremovedPermissions=AValue) then exit;
  572. FremovedPermissions:=AValue;
  573. MarkPropertyChanged(AIndex);
  574. end;
  575. //2.6.4. bug workaround
  576. {$IFDEF VER2_6}
  577. Procedure TPermissionChange.SetArrayLength(Const AName : String; ALength : Longint);
  578. begin
  579. Case AName of
  580. 'addedpermissions' : SetLength(FaddedPermissions,ALength);
  581. 'removedpermissions' : SetLength(FremovedPermissions,ALength);
  582. else
  583. Inherited SetArrayLength(AName,ALength);
  584. end;
  585. end;
  586. {$ENDIF VER2_6}
  587. { --------------------------------------------------------------------
  588. TPhoto
  589. --------------------------------------------------------------------}
  590. Procedure TPhoto.Seturl(AIndex : Integer; const AValue : String);
  591. begin
  592. If (Furl=AValue) then exit;
  593. Furl:=AValue;
  594. MarkPropertyChanged(AIndex);
  595. end;
  596. { --------------------------------------------------------------------
  597. TRename
  598. --------------------------------------------------------------------}
  599. Procedure TRename.SetnewTitle(AIndex : Integer; const AValue : String);
  600. begin
  601. If (FnewTitle=AValue) then exit;
  602. FnewTitle:=AValue;
  603. MarkPropertyChanged(AIndex);
  604. end;
  605. Procedure TRename.SetoldTitle(AIndex : Integer; const AValue : String);
  606. begin
  607. If (FoldTitle=AValue) then exit;
  608. FoldTitle:=AValue;
  609. MarkPropertyChanged(AIndex);
  610. end;
  611. { --------------------------------------------------------------------
  612. TTarget
  613. --------------------------------------------------------------------}
  614. Procedure TTarget.Setid(AIndex : Integer; const AValue : String);
  615. begin
  616. If (Fid=AValue) then exit;
  617. Fid:=AValue;
  618. MarkPropertyChanged(AIndex);
  619. end;
  620. Procedure TTarget.SetmimeType(AIndex : Integer; const AValue : String);
  621. begin
  622. If (FmimeType=AValue) then exit;
  623. FmimeType:=AValue;
  624. MarkPropertyChanged(AIndex);
  625. end;
  626. Procedure TTarget.Setname(AIndex : Integer; const AValue : String);
  627. begin
  628. If (Fname=AValue) then exit;
  629. Fname:=AValue;
  630. MarkPropertyChanged(AIndex);
  631. end;
  632. { --------------------------------------------------------------------
  633. TUser
  634. --------------------------------------------------------------------}
  635. Procedure TUser.SetisDeleted(AIndex : Integer; const AValue : boolean);
  636. begin
  637. If (FisDeleted=AValue) then exit;
  638. FisDeleted:=AValue;
  639. MarkPropertyChanged(AIndex);
  640. end;
  641. Procedure TUser.Setname(AIndex : Integer; const AValue : String);
  642. begin
  643. If (Fname=AValue) then exit;
  644. Fname:=AValue;
  645. MarkPropertyChanged(AIndex);
  646. end;
  647. Procedure TUser.SetpermissionId(AIndex : Integer; const AValue : String);
  648. begin
  649. If (FpermissionId=AValue) then exit;
  650. FpermissionId:=AValue;
  651. MarkPropertyChanged(AIndex);
  652. end;
  653. Procedure TUser.Setphoto(AIndex : Integer; const AValue : TPhoto);
  654. begin
  655. If (Fphoto=AValue) then exit;
  656. Fphoto:=AValue;
  657. MarkPropertyChanged(AIndex);
  658. end;
  659. { --------------------------------------------------------------------
  660. TActivitiesResource
  661. --------------------------------------------------------------------}
  662. Class Function TActivitiesResource.ResourceName : String;
  663. begin
  664. Result:='activities';
  665. end;
  666. Class Function TActivitiesResource.DefaultAPI : TGoogleAPIClass;
  667. begin
  668. Result:=TappsactivityAPI;
  669. end;
  670. Function TActivitiesResource.List(AQuery : string = '') : TListActivitiesResponse;
  671. Const
  672. _HTTPMethod = 'GET';
  673. _Path = 'activities';
  674. _Methodid = 'appsactivity.activities.list';
  675. begin
  676. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,Nil,TListActivitiesResponse) as TListActivitiesResponse;
  677. end;
  678. Function TActivitiesResource.List(AQuery : TActivitieslistOptions) : TListActivitiesResponse;
  679. Var
  680. _Q : String;
  681. begin
  682. _Q:='';
  683. AddToQuery(_Q,'drive.ancestorId',AQuery.driveancestorId);
  684. AddToQuery(_Q,'drive.fileId',AQuery.drivefileId);
  685. AddToQuery(_Q,'groupingStrategy',AQuery.groupingStrategy);
  686. AddToQuery(_Q,'pageSize',AQuery.pageSize);
  687. AddToQuery(_Q,'pageToken',AQuery.pageToken);
  688. AddToQuery(_Q,'source',AQuery.source);
  689. AddToQuery(_Q,'userId',AQuery.userId);
  690. Result:=List(_Q);
  691. end;
  692. { --------------------------------------------------------------------
  693. TAppsactivityAPI
  694. --------------------------------------------------------------------}
  695. Class Function TAppsactivityAPI.APIName : String;
  696. begin
  697. Result:='appsactivity';
  698. end;
  699. Class Function TAppsactivityAPI.APIVersion : String;
  700. begin
  701. Result:='v1';
  702. end;
  703. Class Function TAppsactivityAPI.APIRevision : String;
  704. begin
  705. Result:='20160129';
  706. end;
  707. Class Function TAppsactivityAPI.APIID : String;
  708. begin
  709. Result:='appsactivity:v1';
  710. end;
  711. Class Function TAppsactivityAPI.APITitle : String;
  712. begin
  713. Result:='Google Apps Activity API';
  714. end;
  715. Class Function TAppsactivityAPI.APIDescription : String;
  716. begin
  717. Result:='Provides a historical view of activity.';
  718. end;
  719. Class Function TAppsactivityAPI.APIOwnerDomain : String;
  720. begin
  721. Result:='google.com';
  722. end;
  723. Class Function TAppsactivityAPI.APIOwnerName : String;
  724. begin
  725. Result:='Google';
  726. end;
  727. Class Function TAppsactivityAPI.APIIcon16 : String;
  728. begin
  729. Result:='http://www.google.com/images/icons/product/search-16.gif';
  730. end;
  731. Class Function TAppsactivityAPI.APIIcon32 : String;
  732. begin
  733. Result:='http://www.google.com/images/icons/product/search-32.gif';
  734. end;
  735. Class Function TAppsactivityAPI.APIdocumentationLink : String;
  736. begin
  737. Result:='https://developers.google.com/google-apps/activity/';
  738. end;
  739. Class Function TAppsactivityAPI.APIrootUrl : string;
  740. begin
  741. Result:='https://www.googleapis.com/';
  742. end;
  743. Class Function TAppsactivityAPI.APIbasePath : string;
  744. begin
  745. Result:='/appsactivity/v1/';
  746. end;
  747. Class Function TAppsactivityAPI.APIbaseURL : String;
  748. begin
  749. Result:='https://www.googleapis.com/appsactivity/v1/';
  750. end;
  751. Class Function TAppsactivityAPI.APIProtocol : string;
  752. begin
  753. Result:='rest';
  754. end;
  755. Class Function TAppsactivityAPI.APIservicePath : string;
  756. begin
  757. Result:='appsactivity/v1/';
  758. end;
  759. Class Function TAppsactivityAPI.APIbatchPath : String;
  760. begin
  761. Result:='batch';
  762. end;
  763. Class Function TAppsactivityAPI.APIAuthScopes : TScopeInfoArray;
  764. begin
  765. SetLength(Result,5);
  766. Result[0].Name:='https://www.googleapis.com/auth/activity';
  767. Result[0].Description:='View the activity history of your Google Apps';
  768. Result[1].Name:='https://www.googleapis.com/auth/drive';
  769. Result[1].Description:='View and manage the files in your Google Drive';
  770. Result[2].Name:='https://www.googleapis.com/auth/drive.metadata';
  771. Result[2].Description:='View and manage metadata of files in your Google Drive';
  772. Result[3].Name:='https://www.googleapis.com/auth/drive.metadata.readonly';
  773. Result[3].Description:='View metadata for files in your Google Drive';
  774. Result[4].Name:='https://www.googleapis.com/auth/drive.readonly';
  775. Result[4].Description:='View the files in your Google Drive';
  776. end;
  777. Class Function TAppsactivityAPI.APINeedsAuth : Boolean;
  778. begin
  779. Result:=True;
  780. end;
  781. Class Procedure TAppsactivityAPI.RegisterAPIResources;
  782. begin
  783. TActivity.RegisterObject;
  784. TEvent.RegisterObject;
  785. TListActivitiesResponse.RegisterObject;
  786. TMove.RegisterObject;
  787. TParent.RegisterObject;
  788. TPermission.RegisterObject;
  789. TPermissionChange.RegisterObject;
  790. TPhoto.RegisterObject;
  791. TRename.RegisterObject;
  792. TTarget.RegisterObject;
  793. TUser.RegisterObject;
  794. end;
  795. Function TAppsactivityAPI.GetActivitiesInstance : TActivitiesResource;
  796. begin
  797. if (FActivitiesInstance=Nil) then
  798. FActivitiesInstance:=CreateActivitiesResource;
  799. Result:=FActivitiesInstance;
  800. end;
  801. Function TAppsactivityAPI.CreateActivitiesResource : TActivitiesResource;
  802. begin
  803. Result:=CreateActivitiesResource(Self);
  804. end;
  805. Function TAppsactivityAPI.CreateActivitiesResource(AOwner : TComponent) : TActivitiesResource;
  806. begin
  807. Result:=TActivitiesResource.Create(AOwner);
  808. Result.API:=Self.API;
  809. end;
  810. initialization
  811. TAppsactivityAPI.RegisterAPI;
  812. end.