googleyoutubeanalytics.pp 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943
  1. unit googleyoutubeAnalytics;
  2. {$MODE objfpc}
  3. {$H+}
  4. interface
  5. uses sysutils, classes, googleservice, restbase, googlebase;
  6. type
  7. //Top-level schema types
  8. TBatchReport = Class;
  9. TBatchReportDefinition = Class;
  10. TBatchReportDefinitionList = Class;
  11. TBatchReportList = Class;
  12. TGroup = Class;
  13. TGroupItem = Class;
  14. TGroupItemListResponse = Class;
  15. TGroupListResponse = Class;
  16. TResultTable = Class;
  17. TBatchReportArray = Array of TBatchReport;
  18. TBatchReportDefinitionArray = Array of TBatchReportDefinition;
  19. TBatchReportDefinitionListArray = Array of TBatchReportDefinitionList;
  20. TBatchReportListArray = Array of TBatchReportList;
  21. TGroupArray = Array of TGroup;
  22. TGroupItemArray = Array of TGroupItem;
  23. TGroupItemListResponseArray = Array of TGroupItemListResponse;
  24. TGroupListResponseArray = Array of TGroupListResponse;
  25. TResultTableArray = Array of TResultTable;
  26. //Anonymous types, using auto-generated names
  27. TBatchReportTypeoutputsItem = Class;
  28. TBatchReportTypetimeSpan = Class;
  29. TGroupTypecontentDetails = Class;
  30. TGroupTypesnippet = Class;
  31. TGroupItemTyperesource = Class;
  32. TResultTableTypecolumnHeadersItem = Class;
  33. TBatchReportTypeoutputsArray = Array of TBatchReportTypeoutputsItem;
  34. TBatchReportDefinitionListTypeitemsArray = Array of TBatchReportDefinition;
  35. TBatchReportListTypeitemsArray = Array of TBatchReport;
  36. TGroupItemListResponseTypeitemsArray = Array of TGroupItem;
  37. TGroupListResponseTypeitemsArray = Array of TGroup;
  38. TResultTableTypecolumnHeadersArray = Array of TResultTableTypecolumnHeadersItem;
  39. TResultTableTyperowsArray = Array of TTJSONSchemaArray;
  40. { --------------------------------------------------------------------
  41. TBatchReportTypeoutputsItem
  42. --------------------------------------------------------------------}
  43. TBatchReportTypeoutputsItem = Class(TGoogleBaseObject)
  44. Private
  45. FdownloadUrl : String;
  46. Fformat : String;
  47. F_type : String;
  48. Protected
  49. Class Function ExportPropertyName(Const AName : String) : string; override;
  50. //Property setters
  51. Procedure SetdownloadUrl(AIndex : Integer; const AValue : String); virtual;
  52. Procedure Setformat(AIndex : Integer; const AValue : String); virtual;
  53. Procedure Set_type(AIndex : Integer; const AValue : String); virtual;
  54. Public
  55. Published
  56. Property downloadUrl : String Index 0 Read FdownloadUrl Write SetdownloadUrl;
  57. Property format : String Index 8 Read Fformat Write Setformat;
  58. Property _type : String Index 16 Read F_type Write Set_type;
  59. end;
  60. TBatchReportTypeoutputsItemClass = Class of TBatchReportTypeoutputsItem;
  61. { --------------------------------------------------------------------
  62. TBatchReportTypetimeSpan
  63. --------------------------------------------------------------------}
  64. TBatchReportTypetimeSpan = Class(TGoogleBaseObject)
  65. Private
  66. FendTime : TDatetime;
  67. FstartTime : TDatetime;
  68. Protected
  69. //Property setters
  70. Procedure SetendTime(AIndex : Integer; const AValue : TDatetime); virtual;
  71. Procedure SetstartTime(AIndex : Integer; const AValue : TDatetime); virtual;
  72. Public
  73. Published
  74. Property endTime : TDatetime Index 0 Read FendTime Write SetendTime;
  75. Property startTime : TDatetime Index 8 Read FstartTime Write SetstartTime;
  76. end;
  77. TBatchReportTypetimeSpanClass = Class of TBatchReportTypetimeSpan;
  78. { --------------------------------------------------------------------
  79. TBatchReport
  80. --------------------------------------------------------------------}
  81. TBatchReport = Class(TGoogleBaseObject)
  82. Private
  83. Fid : String;
  84. Fkind : String;
  85. Foutputs : TBatchReportTypeoutputsArray;
  86. FreportId : String;
  87. FtimeSpan : TBatchReportTypetimeSpan;
  88. FtimeUpdated : TDatetime;
  89. Protected
  90. //Property setters
  91. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  92. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  93. Procedure Setoutputs(AIndex : Integer; const AValue : TBatchReportTypeoutputsArray); virtual;
  94. Procedure SetreportId(AIndex : Integer; const AValue : String); virtual;
  95. Procedure SettimeSpan(AIndex : Integer; const AValue : TBatchReportTypetimeSpan); virtual;
  96. Procedure SettimeUpdated(AIndex : Integer; const AValue : TDatetime); virtual;
  97. //2.6.4. bug workaround
  98. {$IFDEF VER2_6}
  99. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  100. {$ENDIF VER2_6}
  101. Public
  102. Published
  103. Property id : String Index 0 Read Fid Write Setid;
  104. Property kind : String Index 8 Read Fkind Write Setkind;
  105. Property outputs : TBatchReportTypeoutputsArray Index 16 Read Foutputs Write Setoutputs;
  106. Property reportId : String Index 24 Read FreportId Write SetreportId;
  107. Property timeSpan : TBatchReportTypetimeSpan Index 32 Read FtimeSpan Write SettimeSpan;
  108. Property timeUpdated : TDatetime Index 40 Read FtimeUpdated Write SettimeUpdated;
  109. end;
  110. TBatchReportClass = Class of TBatchReport;
  111. { --------------------------------------------------------------------
  112. TBatchReportDefinition
  113. --------------------------------------------------------------------}
  114. TBatchReportDefinition = Class(TGoogleBaseObject)
  115. Private
  116. Fid : String;
  117. Fkind : String;
  118. Fname : String;
  119. Fstatus : String;
  120. F_type : String;
  121. Protected
  122. Class Function ExportPropertyName(Const AName : String) : string; override;
  123. //Property setters
  124. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  125. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  126. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  127. Procedure Setstatus(AIndex : Integer; const AValue : String); virtual;
  128. Procedure Set_type(AIndex : Integer; const AValue : String); virtual;
  129. Public
  130. Published
  131. Property id : String Index 0 Read Fid Write Setid;
  132. Property kind : String Index 8 Read Fkind Write Setkind;
  133. Property name : String Index 16 Read Fname Write Setname;
  134. Property status : String Index 24 Read Fstatus Write Setstatus;
  135. Property _type : String Index 32 Read F_type Write Set_type;
  136. end;
  137. TBatchReportDefinitionClass = Class of TBatchReportDefinition;
  138. { --------------------------------------------------------------------
  139. TBatchReportDefinitionList
  140. --------------------------------------------------------------------}
  141. TBatchReportDefinitionList = Class(TGoogleBaseObject)
  142. Private
  143. Fitems : TBatchReportDefinitionListTypeitemsArray;
  144. Fkind : String;
  145. Protected
  146. //Property setters
  147. Procedure Setitems(AIndex : Integer; const AValue : TBatchReportDefinitionListTypeitemsArray); virtual;
  148. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  149. //2.6.4. bug workaround
  150. {$IFDEF VER2_6}
  151. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  152. {$ENDIF VER2_6}
  153. Public
  154. Published
  155. Property items : TBatchReportDefinitionListTypeitemsArray Index 0 Read Fitems Write Setitems;
  156. Property kind : String Index 8 Read Fkind Write Setkind;
  157. end;
  158. TBatchReportDefinitionListClass = Class of TBatchReportDefinitionList;
  159. { --------------------------------------------------------------------
  160. TBatchReportList
  161. --------------------------------------------------------------------}
  162. TBatchReportList = Class(TGoogleBaseObject)
  163. Private
  164. Fitems : TBatchReportListTypeitemsArray;
  165. Fkind : String;
  166. Protected
  167. //Property setters
  168. Procedure Setitems(AIndex : Integer; const AValue : TBatchReportListTypeitemsArray); virtual;
  169. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  170. //2.6.4. bug workaround
  171. {$IFDEF VER2_6}
  172. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  173. {$ENDIF VER2_6}
  174. Public
  175. Published
  176. Property items : TBatchReportListTypeitemsArray Index 0 Read Fitems Write Setitems;
  177. Property kind : String Index 8 Read Fkind Write Setkind;
  178. end;
  179. TBatchReportListClass = Class of TBatchReportList;
  180. { --------------------------------------------------------------------
  181. TGroupTypecontentDetails
  182. --------------------------------------------------------------------}
  183. TGroupTypecontentDetails = Class(TGoogleBaseObject)
  184. Private
  185. FitemCount : String;
  186. FitemType : String;
  187. Protected
  188. //Property setters
  189. Procedure SetitemCount(AIndex : Integer; const AValue : String); virtual;
  190. Procedure SetitemType(AIndex : Integer; const AValue : String); virtual;
  191. Public
  192. Published
  193. Property itemCount : String Index 0 Read FitemCount Write SetitemCount;
  194. Property itemType : String Index 8 Read FitemType Write SetitemType;
  195. end;
  196. TGroupTypecontentDetailsClass = Class of TGroupTypecontentDetails;
  197. { --------------------------------------------------------------------
  198. TGroupTypesnippet
  199. --------------------------------------------------------------------}
  200. TGroupTypesnippet = Class(TGoogleBaseObject)
  201. Private
  202. FpublishedAt : TDatetime;
  203. Ftitle : String;
  204. Protected
  205. //Property setters
  206. Procedure SetpublishedAt(AIndex : Integer; const AValue : TDatetime); virtual;
  207. Procedure Settitle(AIndex : Integer; const AValue : String); virtual;
  208. Public
  209. Published
  210. Property publishedAt : TDatetime Index 0 Read FpublishedAt Write SetpublishedAt;
  211. Property title : String Index 8 Read Ftitle Write Settitle;
  212. end;
  213. TGroupTypesnippetClass = Class of TGroupTypesnippet;
  214. { --------------------------------------------------------------------
  215. TGroup
  216. --------------------------------------------------------------------}
  217. TGroup = Class(TGoogleBaseObject)
  218. Private
  219. FcontentDetails : TGroupTypecontentDetails;
  220. Fetag : String;
  221. Fid : String;
  222. Fkind : String;
  223. Fsnippet : TGroupTypesnippet;
  224. Protected
  225. //Property setters
  226. Procedure SetcontentDetails(AIndex : Integer; const AValue : TGroupTypecontentDetails); virtual;
  227. Procedure Setetag(AIndex : Integer; const AValue : String); virtual;
  228. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  229. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  230. Procedure Setsnippet(AIndex : Integer; const AValue : TGroupTypesnippet); virtual;
  231. Public
  232. Published
  233. Property contentDetails : TGroupTypecontentDetails Index 0 Read FcontentDetails Write SetcontentDetails;
  234. Property etag : String Index 8 Read Fetag Write Setetag;
  235. Property id : String Index 16 Read Fid Write Setid;
  236. Property kind : String Index 24 Read Fkind Write Setkind;
  237. Property snippet : TGroupTypesnippet Index 32 Read Fsnippet Write Setsnippet;
  238. end;
  239. TGroupClass = Class of TGroup;
  240. { --------------------------------------------------------------------
  241. TGroupItemTyperesource
  242. --------------------------------------------------------------------}
  243. TGroupItemTyperesource = Class(TGoogleBaseObject)
  244. Private
  245. Fid : String;
  246. Fkind : String;
  247. Protected
  248. //Property setters
  249. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  250. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  251. Public
  252. Published
  253. Property id : String Index 0 Read Fid Write Setid;
  254. Property kind : String Index 8 Read Fkind Write Setkind;
  255. end;
  256. TGroupItemTyperesourceClass = Class of TGroupItemTyperesource;
  257. { --------------------------------------------------------------------
  258. TGroupItem
  259. --------------------------------------------------------------------}
  260. TGroupItem = Class(TGoogleBaseObject)
  261. Private
  262. Fetag : String;
  263. FgroupId : String;
  264. Fid : String;
  265. Fkind : String;
  266. Fresource : TGroupItemTyperesource;
  267. Protected
  268. //Property setters
  269. Procedure Setetag(AIndex : Integer; const AValue : String); virtual;
  270. Procedure SetgroupId(AIndex : Integer; const AValue : String); virtual;
  271. Procedure Setid(AIndex : Integer; const AValue : String); virtual;
  272. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  273. Procedure Setresource(AIndex : Integer; const AValue : TGroupItemTyperesource); virtual;
  274. Public
  275. Published
  276. Property etag : String Index 0 Read Fetag Write Setetag;
  277. Property groupId : String Index 8 Read FgroupId Write SetgroupId;
  278. Property id : String Index 16 Read Fid Write Setid;
  279. Property kind : String Index 24 Read Fkind Write Setkind;
  280. Property resource : TGroupItemTyperesource Index 32 Read Fresource Write Setresource;
  281. end;
  282. TGroupItemClass = Class of TGroupItem;
  283. { --------------------------------------------------------------------
  284. TGroupItemListResponse
  285. --------------------------------------------------------------------}
  286. TGroupItemListResponse = Class(TGoogleBaseObject)
  287. Private
  288. Fetag : String;
  289. Fitems : TGroupItemListResponseTypeitemsArray;
  290. Fkind : String;
  291. Protected
  292. //Property setters
  293. Procedure Setetag(AIndex : Integer; const AValue : String); virtual;
  294. Procedure Setitems(AIndex : Integer; const AValue : TGroupItemListResponseTypeitemsArray); virtual;
  295. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  296. //2.6.4. bug workaround
  297. {$IFDEF VER2_6}
  298. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  299. {$ENDIF VER2_6}
  300. Public
  301. Published
  302. Property etag : String Index 0 Read Fetag Write Setetag;
  303. Property items : TGroupItemListResponseTypeitemsArray Index 8 Read Fitems Write Setitems;
  304. Property kind : String Index 16 Read Fkind Write Setkind;
  305. end;
  306. TGroupItemListResponseClass = Class of TGroupItemListResponse;
  307. { --------------------------------------------------------------------
  308. TGroupListResponse
  309. --------------------------------------------------------------------}
  310. TGroupListResponse = Class(TGoogleBaseObject)
  311. Private
  312. Fetag : String;
  313. Fitems : TGroupListResponseTypeitemsArray;
  314. Fkind : String;
  315. FnextPageToken : String;
  316. Protected
  317. //Property setters
  318. Procedure Setetag(AIndex : Integer; const AValue : String); virtual;
  319. Procedure Setitems(AIndex : Integer; const AValue : TGroupListResponseTypeitemsArray); virtual;
  320. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  321. Procedure SetnextPageToken(AIndex : Integer; const AValue : String); virtual;
  322. //2.6.4. bug workaround
  323. {$IFDEF VER2_6}
  324. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  325. {$ENDIF VER2_6}
  326. Public
  327. Published
  328. Property etag : String Index 0 Read Fetag Write Setetag;
  329. Property items : TGroupListResponseTypeitemsArray Index 8 Read Fitems Write Setitems;
  330. Property kind : String Index 16 Read Fkind Write Setkind;
  331. Property nextPageToken : String Index 24 Read FnextPageToken Write SetnextPageToken;
  332. end;
  333. TGroupListResponseClass = Class of TGroupListResponse;
  334. { --------------------------------------------------------------------
  335. TResultTableTypecolumnHeadersItem
  336. --------------------------------------------------------------------}
  337. TResultTableTypecolumnHeadersItem = Class(TGoogleBaseObject)
  338. Private
  339. FcolumnType : String;
  340. FdataType : String;
  341. Fname : String;
  342. Protected
  343. //Property setters
  344. Procedure SetcolumnType(AIndex : Integer; const AValue : String); virtual;
  345. Procedure SetdataType(AIndex : Integer; const AValue : String); virtual;
  346. Procedure Setname(AIndex : Integer; const AValue : String); virtual;
  347. Public
  348. Published
  349. Property columnType : String Index 0 Read FcolumnType Write SetcolumnType;
  350. Property dataType : String Index 8 Read FdataType Write SetdataType;
  351. Property name : String Index 16 Read Fname Write Setname;
  352. end;
  353. TResultTableTypecolumnHeadersItemClass = Class of TResultTableTypecolumnHeadersItem;
  354. { --------------------------------------------------------------------
  355. TResultTable
  356. --------------------------------------------------------------------}
  357. TResultTable = Class(TGoogleBaseObject)
  358. Private
  359. FcolumnHeaders : TResultTableTypecolumnHeadersArray;
  360. Fkind : String;
  361. Frows : TResultTableTyperowsArray;
  362. Protected
  363. //Property setters
  364. Procedure SetcolumnHeaders(AIndex : Integer; const AValue : TResultTableTypecolumnHeadersArray); virtual;
  365. Procedure Setkind(AIndex : Integer; const AValue : String); virtual;
  366. Procedure Setrows(AIndex : Integer; const AValue : TResultTableTyperowsArray); virtual;
  367. //2.6.4. bug workaround
  368. {$IFDEF VER2_6}
  369. Procedure SetArrayLength(Const AName : String; ALength : Longint); override;
  370. {$ENDIF VER2_6}
  371. Public
  372. Published
  373. Property columnHeaders : TResultTableTypecolumnHeadersArray Index 0 Read FcolumnHeaders Write SetcolumnHeaders;
  374. Property kind : String Index 8 Read Fkind Write Setkind;
  375. Property rows : TResultTableTyperowsArray Index 16 Read Frows Write Setrows;
  376. end;
  377. TResultTableClass = Class of TResultTable;
  378. { --------------------------------------------------------------------
  379. TBatchReportDefinitionsResource
  380. --------------------------------------------------------------------}
  381. //Optional query Options for TBatchReportDefinitionsResource, method List
  382. TBatchReportDefinitionsListOptions = Record
  383. onBehalfOfContentOwner : String;
  384. end;
  385. TBatchReportDefinitionsResource = Class(TGoogleResource)
  386. Public
  387. Class Function ResourceName : String; override;
  388. Class Function DefaultAPI : TGoogleAPIClass; override;
  389. Function List(AQuery : string = '') : TBatchReportDefinitionList;
  390. Function List(AQuery : TBatchReportDefinitionslistOptions) : TBatchReportDefinitionList;
  391. end;
  392. { --------------------------------------------------------------------
  393. TBatchReportsResource
  394. --------------------------------------------------------------------}
  395. //Optional query Options for TBatchReportsResource, method List
  396. TBatchReportsListOptions = Record
  397. batchReportDefinitionId : String;
  398. onBehalfOfContentOwner : String;
  399. end;
  400. TBatchReportsResource = Class(TGoogleResource)
  401. Public
  402. Class Function ResourceName : String; override;
  403. Class Function DefaultAPI : TGoogleAPIClass; override;
  404. Function List(AQuery : string = '') : TBatchReportList;
  405. Function List(AQuery : TBatchReportslistOptions) : TBatchReportList;
  406. end;
  407. { --------------------------------------------------------------------
  408. TGroupItemsResource
  409. --------------------------------------------------------------------}
  410. //Optional query Options for TGroupItemsResource, method Delete
  411. TGroupItemsDeleteOptions = Record
  412. id : String;
  413. onBehalfOfContentOwner : String;
  414. end;
  415. //Optional query Options for TGroupItemsResource, method Insert
  416. TGroupItemsInsertOptions = Record
  417. onBehalfOfContentOwner : String;
  418. end;
  419. //Optional query Options for TGroupItemsResource, method List
  420. TGroupItemsListOptions = Record
  421. groupId : String;
  422. onBehalfOfContentOwner : String;
  423. end;
  424. TGroupItemsResource = Class(TGoogleResource)
  425. Public
  426. Class Function ResourceName : String; override;
  427. Class Function DefaultAPI : TGoogleAPIClass; override;
  428. Procedure Delete(AQuery : string = '');
  429. Procedure Delete(AQuery : TGroupItemsdeleteOptions);
  430. Function Insert(aGroupItem : TGroupItem; AQuery : string = '') : TGroupItem;
  431. Function Insert(aGroupItem : TGroupItem; AQuery : TGroupItemsinsertOptions) : TGroupItem;
  432. Function List(AQuery : string = '') : TGroupItemListResponse;
  433. Function List(AQuery : TGroupItemslistOptions) : TGroupItemListResponse;
  434. end;
  435. { --------------------------------------------------------------------
  436. TGroupsResource
  437. --------------------------------------------------------------------}
  438. //Optional query Options for TGroupsResource, method Delete
  439. TGroupsDeleteOptions = Record
  440. id : String;
  441. onBehalfOfContentOwner : String;
  442. end;
  443. //Optional query Options for TGroupsResource, method Insert
  444. TGroupsInsertOptions = Record
  445. onBehalfOfContentOwner : String;
  446. end;
  447. //Optional query Options for TGroupsResource, method List
  448. TGroupsListOptions = Record
  449. id : String;
  450. mine : boolean;
  451. onBehalfOfContentOwner : String;
  452. pageToken : String;
  453. end;
  454. //Optional query Options for TGroupsResource, method Update
  455. TGroupsUpdateOptions = Record
  456. onBehalfOfContentOwner : String;
  457. end;
  458. TGroupsResource = Class(TGoogleResource)
  459. Public
  460. Class Function ResourceName : String; override;
  461. Class Function DefaultAPI : TGoogleAPIClass; override;
  462. Procedure Delete(AQuery : string = '');
  463. Procedure Delete(AQuery : TGroupsdeleteOptions);
  464. Function Insert(aGroup : TGroup; AQuery : string = '') : TGroup;
  465. Function Insert(aGroup : TGroup; AQuery : TGroupsinsertOptions) : TGroup;
  466. Function List(AQuery : string = '') : TGroupListResponse;
  467. Function List(AQuery : TGroupslistOptions) : TGroupListResponse;
  468. Function Update(aGroup : TGroup; AQuery : string = '') : TGroup;
  469. Function Update(aGroup : TGroup; AQuery : TGroupsupdateOptions) : TGroup;
  470. end;
  471. { --------------------------------------------------------------------
  472. TReportsResource
  473. --------------------------------------------------------------------}
  474. //Optional query Options for TReportsResource, method Query
  475. TReportsQueryOptions = Record
  476. currency : String;
  477. dimensions : String;
  478. enddate : String;
  479. filters : String;
  480. ids : String;
  481. maxresults : integer;
  482. metrics : String;
  483. sort : String;
  484. startdate : String;
  485. startindex : integer;
  486. end;
  487. TReportsResource = Class(TGoogleResource)
  488. Public
  489. Class Function ResourceName : String; override;
  490. Class Function DefaultAPI : TGoogleAPIClass; override;
  491. Function Query(AQuery : string = '') : TResultTable;
  492. Function Query(AQuery : TReportsqueryOptions) : TResultTable;
  493. end;
  494. { --------------------------------------------------------------------
  495. TYoutubeAnalyticsAPI
  496. --------------------------------------------------------------------}
  497. TYoutubeAnalyticsAPI = Class(TGoogleAPI)
  498. Private
  499. FBatchReportDefinitionsInstance : TBatchReportDefinitionsResource;
  500. FBatchReportsInstance : TBatchReportsResource;
  501. FGroupItemsInstance : TGroupItemsResource;
  502. FGroupsInstance : TGroupsResource;
  503. FReportsInstance : TReportsResource;
  504. Function GetBatchReportDefinitionsInstance : TBatchReportDefinitionsResource;virtual;
  505. Function GetBatchReportsInstance : TBatchReportsResource;virtual;
  506. Function GetGroupItemsInstance : TGroupItemsResource;virtual;
  507. Function GetGroupsInstance : TGroupsResource;virtual;
  508. Function GetReportsInstance : TReportsResource;virtual;
  509. Public
  510. //Override class functions with API info
  511. Class Function APIName : String; override;
  512. Class Function APIVersion : String; override;
  513. Class Function APIRevision : String; override;
  514. Class Function APIID : String; override;
  515. Class Function APITitle : String; override;
  516. Class Function APIDescription : String; override;
  517. Class Function APIOwnerDomain : String; override;
  518. Class Function APIOwnerName : String; override;
  519. Class Function APIIcon16 : String; override;
  520. Class Function APIIcon32 : String; override;
  521. Class Function APIdocumentationLink : String; override;
  522. Class Function APIrootUrl : string; override;
  523. Class Function APIbasePath : string;override;
  524. Class Function APIbaseURL : String;override;
  525. Class Function APIProtocol : string;override;
  526. Class Function APIservicePath : string;override;
  527. Class Function APIbatchPath : String;override;
  528. Class Function APIAuthScopes : TScopeInfoArray;override;
  529. Class Function APINeedsAuth : Boolean;override;
  530. Class Procedure RegisterAPIResources; override;
  531. //Add create function for resources
  532. Function CreateBatchReportDefinitionsResource(AOwner : TComponent) : TBatchReportDefinitionsResource;virtual;overload;
  533. Function CreateBatchReportDefinitionsResource : TBatchReportDefinitionsResource;virtual;overload;
  534. Function CreateBatchReportsResource(AOwner : TComponent) : TBatchReportsResource;virtual;overload;
  535. Function CreateBatchReportsResource : TBatchReportsResource;virtual;overload;
  536. Function CreateGroupItemsResource(AOwner : TComponent) : TGroupItemsResource;virtual;overload;
  537. Function CreateGroupItemsResource : TGroupItemsResource;virtual;overload;
  538. Function CreateGroupsResource(AOwner : TComponent) : TGroupsResource;virtual;overload;
  539. Function CreateGroupsResource : TGroupsResource;virtual;overload;
  540. Function CreateReportsResource(AOwner : TComponent) : TReportsResource;virtual;overload;
  541. Function CreateReportsResource : TReportsResource;virtual;overload;
  542. //Add default on-demand instances for resources
  543. Property BatchReportDefinitionsResource : TBatchReportDefinitionsResource Read GetBatchReportDefinitionsInstance;
  544. Property BatchReportsResource : TBatchReportsResource Read GetBatchReportsInstance;
  545. Property GroupItemsResource : TGroupItemsResource Read GetGroupItemsInstance;
  546. Property GroupsResource : TGroupsResource Read GetGroupsInstance;
  547. Property ReportsResource : TReportsResource Read GetReportsInstance;
  548. end;
  549. implementation
  550. { --------------------------------------------------------------------
  551. TBatchReportTypeoutputsItem
  552. --------------------------------------------------------------------}
  553. Procedure TBatchReportTypeoutputsItem.SetdownloadUrl(AIndex : Integer; const AValue : String);
  554. begin
  555. If (FdownloadUrl=AValue) then exit;
  556. FdownloadUrl:=AValue;
  557. MarkPropertyChanged(AIndex);
  558. end;
  559. Procedure TBatchReportTypeoutputsItem.Setformat(AIndex : Integer; const AValue : String);
  560. begin
  561. If (Fformat=AValue) then exit;
  562. Fformat:=AValue;
  563. MarkPropertyChanged(AIndex);
  564. end;
  565. Procedure TBatchReportTypeoutputsItem.Set_type(AIndex : Integer; const AValue : String);
  566. begin
  567. If (F_type=AValue) then exit;
  568. F_type:=AValue;
  569. MarkPropertyChanged(AIndex);
  570. end;
  571. Class Function TBatchReportTypeoutputsItem.ExportPropertyName(Const AName : String) :String;
  572. begin
  573. Case AName of
  574. '_type' : Result:='type';
  575. else
  576. Result:=Inherited ExportPropertyName(AName);
  577. end;
  578. end;
  579. { --------------------------------------------------------------------
  580. TBatchReportTypetimeSpan
  581. --------------------------------------------------------------------}
  582. Procedure TBatchReportTypetimeSpan.SetendTime(AIndex : Integer; const AValue : TDatetime);
  583. begin
  584. If (FendTime=AValue) then exit;
  585. FendTime:=AValue;
  586. MarkPropertyChanged(AIndex);
  587. end;
  588. Procedure TBatchReportTypetimeSpan.SetstartTime(AIndex : Integer; const AValue : TDatetime);
  589. begin
  590. If (FstartTime=AValue) then exit;
  591. FstartTime:=AValue;
  592. MarkPropertyChanged(AIndex);
  593. end;
  594. { --------------------------------------------------------------------
  595. TBatchReport
  596. --------------------------------------------------------------------}
  597. Procedure TBatchReport.Setid(AIndex : Integer; const AValue : String);
  598. begin
  599. If (Fid=AValue) then exit;
  600. Fid:=AValue;
  601. MarkPropertyChanged(AIndex);
  602. end;
  603. Procedure TBatchReport.Setkind(AIndex : Integer; const AValue : String);
  604. begin
  605. If (Fkind=AValue) then exit;
  606. Fkind:=AValue;
  607. MarkPropertyChanged(AIndex);
  608. end;
  609. Procedure TBatchReport.Setoutputs(AIndex : Integer; const AValue : TBatchReportTypeoutputsArray);
  610. begin
  611. If (Foutputs=AValue) then exit;
  612. Foutputs:=AValue;
  613. MarkPropertyChanged(AIndex);
  614. end;
  615. Procedure TBatchReport.SetreportId(AIndex : Integer; const AValue : String);
  616. begin
  617. If (FreportId=AValue) then exit;
  618. FreportId:=AValue;
  619. MarkPropertyChanged(AIndex);
  620. end;
  621. Procedure TBatchReport.SettimeSpan(AIndex : Integer; const AValue : TBatchReportTypetimeSpan);
  622. begin
  623. If (FtimeSpan=AValue) then exit;
  624. FtimeSpan:=AValue;
  625. MarkPropertyChanged(AIndex);
  626. end;
  627. Procedure TBatchReport.SettimeUpdated(AIndex : Integer; const AValue : TDatetime);
  628. begin
  629. If (FtimeUpdated=AValue) then exit;
  630. FtimeUpdated:=AValue;
  631. MarkPropertyChanged(AIndex);
  632. end;
  633. //2.6.4. bug workaround
  634. {$IFDEF VER2_6}
  635. Procedure TBatchReport.SetArrayLength(Const AName : String; ALength : Longint);
  636. begin
  637. Case AName of
  638. 'outputs' : SetLength(Foutputs,ALength);
  639. else
  640. Inherited SetArrayLength(AName,ALength);
  641. end;
  642. end;
  643. {$ENDIF VER2_6}
  644. { --------------------------------------------------------------------
  645. TBatchReportDefinition
  646. --------------------------------------------------------------------}
  647. Procedure TBatchReportDefinition.Setid(AIndex : Integer; const AValue : String);
  648. begin
  649. If (Fid=AValue) then exit;
  650. Fid:=AValue;
  651. MarkPropertyChanged(AIndex);
  652. end;
  653. Procedure TBatchReportDefinition.Setkind(AIndex : Integer; const AValue : String);
  654. begin
  655. If (Fkind=AValue) then exit;
  656. Fkind:=AValue;
  657. MarkPropertyChanged(AIndex);
  658. end;
  659. Procedure TBatchReportDefinition.Setname(AIndex : Integer; const AValue : String);
  660. begin
  661. If (Fname=AValue) then exit;
  662. Fname:=AValue;
  663. MarkPropertyChanged(AIndex);
  664. end;
  665. Procedure TBatchReportDefinition.Setstatus(AIndex : Integer; const AValue : String);
  666. begin
  667. If (Fstatus=AValue) then exit;
  668. Fstatus:=AValue;
  669. MarkPropertyChanged(AIndex);
  670. end;
  671. Procedure TBatchReportDefinition.Set_type(AIndex : Integer; const AValue : String);
  672. begin
  673. If (F_type=AValue) then exit;
  674. F_type:=AValue;
  675. MarkPropertyChanged(AIndex);
  676. end;
  677. Class Function TBatchReportDefinition.ExportPropertyName(Const AName : String) :String;
  678. begin
  679. Case AName of
  680. '_type' : Result:='type';
  681. else
  682. Result:=Inherited ExportPropertyName(AName);
  683. end;
  684. end;
  685. { --------------------------------------------------------------------
  686. TBatchReportDefinitionList
  687. --------------------------------------------------------------------}
  688. Procedure TBatchReportDefinitionList.Setitems(AIndex : Integer; const AValue : TBatchReportDefinitionListTypeitemsArray);
  689. begin
  690. If (Fitems=AValue) then exit;
  691. Fitems:=AValue;
  692. MarkPropertyChanged(AIndex);
  693. end;
  694. Procedure TBatchReportDefinitionList.Setkind(AIndex : Integer; const AValue : String);
  695. begin
  696. If (Fkind=AValue) then exit;
  697. Fkind:=AValue;
  698. MarkPropertyChanged(AIndex);
  699. end;
  700. //2.6.4. bug workaround
  701. {$IFDEF VER2_6}
  702. Procedure TBatchReportDefinitionList.SetArrayLength(Const AName : String; ALength : Longint);
  703. begin
  704. Case AName of
  705. 'items' : SetLength(Fitems,ALength);
  706. else
  707. Inherited SetArrayLength(AName,ALength);
  708. end;
  709. end;
  710. {$ENDIF VER2_6}
  711. { --------------------------------------------------------------------
  712. TBatchReportList
  713. --------------------------------------------------------------------}
  714. Procedure TBatchReportList.Setitems(AIndex : Integer; const AValue : TBatchReportListTypeitemsArray);
  715. begin
  716. If (Fitems=AValue) then exit;
  717. Fitems:=AValue;
  718. MarkPropertyChanged(AIndex);
  719. end;
  720. Procedure TBatchReportList.Setkind(AIndex : Integer; const AValue : String);
  721. begin
  722. If (Fkind=AValue) then exit;
  723. Fkind:=AValue;
  724. MarkPropertyChanged(AIndex);
  725. end;
  726. //2.6.4. bug workaround
  727. {$IFDEF VER2_6}
  728. Procedure TBatchReportList.SetArrayLength(Const AName : String; ALength : Longint);
  729. begin
  730. Case AName of
  731. 'items' : SetLength(Fitems,ALength);
  732. else
  733. Inherited SetArrayLength(AName,ALength);
  734. end;
  735. end;
  736. {$ENDIF VER2_6}
  737. { --------------------------------------------------------------------
  738. TGroupTypecontentDetails
  739. --------------------------------------------------------------------}
  740. Procedure TGroupTypecontentDetails.SetitemCount(AIndex : Integer; const AValue : String);
  741. begin
  742. If (FitemCount=AValue) then exit;
  743. FitemCount:=AValue;
  744. MarkPropertyChanged(AIndex);
  745. end;
  746. Procedure TGroupTypecontentDetails.SetitemType(AIndex : Integer; const AValue : String);
  747. begin
  748. If (FitemType=AValue) then exit;
  749. FitemType:=AValue;
  750. MarkPropertyChanged(AIndex);
  751. end;
  752. { --------------------------------------------------------------------
  753. TGroupTypesnippet
  754. --------------------------------------------------------------------}
  755. Procedure TGroupTypesnippet.SetpublishedAt(AIndex : Integer; const AValue : TDatetime);
  756. begin
  757. If (FpublishedAt=AValue) then exit;
  758. FpublishedAt:=AValue;
  759. MarkPropertyChanged(AIndex);
  760. end;
  761. Procedure TGroupTypesnippet.Settitle(AIndex : Integer; const AValue : String);
  762. begin
  763. If (Ftitle=AValue) then exit;
  764. Ftitle:=AValue;
  765. MarkPropertyChanged(AIndex);
  766. end;
  767. { --------------------------------------------------------------------
  768. TGroup
  769. --------------------------------------------------------------------}
  770. Procedure TGroup.SetcontentDetails(AIndex : Integer; const AValue : TGroupTypecontentDetails);
  771. begin
  772. If (FcontentDetails=AValue) then exit;
  773. FcontentDetails:=AValue;
  774. MarkPropertyChanged(AIndex);
  775. end;
  776. Procedure TGroup.Setetag(AIndex : Integer; const AValue : String);
  777. begin
  778. If (Fetag=AValue) then exit;
  779. Fetag:=AValue;
  780. MarkPropertyChanged(AIndex);
  781. end;
  782. Procedure TGroup.Setid(AIndex : Integer; const AValue : String);
  783. begin
  784. If (Fid=AValue) then exit;
  785. Fid:=AValue;
  786. MarkPropertyChanged(AIndex);
  787. end;
  788. Procedure TGroup.Setkind(AIndex : Integer; const AValue : String);
  789. begin
  790. If (Fkind=AValue) then exit;
  791. Fkind:=AValue;
  792. MarkPropertyChanged(AIndex);
  793. end;
  794. Procedure TGroup.Setsnippet(AIndex : Integer; const AValue : TGroupTypesnippet);
  795. begin
  796. If (Fsnippet=AValue) then exit;
  797. Fsnippet:=AValue;
  798. MarkPropertyChanged(AIndex);
  799. end;
  800. { --------------------------------------------------------------------
  801. TGroupItemTyperesource
  802. --------------------------------------------------------------------}
  803. Procedure TGroupItemTyperesource.Setid(AIndex : Integer; const AValue : String);
  804. begin
  805. If (Fid=AValue) then exit;
  806. Fid:=AValue;
  807. MarkPropertyChanged(AIndex);
  808. end;
  809. Procedure TGroupItemTyperesource.Setkind(AIndex : Integer; const AValue : String);
  810. begin
  811. If (Fkind=AValue) then exit;
  812. Fkind:=AValue;
  813. MarkPropertyChanged(AIndex);
  814. end;
  815. { --------------------------------------------------------------------
  816. TGroupItem
  817. --------------------------------------------------------------------}
  818. Procedure TGroupItem.Setetag(AIndex : Integer; const AValue : String);
  819. begin
  820. If (Fetag=AValue) then exit;
  821. Fetag:=AValue;
  822. MarkPropertyChanged(AIndex);
  823. end;
  824. Procedure TGroupItem.SetgroupId(AIndex : Integer; const AValue : String);
  825. begin
  826. If (FgroupId=AValue) then exit;
  827. FgroupId:=AValue;
  828. MarkPropertyChanged(AIndex);
  829. end;
  830. Procedure TGroupItem.Setid(AIndex : Integer; const AValue : String);
  831. begin
  832. If (Fid=AValue) then exit;
  833. Fid:=AValue;
  834. MarkPropertyChanged(AIndex);
  835. end;
  836. Procedure TGroupItem.Setkind(AIndex : Integer; const AValue : String);
  837. begin
  838. If (Fkind=AValue) then exit;
  839. Fkind:=AValue;
  840. MarkPropertyChanged(AIndex);
  841. end;
  842. Procedure TGroupItem.Setresource(AIndex : Integer; const AValue : TGroupItemTyperesource);
  843. begin
  844. If (Fresource=AValue) then exit;
  845. Fresource:=AValue;
  846. MarkPropertyChanged(AIndex);
  847. end;
  848. { --------------------------------------------------------------------
  849. TGroupItemListResponse
  850. --------------------------------------------------------------------}
  851. Procedure TGroupItemListResponse.Setetag(AIndex : Integer; const AValue : String);
  852. begin
  853. If (Fetag=AValue) then exit;
  854. Fetag:=AValue;
  855. MarkPropertyChanged(AIndex);
  856. end;
  857. Procedure TGroupItemListResponse.Setitems(AIndex : Integer; const AValue : TGroupItemListResponseTypeitemsArray);
  858. begin
  859. If (Fitems=AValue) then exit;
  860. Fitems:=AValue;
  861. MarkPropertyChanged(AIndex);
  862. end;
  863. Procedure TGroupItemListResponse.Setkind(AIndex : Integer; const AValue : String);
  864. begin
  865. If (Fkind=AValue) then exit;
  866. Fkind:=AValue;
  867. MarkPropertyChanged(AIndex);
  868. end;
  869. //2.6.4. bug workaround
  870. {$IFDEF VER2_6}
  871. Procedure TGroupItemListResponse.SetArrayLength(Const AName : String; ALength : Longint);
  872. begin
  873. Case AName of
  874. 'items' : SetLength(Fitems,ALength);
  875. else
  876. Inherited SetArrayLength(AName,ALength);
  877. end;
  878. end;
  879. {$ENDIF VER2_6}
  880. { --------------------------------------------------------------------
  881. TGroupListResponse
  882. --------------------------------------------------------------------}
  883. Procedure TGroupListResponse.Setetag(AIndex : Integer; const AValue : String);
  884. begin
  885. If (Fetag=AValue) then exit;
  886. Fetag:=AValue;
  887. MarkPropertyChanged(AIndex);
  888. end;
  889. Procedure TGroupListResponse.Setitems(AIndex : Integer; const AValue : TGroupListResponseTypeitemsArray);
  890. begin
  891. If (Fitems=AValue) then exit;
  892. Fitems:=AValue;
  893. MarkPropertyChanged(AIndex);
  894. end;
  895. Procedure TGroupListResponse.Setkind(AIndex : Integer; const AValue : String);
  896. begin
  897. If (Fkind=AValue) then exit;
  898. Fkind:=AValue;
  899. MarkPropertyChanged(AIndex);
  900. end;
  901. Procedure TGroupListResponse.SetnextPageToken(AIndex : Integer; const AValue : String);
  902. begin
  903. If (FnextPageToken=AValue) then exit;
  904. FnextPageToken:=AValue;
  905. MarkPropertyChanged(AIndex);
  906. end;
  907. //2.6.4. bug workaround
  908. {$IFDEF VER2_6}
  909. Procedure TGroupListResponse.SetArrayLength(Const AName : String; ALength : Longint);
  910. begin
  911. Case AName of
  912. 'items' : SetLength(Fitems,ALength);
  913. else
  914. Inherited SetArrayLength(AName,ALength);
  915. end;
  916. end;
  917. {$ENDIF VER2_6}
  918. { --------------------------------------------------------------------
  919. TResultTableTypecolumnHeadersItem
  920. --------------------------------------------------------------------}
  921. Procedure TResultTableTypecolumnHeadersItem.SetcolumnType(AIndex : Integer; const AValue : String);
  922. begin
  923. If (FcolumnType=AValue) then exit;
  924. FcolumnType:=AValue;
  925. MarkPropertyChanged(AIndex);
  926. end;
  927. Procedure TResultTableTypecolumnHeadersItem.SetdataType(AIndex : Integer; const AValue : String);
  928. begin
  929. If (FdataType=AValue) then exit;
  930. FdataType:=AValue;
  931. MarkPropertyChanged(AIndex);
  932. end;
  933. Procedure TResultTableTypecolumnHeadersItem.Setname(AIndex : Integer; const AValue : String);
  934. begin
  935. If (Fname=AValue) then exit;
  936. Fname:=AValue;
  937. MarkPropertyChanged(AIndex);
  938. end;
  939. { --------------------------------------------------------------------
  940. TResultTable
  941. --------------------------------------------------------------------}
  942. Procedure TResultTable.SetcolumnHeaders(AIndex : Integer; const AValue : TResultTableTypecolumnHeadersArray);
  943. begin
  944. If (FcolumnHeaders=AValue) then exit;
  945. FcolumnHeaders:=AValue;
  946. MarkPropertyChanged(AIndex);
  947. end;
  948. Procedure TResultTable.Setkind(AIndex : Integer; const AValue : String);
  949. begin
  950. If (Fkind=AValue) then exit;
  951. Fkind:=AValue;
  952. MarkPropertyChanged(AIndex);
  953. end;
  954. Procedure TResultTable.Setrows(AIndex : Integer; const AValue : TResultTableTyperowsArray);
  955. begin
  956. If (Frows=AValue) then exit;
  957. Frows:=AValue;
  958. MarkPropertyChanged(AIndex);
  959. end;
  960. //2.6.4. bug workaround
  961. {$IFDEF VER2_6}
  962. Procedure TResultTable.SetArrayLength(Const AName : String; ALength : Longint);
  963. begin
  964. Case AName of
  965. 'columnheaders' : SetLength(FcolumnHeaders,ALength);
  966. 'rows' : SetLength(Frows,ALength);
  967. else
  968. Inherited SetArrayLength(AName,ALength);
  969. end;
  970. end;
  971. {$ENDIF VER2_6}
  972. { --------------------------------------------------------------------
  973. TBatchReportDefinitionsResource
  974. --------------------------------------------------------------------}
  975. Class Function TBatchReportDefinitionsResource.ResourceName : String;
  976. begin
  977. Result:='batchReportDefinitions';
  978. end;
  979. Class Function TBatchReportDefinitionsResource.DefaultAPI : TGoogleAPIClass;
  980. begin
  981. Result:=TyoutubeAnalyticsAPI;
  982. end;
  983. Function TBatchReportDefinitionsResource.List(AQuery : string = '') : TBatchReportDefinitionList;
  984. Const
  985. _HTTPMethod = 'GET';
  986. _Path = 'batchReportDefinitions';
  987. _Methodid = 'youtubeAnalytics.batchReportDefinitions.list';
  988. begin
  989. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,Nil,TBatchReportDefinitionList) as TBatchReportDefinitionList;
  990. end;
  991. Function TBatchReportDefinitionsResource.List(AQuery : TBatchReportDefinitionslistOptions) : TBatchReportDefinitionList;
  992. Var
  993. _Q : String;
  994. begin
  995. _Q:='';
  996. AddToQuery(_Q,'onBehalfOfContentOwner',AQuery.onBehalfOfContentOwner);
  997. Result:=List(_Q);
  998. end;
  999. { --------------------------------------------------------------------
  1000. TBatchReportsResource
  1001. --------------------------------------------------------------------}
  1002. Class Function TBatchReportsResource.ResourceName : String;
  1003. begin
  1004. Result:='batchReports';
  1005. end;
  1006. Class Function TBatchReportsResource.DefaultAPI : TGoogleAPIClass;
  1007. begin
  1008. Result:=TyoutubeAnalyticsAPI;
  1009. end;
  1010. Function TBatchReportsResource.List(AQuery : string = '') : TBatchReportList;
  1011. Const
  1012. _HTTPMethod = 'GET';
  1013. _Path = 'batchReports';
  1014. _Methodid = 'youtubeAnalytics.batchReports.list';
  1015. begin
  1016. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,Nil,TBatchReportList) as TBatchReportList;
  1017. end;
  1018. Function TBatchReportsResource.List(AQuery : TBatchReportslistOptions) : TBatchReportList;
  1019. Var
  1020. _Q : String;
  1021. begin
  1022. _Q:='';
  1023. AddToQuery(_Q,'batchReportDefinitionId',AQuery.batchReportDefinitionId);
  1024. AddToQuery(_Q,'onBehalfOfContentOwner',AQuery.onBehalfOfContentOwner);
  1025. Result:=List(_Q);
  1026. end;
  1027. { --------------------------------------------------------------------
  1028. TGroupItemsResource
  1029. --------------------------------------------------------------------}
  1030. Class Function TGroupItemsResource.ResourceName : String;
  1031. begin
  1032. Result:='groupItems';
  1033. end;
  1034. Class Function TGroupItemsResource.DefaultAPI : TGoogleAPIClass;
  1035. begin
  1036. Result:=TyoutubeAnalyticsAPI;
  1037. end;
  1038. Procedure TGroupItemsResource.Delete(AQuery : string = '');
  1039. Const
  1040. _HTTPMethod = 'DELETE';
  1041. _Path = 'groupItems';
  1042. _Methodid = 'youtubeAnalytics.groupItems.delete';
  1043. begin
  1044. ServiceCall(_HTTPMethod,_Path,AQuery,Nil,Nil);
  1045. end;
  1046. Procedure TGroupItemsResource.Delete(AQuery : TGroupItemsdeleteOptions);
  1047. Var
  1048. _Q : String;
  1049. begin
  1050. _Q:='';
  1051. AddToQuery(_Q,'id',AQuery.id);
  1052. AddToQuery(_Q,'onBehalfOfContentOwner',AQuery.onBehalfOfContentOwner);
  1053. Delete(_Q);
  1054. end;
  1055. Function TGroupItemsResource.Insert(aGroupItem : TGroupItem; AQuery : string = '') : TGroupItem;
  1056. Const
  1057. _HTTPMethod = 'POST';
  1058. _Path = 'groupItems';
  1059. _Methodid = 'youtubeAnalytics.groupItems.insert';
  1060. begin
  1061. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,aGroupItem,TGroupItem) as TGroupItem;
  1062. end;
  1063. Function TGroupItemsResource.Insert(aGroupItem : TGroupItem; AQuery : TGroupItemsinsertOptions) : TGroupItem;
  1064. Var
  1065. _Q : String;
  1066. begin
  1067. _Q:='';
  1068. AddToQuery(_Q,'onBehalfOfContentOwner',AQuery.onBehalfOfContentOwner);
  1069. Result:=Insert(aGroupItem,_Q);
  1070. end;
  1071. Function TGroupItemsResource.List(AQuery : string = '') : TGroupItemListResponse;
  1072. Const
  1073. _HTTPMethod = 'GET';
  1074. _Path = 'groupItems';
  1075. _Methodid = 'youtubeAnalytics.groupItems.list';
  1076. begin
  1077. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,Nil,TGroupItemListResponse) as TGroupItemListResponse;
  1078. end;
  1079. Function TGroupItemsResource.List(AQuery : TGroupItemslistOptions) : TGroupItemListResponse;
  1080. Var
  1081. _Q : String;
  1082. begin
  1083. _Q:='';
  1084. AddToQuery(_Q,'groupId',AQuery.groupId);
  1085. AddToQuery(_Q,'onBehalfOfContentOwner',AQuery.onBehalfOfContentOwner);
  1086. Result:=List(_Q);
  1087. end;
  1088. { --------------------------------------------------------------------
  1089. TGroupsResource
  1090. --------------------------------------------------------------------}
  1091. Class Function TGroupsResource.ResourceName : String;
  1092. begin
  1093. Result:='groups';
  1094. end;
  1095. Class Function TGroupsResource.DefaultAPI : TGoogleAPIClass;
  1096. begin
  1097. Result:=TyoutubeAnalyticsAPI;
  1098. end;
  1099. Procedure TGroupsResource.Delete(AQuery : string = '');
  1100. Const
  1101. _HTTPMethod = 'DELETE';
  1102. _Path = 'groups';
  1103. _Methodid = 'youtubeAnalytics.groups.delete';
  1104. begin
  1105. ServiceCall(_HTTPMethod,_Path,AQuery,Nil,Nil);
  1106. end;
  1107. Procedure TGroupsResource.Delete(AQuery : TGroupsdeleteOptions);
  1108. Var
  1109. _Q : String;
  1110. begin
  1111. _Q:='';
  1112. AddToQuery(_Q,'id',AQuery.id);
  1113. AddToQuery(_Q,'onBehalfOfContentOwner',AQuery.onBehalfOfContentOwner);
  1114. Delete(_Q);
  1115. end;
  1116. Function TGroupsResource.Insert(aGroup : TGroup; AQuery : string = '') : TGroup;
  1117. Const
  1118. _HTTPMethod = 'POST';
  1119. _Path = 'groups';
  1120. _Methodid = 'youtubeAnalytics.groups.insert';
  1121. begin
  1122. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,aGroup,TGroup) as TGroup;
  1123. end;
  1124. Function TGroupsResource.Insert(aGroup : TGroup; AQuery : TGroupsinsertOptions) : TGroup;
  1125. Var
  1126. _Q : String;
  1127. begin
  1128. _Q:='';
  1129. AddToQuery(_Q,'onBehalfOfContentOwner',AQuery.onBehalfOfContentOwner);
  1130. Result:=Insert(aGroup,_Q);
  1131. end;
  1132. Function TGroupsResource.List(AQuery : string = '') : TGroupListResponse;
  1133. Const
  1134. _HTTPMethod = 'GET';
  1135. _Path = 'groups';
  1136. _Methodid = 'youtubeAnalytics.groups.list';
  1137. begin
  1138. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,Nil,TGroupListResponse) as TGroupListResponse;
  1139. end;
  1140. Function TGroupsResource.List(AQuery : TGroupslistOptions) : TGroupListResponse;
  1141. Var
  1142. _Q : String;
  1143. begin
  1144. _Q:='';
  1145. AddToQuery(_Q,'id',AQuery.id);
  1146. AddToQuery(_Q,'mine',AQuery.mine);
  1147. AddToQuery(_Q,'onBehalfOfContentOwner',AQuery.onBehalfOfContentOwner);
  1148. AddToQuery(_Q,'pageToken',AQuery.pageToken);
  1149. Result:=List(_Q);
  1150. end;
  1151. Function TGroupsResource.Update(aGroup : TGroup; AQuery : string = '') : TGroup;
  1152. Const
  1153. _HTTPMethod = 'PUT';
  1154. _Path = 'groups';
  1155. _Methodid = 'youtubeAnalytics.groups.update';
  1156. begin
  1157. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,aGroup,TGroup) as TGroup;
  1158. end;
  1159. Function TGroupsResource.Update(aGroup : TGroup; AQuery : TGroupsupdateOptions) : TGroup;
  1160. Var
  1161. _Q : String;
  1162. begin
  1163. _Q:='';
  1164. AddToQuery(_Q,'onBehalfOfContentOwner',AQuery.onBehalfOfContentOwner);
  1165. Result:=Update(aGroup,_Q);
  1166. end;
  1167. { --------------------------------------------------------------------
  1168. TReportsResource
  1169. --------------------------------------------------------------------}
  1170. Class Function TReportsResource.ResourceName : String;
  1171. begin
  1172. Result:='reports';
  1173. end;
  1174. Class Function TReportsResource.DefaultAPI : TGoogleAPIClass;
  1175. begin
  1176. Result:=TyoutubeAnalyticsAPI;
  1177. end;
  1178. Function TReportsResource.Query(AQuery : string = '') : TResultTable;
  1179. Const
  1180. _HTTPMethod = 'GET';
  1181. _Path = 'reports';
  1182. _Methodid = 'youtubeAnalytics.reports.query';
  1183. begin
  1184. Result:=ServiceCall(_HTTPMethod,_Path,AQuery,Nil,TResultTable) as TResultTable;
  1185. end;
  1186. Function TReportsResource.Query(AQuery : TReportsqueryOptions) : TResultTable;
  1187. Var
  1188. _Q : String;
  1189. begin
  1190. _Q:='';
  1191. AddToQuery(_Q,'currency',AQuery.currency);
  1192. AddToQuery(_Q,'dimensions',AQuery.dimensions);
  1193. AddToQuery(_Q,'end-date',AQuery.enddate);
  1194. AddToQuery(_Q,'filters',AQuery.filters);
  1195. AddToQuery(_Q,'ids',AQuery.ids);
  1196. AddToQuery(_Q,'max-results',AQuery.maxresults);
  1197. AddToQuery(_Q,'metrics',AQuery.metrics);
  1198. AddToQuery(_Q,'sort',AQuery.sort);
  1199. AddToQuery(_Q,'start-date',AQuery.startdate);
  1200. AddToQuery(_Q,'start-index',AQuery.startindex);
  1201. Result:=Query(_Q);
  1202. end;
  1203. { --------------------------------------------------------------------
  1204. TYoutubeAnalyticsAPI
  1205. --------------------------------------------------------------------}
  1206. Class Function TYoutubeAnalyticsAPI.APIName : String;
  1207. begin
  1208. Result:='youtubeAnalytics';
  1209. end;
  1210. Class Function TYoutubeAnalyticsAPI.APIVersion : String;
  1211. begin
  1212. Result:='v1';
  1213. end;
  1214. Class Function TYoutubeAnalyticsAPI.APIRevision : String;
  1215. begin
  1216. Result:='20160513';
  1217. end;
  1218. Class Function TYoutubeAnalyticsAPI.APIID : String;
  1219. begin
  1220. Result:='youtubeAnalytics:v1';
  1221. end;
  1222. Class Function TYoutubeAnalyticsAPI.APITitle : String;
  1223. begin
  1224. Result:='YouTube Analytics API';
  1225. end;
  1226. Class Function TYoutubeAnalyticsAPI.APIDescription : String;
  1227. begin
  1228. Result:='Retrieves your YouTube Analytics data.';
  1229. end;
  1230. Class Function TYoutubeAnalyticsAPI.APIOwnerDomain : String;
  1231. begin
  1232. Result:='google.com';
  1233. end;
  1234. Class Function TYoutubeAnalyticsAPI.APIOwnerName : String;
  1235. begin
  1236. Result:='Google';
  1237. end;
  1238. Class Function TYoutubeAnalyticsAPI.APIIcon16 : String;
  1239. begin
  1240. Result:='https://www.google.com/images/icons/product/youtube-16.png';
  1241. end;
  1242. Class Function TYoutubeAnalyticsAPI.APIIcon32 : String;
  1243. begin
  1244. Result:='https://www.google.com/images/icons/product/youtube-32.png';
  1245. end;
  1246. Class Function TYoutubeAnalyticsAPI.APIdocumentationLink : String;
  1247. begin
  1248. Result:='http://developers.google.com/youtube/analytics/';
  1249. end;
  1250. Class Function TYoutubeAnalyticsAPI.APIrootUrl : string;
  1251. begin
  1252. Result:='https://www.googleapis.com/';
  1253. end;
  1254. Class Function TYoutubeAnalyticsAPI.APIbasePath : string;
  1255. begin
  1256. Result:='/youtube/analytics/v1/';
  1257. end;
  1258. Class Function TYoutubeAnalyticsAPI.APIbaseURL : String;
  1259. begin
  1260. Result:='https://www.googleapis.com/youtube/analytics/v1/';
  1261. end;
  1262. Class Function TYoutubeAnalyticsAPI.APIProtocol : string;
  1263. begin
  1264. Result:='rest';
  1265. end;
  1266. Class Function TYoutubeAnalyticsAPI.APIservicePath : string;
  1267. begin
  1268. Result:='youtube/analytics/v1/';
  1269. end;
  1270. Class Function TYoutubeAnalyticsAPI.APIbatchPath : String;
  1271. begin
  1272. Result:='batch';
  1273. end;
  1274. Class Function TYoutubeAnalyticsAPI.APIAuthScopes : TScopeInfoArray;
  1275. begin
  1276. SetLength(Result,5);
  1277. Result[0].Name:='https://www.googleapis.com/auth/youtube';
  1278. Result[0].Description:='Manage your YouTube account';
  1279. Result[1].Name:='https://www.googleapis.com/auth/youtube.readonly';
  1280. Result[1].Description:='View your YouTube account';
  1281. Result[2].Name:='https://www.googleapis.com/auth/youtubepartner';
  1282. Result[2].Description:='View and manage your assets and associated content on YouTube';
  1283. Result[3].Name:='https://www.googleapis.com/auth/yt-analytics-monetary.readonly';
  1284. Result[3].Description:='View monetary and non-monetary YouTube Analytics reports for your YouTube content';
  1285. Result[4].Name:='https://www.googleapis.com/auth/yt-analytics.readonly';
  1286. Result[4].Description:='View YouTube Analytics reports for your YouTube content';
  1287. end;
  1288. Class Function TYoutubeAnalyticsAPI.APINeedsAuth : Boolean;
  1289. begin
  1290. Result:=True;
  1291. end;
  1292. Class Procedure TYoutubeAnalyticsAPI.RegisterAPIResources;
  1293. begin
  1294. TBatchReportTypeoutputsItem.RegisterObject;
  1295. TBatchReportTypetimeSpan.RegisterObject;
  1296. TBatchReport.RegisterObject;
  1297. TBatchReportDefinition.RegisterObject;
  1298. TBatchReportDefinitionList.RegisterObject;
  1299. TBatchReportList.RegisterObject;
  1300. TGroupTypecontentDetails.RegisterObject;
  1301. TGroupTypesnippet.RegisterObject;
  1302. TGroup.RegisterObject;
  1303. TGroupItemTyperesource.RegisterObject;
  1304. TGroupItem.RegisterObject;
  1305. TGroupItemListResponse.RegisterObject;
  1306. TGroupListResponse.RegisterObject;
  1307. TResultTableTypecolumnHeadersItem.RegisterObject;
  1308. TResultTable.RegisterObject;
  1309. end;
  1310. Function TYoutubeAnalyticsAPI.GetBatchReportDefinitionsInstance : TBatchReportDefinitionsResource;
  1311. begin
  1312. if (FBatchReportDefinitionsInstance=Nil) then
  1313. FBatchReportDefinitionsInstance:=CreateBatchReportDefinitionsResource;
  1314. Result:=FBatchReportDefinitionsInstance;
  1315. end;
  1316. Function TYoutubeAnalyticsAPI.CreateBatchReportDefinitionsResource : TBatchReportDefinitionsResource;
  1317. begin
  1318. Result:=CreateBatchReportDefinitionsResource(Self);
  1319. end;
  1320. Function TYoutubeAnalyticsAPI.CreateBatchReportDefinitionsResource(AOwner : TComponent) : TBatchReportDefinitionsResource;
  1321. begin
  1322. Result:=TBatchReportDefinitionsResource.Create(AOwner);
  1323. Result.API:=Self.API;
  1324. end;
  1325. Function TYoutubeAnalyticsAPI.GetBatchReportsInstance : TBatchReportsResource;
  1326. begin
  1327. if (FBatchReportsInstance=Nil) then
  1328. FBatchReportsInstance:=CreateBatchReportsResource;
  1329. Result:=FBatchReportsInstance;
  1330. end;
  1331. Function TYoutubeAnalyticsAPI.CreateBatchReportsResource : TBatchReportsResource;
  1332. begin
  1333. Result:=CreateBatchReportsResource(Self);
  1334. end;
  1335. Function TYoutubeAnalyticsAPI.CreateBatchReportsResource(AOwner : TComponent) : TBatchReportsResource;
  1336. begin
  1337. Result:=TBatchReportsResource.Create(AOwner);
  1338. Result.API:=Self.API;
  1339. end;
  1340. Function TYoutubeAnalyticsAPI.GetGroupItemsInstance : TGroupItemsResource;
  1341. begin
  1342. if (FGroupItemsInstance=Nil) then
  1343. FGroupItemsInstance:=CreateGroupItemsResource;
  1344. Result:=FGroupItemsInstance;
  1345. end;
  1346. Function TYoutubeAnalyticsAPI.CreateGroupItemsResource : TGroupItemsResource;
  1347. begin
  1348. Result:=CreateGroupItemsResource(Self);
  1349. end;
  1350. Function TYoutubeAnalyticsAPI.CreateGroupItemsResource(AOwner : TComponent) : TGroupItemsResource;
  1351. begin
  1352. Result:=TGroupItemsResource.Create(AOwner);
  1353. Result.API:=Self.API;
  1354. end;
  1355. Function TYoutubeAnalyticsAPI.GetGroupsInstance : TGroupsResource;
  1356. begin
  1357. if (FGroupsInstance=Nil) then
  1358. FGroupsInstance:=CreateGroupsResource;
  1359. Result:=FGroupsInstance;
  1360. end;
  1361. Function TYoutubeAnalyticsAPI.CreateGroupsResource : TGroupsResource;
  1362. begin
  1363. Result:=CreateGroupsResource(Self);
  1364. end;
  1365. Function TYoutubeAnalyticsAPI.CreateGroupsResource(AOwner : TComponent) : TGroupsResource;
  1366. begin
  1367. Result:=TGroupsResource.Create(AOwner);
  1368. Result.API:=Self.API;
  1369. end;
  1370. Function TYoutubeAnalyticsAPI.GetReportsInstance : TReportsResource;
  1371. begin
  1372. if (FReportsInstance=Nil) then
  1373. FReportsInstance:=CreateReportsResource;
  1374. Result:=FReportsInstance;
  1375. end;
  1376. Function TYoutubeAnalyticsAPI.CreateReportsResource : TReportsResource;
  1377. begin
  1378. Result:=CreateReportsResource(Self);
  1379. end;
  1380. Function TYoutubeAnalyticsAPI.CreateReportsResource(AOwner : TComponent) : TReportsResource;
  1381. begin
  1382. Result:=TReportsResource.Create(AOwner);
  1383. Result.API:=Self.API;
  1384. end;
  1385. initialization
  1386. TYoutubeAnalyticsAPI.RegisterAPI;
  1387. end.