google-api-client 0.8.7 → 0.9.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (397) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +20 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +7 -0
  5. data/.rubocop_todo.yml +63 -0
  6. data/.travis.yml +21 -0
  7. data/.yardopts +12 -0
  8. data/CHANGELOG.md +6 -3
  9. data/CONTRIBUTING.md +31 -0
  10. data/Gemfile +28 -2
  11. data/MIGRATING.md +171 -0
  12. data/README.md +158 -150
  13. data/Rakefile +1 -40
  14. data/api_names.yaml +872 -0
  15. data/api_names_out.yaml +20843 -0
  16. data/bin/generate-api +93 -0
  17. data/generated/google/apis/adexchangebuyer_v1_3.rb +35 -0
  18. data/generated/google/apis/adexchangebuyer_v1_3/classes.rb +1124 -0
  19. data/generated/google/apis/adexchangebuyer_v1_3/representations.rb +375 -0
  20. data/generated/google/apis/adexchangebuyer_v1_3/service.rb +893 -0
  21. data/generated/google/apis/adexchangeseller_v2_0.rb +38 -0
  22. data/generated/google/apis/adexchangeseller_v2_0/classes.rb +792 -0
  23. data/generated/google/apis/adexchangeseller_v2_0/representations.rb +309 -0
  24. data/generated/google/apis/adexchangeseller_v2_0/service.rb +682 -0
  25. data/generated/google/apis/admin_directory_v1.rb +89 -0
  26. data/generated/google/apis/admin_directory_v1/classes.rb +2389 -0
  27. data/generated/google/apis/admin_directory_v1/representations.rb +780 -0
  28. data/generated/google/apis/admin_directory_v1/service.rb +2805 -0
  29. data/generated/google/apis/admin_reports_v1.rb +38 -0
  30. data/generated/google/apis/admin_reports_v1/classes.rb +582 -0
  31. data/generated/google/apis/admin_reports_v1/representations.rb +231 -0
  32. data/generated/google/apis/admin_reports_v1/service.rb +341 -0
  33. data/generated/google/apis/adsense_v1_4.rb +38 -0
  34. data/generated/google/apis/adsense_v1_4/classes.rb +1279 -0
  35. data/generated/google/apis/adsense_v1_4/representations.rb +493 -0
  36. data/generated/google/apis/adsense_v1_4/service.rb +1752 -0
  37. data/generated/google/apis/adsensehost_v4_1.rb +35 -0
  38. data/generated/google/apis/adsensehost_v4_1/classes.rb +834 -0
  39. data/generated/google/apis/adsensehost_v4_1/representations.rb +327 -0
  40. data/generated/google/apis/adsensehost_v4_1/service.rb +1190 -0
  41. data/generated/google/apis/analytics_v3.rb +49 -0
  42. data/generated/google/apis/analytics_v3/classes.rb +5113 -0
  43. data/generated/google/apis/analytics_v3/representations.rb +1661 -0
  44. data/generated/google/apis/analytics_v3/service.rb +3600 -0
  45. data/generated/google/apis/androidenterprise_v1.rb +34 -0
  46. data/generated/google/apis/androidenterprise_v1/classes.rb +1162 -0
  47. data/generated/google/apis/androidenterprise_v1/representations.rb +431 -0
  48. data/generated/google/apis/androidenterprise_v1/service.rb +1979 -0
  49. data/generated/google/apis/androidpublisher_v2.rb +34 -0
  50. data/generated/google/apis/androidpublisher_v2/classes.rb +1374 -0
  51. data/generated/google/apis/androidpublisher_v2/representations.rb +630 -0
  52. data/generated/google/apis/androidpublisher_v2/service.rb +2390 -0
  53. data/generated/google/apis/appsactivity_v1.rb +46 -0
  54. data/generated/google/apis/appsactivity_v1/classes.rb +392 -0
  55. data/generated/google/apis/appsactivity_v1/representations.rb +184 -0
  56. data/generated/google/apis/appsactivity_v1/service.rb +129 -0
  57. data/generated/google/apis/appstate_v1.rb +34 -0
  58. data/generated/google/apis/appstate_v1/classes.rb +154 -0
  59. data/generated/google/apis/appstate_v1/representations.rb +79 -0
  60. data/generated/google/apis/appstate_v1/service.rb +265 -0
  61. data/generated/google/apis/autoscaler_v1beta2.rb +38 -0
  62. data/generated/google/apis/autoscaler_v1beta2/classes.rb +747 -0
  63. data/generated/google/apis/autoscaler_v1beta2/representations.rb +281 -0
  64. data/generated/google/apis/autoscaler_v1beta2/service.rb +488 -0
  65. data/generated/google/apis/bigquery_v2.rb +49 -0
  66. data/generated/google/apis/bigquery_v2/classes.rb +2255 -0
  67. data/generated/google/apis/bigquery_v2/representations.rb +754 -0
  68. data/generated/google/apis/bigquery_v2/service.rb +1003 -0
  69. data/generated/google/apis/blogger_v3.rb +37 -0
  70. data/generated/google/apis/blogger_v3/classes.rb +1354 -0
  71. data/generated/google/apis/blogger_v3/representations.rb +562 -0
  72. data/generated/google/apis/blogger_v3/service.rb +1620 -0
  73. data/generated/google/apis/books_v1.rb +34 -0
  74. data/generated/google/apis/books_v1/classes.rb +3515 -0
  75. data/generated/google/apis/books_v1/representations.rb +1361 -0
  76. data/generated/google/apis/books_v1/service.rb +2170 -0
  77. data/generated/google/apis/calendar_v3.rb +37 -0
  78. data/generated/google/apis/calendar_v3/classes.rb +1702 -0
  79. data/generated/google/apis/calendar_v3/representations.rb +566 -0
  80. data/generated/google/apis/calendar_v3/service.rb +1943 -0
  81. data/generated/google/apis/civicinfo_v2.rb +31 -0
  82. data/generated/google/apis/civicinfo_v2/classes.rb +1057 -0
  83. data/generated/google/apis/civicinfo_v2/representations.rb +374 -0
  84. data/generated/google/apis/civicinfo_v2/service.rb +284 -0
  85. data/generated/google/apis/cloudmonitoring_v2beta2.rb +34 -0
  86. data/generated/google/apis/cloudmonitoring_v2beta2/classes.rb +679 -0
  87. data/generated/google/apis/cloudmonitoring_v2beta2/representations.rb +311 -0
  88. data/generated/google/apis/cloudmonitoring_v2beta2/service.rb +458 -0
  89. data/generated/google/apis/cloudresourcemanager_v1beta1.rb +38 -0
  90. data/generated/google/apis/cloudresourcemanager_v1beta1/classes.rb +139 -0
  91. data/generated/google/apis/cloudresourcemanager_v1beta1/representations.rb +65 -0
  92. data/generated/google/apis/cloudresourcemanager_v1beta1/service.rb +301 -0
  93. data/generated/google/apis/compute_v1.rb +49 -0
  94. data/generated/google/apis/compute_v1/classes.rb +6391 -0
  95. data/generated/google/apis/compute_v1/representations.rb +2209 -0
  96. data/generated/google/apis/compute_v1/service.rb +6352 -0
  97. data/generated/google/apis/container_v1beta1.rb +35 -0
  98. data/generated/google/apis/container_v1beta1/classes.rb +466 -0
  99. data/generated/google/apis/container_v1beta1/representations.rb +177 -0
  100. data/generated/google/apis/container_v1beta1/service.rb +394 -0
  101. data/generated/google/apis/content_v2.rb +35 -0
  102. data/generated/google/apis/content_v2/classes.rb +3780 -0
  103. data/generated/google/apis/content_v2/representations.rb +1456 -0
  104. data/generated/google/apis/content_v2/service.rb +1706 -0
  105. data/generated/google/apis/coordinate_v1.rb +37 -0
  106. data/generated/google/apis/coordinate_v1/classes.rb +669 -0
  107. data/generated/google/apis/coordinate_v1/representations.rb +285 -0
  108. data/generated/google/apis/coordinate_v1/service.rb +687 -0
  109. data/{lib/google/api_client/auth/compute_service_account.rb → generated/google/apis/customsearch_v1.rb} +13 -10
  110. data/generated/google/apis/customsearch_v1/classes.rb +771 -0
  111. data/generated/google/apis/customsearch_v1/representations.rb +276 -0
  112. data/generated/google/apis/customsearch_v1/service.rb +208 -0
  113. data/generated/google/apis/datastore_v1beta2.rb +40 -0
  114. data/generated/google/apis/datastore_v1beta2/classes.rb +1186 -0
  115. data/generated/google/apis/datastore_v1beta2/representations.rb +526 -0
  116. data/generated/google/apis/datastore_v1beta2/service.rb +300 -0
  117. data/generated/google/apis/deploymentmanager_v2beta2.rb +41 -0
  118. data/generated/google/apis/deploymentmanager_v2beta2/classes.rb +820 -0
  119. data/generated/google/apis/deploymentmanager_v2beta2/representations.rb +303 -0
  120. data/generated/google/apis/deploymentmanager_v2beta2/service.rb +647 -0
  121. data/generated/google/apis/dfareporting_v2_1.rb +37 -0
  122. data/generated/google/apis/dfareporting_v2_1/classes.rb +10755 -0
  123. data/generated/google/apis/dfareporting_v2_1/representations.rb +3438 -0
  124. data/generated/google/apis/dfareporting_v2_1/service.rb +8775 -0
  125. data/generated/google/apis/discovery_v1.rb +32 -0
  126. data/generated/google/apis/discovery_v1/classes.rb +947 -0
  127. data/generated/google/apis/discovery_v1/representations.rb +355 -0
  128. data/generated/google/apis/discovery_v1/service.rb +144 -0
  129. data/generated/google/apis/dns_v1.rb +41 -0
  130. data/generated/google/apis/dns_v1/classes.rb +406 -0
  131. data/generated/google/apis/dns_v1/representations.rb +151 -0
  132. data/generated/google/apis/dns_v1/service.rb +460 -0
  133. data/{spec/google/api_client/request_spec.rb → generated/google/apis/doubleclickbidmanager_v1.rb} +15 -13
  134. data/generated/google/apis/doubleclickbidmanager_v1/classes.rb +709 -0
  135. data/generated/google/apis/doubleclickbidmanager_v1/representations.rb +297 -0
  136. data/generated/google/apis/doubleclickbidmanager_v1/service.rb +349 -0
  137. data/generated/google/apis/doubleclicksearch_v2.rb +35 -0
  138. data/generated/google/apis/doubleclicksearch_v2/classes.rb +947 -0
  139. data/generated/google/apis/doubleclicksearch_v2/representations.rb +315 -0
  140. data/generated/google/apis/doubleclicksearch_v2/service.rb +490 -0
  141. data/generated/google/apis/drive_v2.rb +55 -0
  142. data/generated/google/apis/drive_v2/classes.rb +2519 -0
  143. data/generated/google/apis/drive_v2/representations.rb +781 -0
  144. data/generated/google/apis/drive_v2/service.rb +2685 -0
  145. data/generated/google/apis/fitness_v1.rb +49 -0
  146. data/generated/google/apis/fitness_v1/classes.rb +809 -0
  147. data/generated/google/apis/fitness_v1/representations.rb +295 -0
  148. data/generated/google/apis/fitness_v1/service.rb +684 -0
  149. data/generated/google/apis/fusiontables_v2.rb +37 -0
  150. data/generated/google/apis/fusiontables_v2/classes.rb +1048 -0
  151. data/generated/google/apis/fusiontables_v2/representations.rb +409 -0
  152. data/generated/google/apis/fusiontables_v2/service.rb +1496 -0
  153. data/generated/google/apis/games_configuration_v1configuration.rb +34 -0
  154. data/generated/google/apis/games_configuration_v1configuration/classes.rb +506 -0
  155. data/generated/google/apis/games_configuration_v1configuration/representations.rb +206 -0
  156. data/generated/google/apis/games_configuration_v1configuration/service.rb +578 -0
  157. data/generated/google/apis/games_v1.rb +40 -0
  158. data/generated/google/apis/games_v1/classes.rb +4578 -0
  159. data/generated/google/apis/games_v1/representations.rb +1570 -0
  160. data/generated/google/apis/games_v1/service.rb +2306 -0
  161. data/generated/google/apis/gan_v1beta1.rb +31 -0
  162. data/generated/google/apis/gan_v1beta1/classes.rb +1428 -0
  163. data/generated/google/apis/gan_v1beta1/representations.rb +428 -0
  164. data/generated/google/apis/gan_v1beta1/service.rb +692 -0
  165. data/generated/google/apis/genomics_v1beta2.rb +46 -0
  166. data/generated/google/apis/genomics_v1beta2/classes.rb +3288 -0
  167. data/generated/google/apis/genomics_v1beta2/representations.rb +1194 -0
  168. data/generated/google/apis/genomics_v1beta2/service.rb +2356 -0
  169. data/generated/google/apis/gmail_v1.rb +49 -0
  170. data/generated/google/apis/gmail_v1/classes.rb +794 -0
  171. data/generated/google/apis/gmail_v1/representations.rb +339 -0
  172. data/generated/google/apis/gmail_v1/service.rb +1502 -0
  173. data/generated/google/apis/groupsmigration_v1.rb +34 -0
  174. data/generated/google/apis/groupsmigration_v1/classes.rb +51 -0
  175. data/generated/google/apis/groupsmigration_v1/representations.rb +38 -0
  176. data/generated/google/apis/groupsmigration_v1/service.rb +111 -0
  177. data/generated/google/apis/groupssettings_v1.rb +34 -0
  178. data/generated/google/apis/groupssettings_v1/classes.rb +221 -0
  179. data/generated/google/apis/groupssettings_v1/representations.rb +64 -0
  180. data/generated/google/apis/groupssettings_v1/service.rb +179 -0
  181. data/generated/google/apis/identitytoolkit_v3.rb +31 -0
  182. data/generated/google/apis/identitytoolkit_v3/classes.rb +1229 -0
  183. data/generated/google/apis/identitytoolkit_v3/representations.rb +422 -0
  184. data/generated/google/apis/identitytoolkit_v3/service.rb +491 -0
  185. data/generated/google/apis/licensing_v1.rb +34 -0
  186. data/generated/google/apis/licensing_v1/classes.rb +132 -0
  187. data/generated/google/apis/licensing_v1/representations.rb +68 -0
  188. data/generated/google/apis/licensing_v1/service.rb +376 -0
  189. data/generated/google/apis/logging_v1beta3.rb +35 -0
  190. data/generated/google/apis/logging_v1beta3/classes.rb +505 -0
  191. data/generated/google/apis/logging_v1beta3/representations.rb +222 -0
  192. data/generated/google/apis/logging_v1beta3/service.rb +670 -0
  193. data/generated/google/apis/manager_v1beta2.rb +50 -0
  194. data/generated/google/apis/manager_v1beta2/classes.rb +1287 -0
  195. data/generated/google/apis/manager_v1beta2/representations.rb +536 -0
  196. data/generated/google/apis/manager_v1beta2/service.rb +380 -0
  197. data/generated/google/apis/mapsengine_v1.rb +38 -0
  198. data/generated/google/apis/mapsengine_v1/classes.rb +2873 -0
  199. data/generated/google/apis/mapsengine_v1/representations.rb +1235 -0
  200. data/generated/google/apis/mapsengine_v1/service.rb +3465 -0
  201. data/generated/google/apis/mirror_v1.rb +37 -0
  202. data/generated/google/apis/mirror_v1/classes.rb +1072 -0
  203. data/generated/google/apis/mirror_v1/representations.rb +350 -0
  204. data/generated/google/apis/mirror_v1/service.rb +1001 -0
  205. data/generated/google/apis/oauth2_v2.rb +43 -0
  206. data/generated/google/apis/oauth2_v2/classes.rb +245 -0
  207. data/generated/google/apis/oauth2_v2/representations.rb +94 -0
  208. data/generated/google/apis/oauth2_v2/service.rb +203 -0
  209. data/generated/google/apis/pagespeedonline_v2.rb +32 -0
  210. data/generated/google/apis/pagespeedonline_v2/classes.rb +614 -0
  211. data/generated/google/apis/pagespeedonline_v2/representations.rb +244 -0
  212. data/generated/google/apis/pagespeedonline_v2/service.rb +120 -0
  213. data/generated/google/apis/plus_domains_v1.rb +61 -0
  214. data/generated/google/apis/plus_domains_v1/classes.rb +2402 -0
  215. data/generated/google/apis/plus_domains_v1/representations.rb +873 -0
  216. data/generated/google/apis/plus_domains_v1/service.rb +924 -0
  217. data/generated/google/apis/plus_v1.rb +43 -0
  218. data/generated/google/apis/plus_v1/classes.rb +2384 -0
  219. data/generated/google/apis/plus_v1/representations.rb +812 -0
  220. data/generated/google/apis/plus_v1/service.rb +616 -0
  221. data/generated/google/apis/prediction_v1_6.rb +44 -0
  222. data/generated/google/apis/prediction_v1_6/classes.rb +751 -0
  223. data/generated/google/apis/prediction_v1_6/representations.rb +327 -0
  224. data/generated/google/apis/prediction_v1_6/service.rb +388 -0
  225. data/generated/google/apis/pubsub_v1beta2.rb +37 -0
  226. data/generated/google/apis/pubsub_v1beta2/classes.rb +824 -0
  227. data/generated/google/apis/pubsub_v1beta2/representations.rb +366 -0
  228. data/generated/google/apis/pubsub_v1beta2/service.rb +778 -0
  229. data/generated/google/apis/qpx_express_v1.rb +31 -0
  230. data/generated/google/apis/qpx_express_v1/classes.rb +1268 -0
  231. data/generated/google/apis/qpx_express_v1/representations.rb +424 -0
  232. data/generated/google/apis/qpx_express_v1/service.rb +101 -0
  233. data/generated/google/apis/replicapool_v1beta2.rb +41 -0
  234. data/generated/google/apis/replicapool_v1beta2/classes.rb +621 -0
  235. data/generated/google/apis/replicapool_v1beta2/representations.rb +235 -0
  236. data/generated/google/apis/replicapool_v1beta2/service.rb +620 -0
  237. data/generated/google/apis/replicapoolupdater_v1beta1.rb +41 -0
  238. data/generated/google/apis/replicapoolupdater_v1beta1/classes.rb +682 -0
  239. data/generated/google/apis/replicapoolupdater_v1beta1/representations.rb +247 -0
  240. data/generated/google/apis/replicapoolupdater_v1beta1/service.rb +472 -0
  241. data/generated/google/apis/reseller_v1.rb +37 -0
  242. data/generated/google/apis/reseller_v1/classes.rb +502 -0
  243. data/generated/google/apis/reseller_v1/representations.rb +199 -0
  244. data/generated/google/apis/reseller_v1/service.rb +637 -0
  245. data/generated/google/apis/resourceviews_v1beta2.rb +47 -0
  246. data/generated/google/apis/resourceviews_v1beta2/classes.rb +660 -0
  247. data/generated/google/apis/resourceviews_v1beta2/representations.rb +269 -0
  248. data/generated/google/apis/resourceviews_v1beta2/service.rb +574 -0
  249. data/generated/google/apis/site_verification_v1.rb +37 -0
  250. data/generated/google/apis/site_verification_v1/classes.rb +185 -0
  251. data/generated/google/apis/site_verification_v1/representations.rb +101 -0
  252. data/generated/google/apis/site_verification_v1/service.rb +322 -0
  253. data/generated/google/apis/sqladmin_v1beta4.rb +37 -0
  254. data/generated/google/apis/sqladmin_v1beta4/classes.rb +1817 -0
  255. data/generated/google/apis/sqladmin_v1beta4/representations.rb +688 -0
  256. data/generated/google/apis/sqladmin_v1beta4/service.rb +1534 -0
  257. data/generated/google/apis/storage_v1.rb +43 -0
  258. data/generated/google/apis/storage_v1/classes.rb +1177 -0
  259. data/generated/google/apis/storage_v1/representations.rb +427 -0
  260. data/generated/google/apis/storage_v1/service.rb +1920 -0
  261. data/generated/google/apis/tagmanager_v1.rb +52 -0
  262. data/generated/google/apis/tagmanager_v1/classes.rb +1226 -0
  263. data/generated/google/apis/tagmanager_v1/representations.rb +461 -0
  264. data/generated/google/apis/tagmanager_v1/service.rb +1978 -0
  265. data/generated/google/apis/taskqueue_v1beta2.rb +37 -0
  266. data/generated/google/apis/taskqueue_v1beta2/classes.rb +254 -0
  267. data/generated/google/apis/taskqueue_v1beta2/representations.rb +114 -0
  268. data/generated/google/apis/taskqueue_v1beta2/service.rb +416 -0
  269. data/generated/google/apis/tasks_v1.rb +37 -0
  270. data/generated/google/apis/tasks_v1/classes.rb +296 -0
  271. data/generated/google/apis/tasks_v1/representations.rb +115 -0
  272. data/generated/google/apis/tasks_v1/service.rb +657 -0
  273. data/generated/google/apis/translate_v2.rb +31 -0
  274. data/generated/google/apis/translate_v2/classes.rb +168 -0
  275. data/generated/google/apis/translate_v2/representations.rb +109 -0
  276. data/generated/google/apis/translate_v2/service.rb +185 -0
  277. data/generated/google/apis/urlshortener_v1.rb +34 -0
  278. data/generated/google/apis/urlshortener_v1/classes.rb +246 -0
  279. data/generated/google/apis/urlshortener_v1/representations.rb +111 -0
  280. data/generated/google/apis/urlshortener_v1/service.rb +179 -0
  281. data/generated/google/apis/webmasters_v3.rb +37 -0
  282. data/generated/google/apis/webmasters_v3/classes.rb +563 -0
  283. data/generated/google/apis/webmasters_v3/representations.rb +250 -0
  284. data/generated/google/apis/webmasters_v3/service.rb +587 -0
  285. data/generated/google/apis/youtube_analytics_v1.rb +46 -0
  286. data/generated/google/apis/youtube_analytics_v1/classes.rb +540 -0
  287. data/generated/google/apis/youtube_analytics_v1/representations.rb +242 -0
  288. data/generated/google/apis/youtube_analytics_v1/service.rb +567 -0
  289. data/generated/google/apis/youtube_v3.rb +49 -0
  290. data/generated/google/apis/youtube_v3/classes.rb +7225 -0
  291. data/generated/google/apis/youtube_v3/representations.rb +2529 -0
  292. data/generated/google/apis/youtube_v3/service.rb +4051 -0
  293. data/google-api-client.gemspec +27 -39
  294. data/lib/google/api_client/auth/storage.rb +3 -2
  295. data/lib/google/api_client/auth/storages/file_store.rb +1 -3
  296. data/lib/google/api_client/auth/storages/redis_store.rb +6 -2
  297. data/lib/google/apis.rb +48 -0
  298. data/lib/google/apis/core/api_command.rb +128 -0
  299. data/lib/google/apis/core/base_service.rb +314 -0
  300. data/lib/google/apis/core/batch.rb +222 -0
  301. data/lib/google/apis/core/download.rb +94 -0
  302. data/lib/google/apis/core/hashable.rb +44 -0
  303. data/lib/google/apis/core/http_command.rb +275 -0
  304. data/lib/google/apis/core/json_representation.rb +122 -0
  305. data/lib/google/{api_client/version.rb → apis/core/logging.rb} +12 -8
  306. data/lib/google/apis/core/multipart.rb +173 -0
  307. data/lib/google/apis/core/upload.rb +275 -0
  308. data/lib/google/{api_client → apis}/errors.rb +32 -28
  309. data/lib/google/apis/generator.rb +70 -0
  310. data/lib/google/apis/generator/annotator.rb +271 -0
  311. data/lib/google/apis/generator/helpers.rb +74 -0
  312. data/lib/google/apis/generator/model.rb +130 -0
  313. data/lib/google/apis/generator/template.rb +124 -0
  314. data/lib/google/apis/generator/templates/_class.tmpl +40 -0
  315. data/lib/google/apis/generator/templates/_method.tmpl +90 -0
  316. data/lib/google/apis/generator/templates/_representation.tmpl +51 -0
  317. data/lib/google/apis/generator/templates/_representation_stub.tmpl +15 -0
  318. data/lib/google/apis/generator/templates/_representation_type.tmpl +10 -0
  319. data/lib/google/{api_client/reference.rb → apis/generator/templates/classes.rb.tmpl} +11 -9
  320. data/lib/google/apis/generator/templates/module.rb.tmpl +40 -0
  321. data/lib/google/apis/generator/templates/representations.rb.tmpl +32 -0
  322. data/lib/google/apis/generator/templates/service.rb.tmpl +60 -0
  323. data/lib/google/apis/options.rb +79 -0
  324. data/lib/google/apis/version.rb +39 -0
  325. data/rakelib/metrics.rake +22 -0
  326. data/rakelib/rubocop.rake +10 -0
  327. data/rakelib/spec.rake +11 -0
  328. data/rakelib/yard.rake +11 -0
  329. data/samples/calendar/calendar.rb +43 -0
  330. data/samples/drive/drive.rb +40 -0
  331. data/samples/pubsub/pubsub.rb +52 -0
  332. data/{lib/google/api_client/discovery.rb → samples/translate/translate.rb} +14 -5
  333. data/script/generate +79 -0
  334. data/script/package +8 -0
  335. data/script/release +15 -0
  336. data/spec/fixtures/files/api_names.yaml +3 -0
  337. data/spec/fixtures/files/auth_stored_credentials.json +8 -0
  338. data/spec/fixtures/files/client_secrets.json +1 -0
  339. data/spec/fixtures/files/test.blah +1 -0
  340. data/spec/fixtures/files/test.txt +1 -0
  341. data/spec/fixtures/files/test_api.json +440 -0
  342. data/spec/google/api_client/auth/storage_spec.rb +1 -3
  343. data/spec/google/api_client/auth/storages/file_store_spec.rb +1 -2
  344. data/spec/google/api_client/auth/storages/redis_store_spec.rb +1 -3
  345. data/spec/google/apis/core/api_command_spec.rb +170 -0
  346. data/spec/google/apis/core/batch_spec.rb +128 -0
  347. data/spec/google/apis/core/download_spec.rb +90 -0
  348. data/spec/google/apis/core/hashable_spec.rb +60 -0
  349. data/spec/google/apis/core/http_command_spec.rb +238 -0
  350. data/spec/google/apis/core/json_representation_spec.rb +192 -0
  351. data/spec/google/apis/core/service_spec.rb +247 -0
  352. data/spec/google/apis/core/upload_spec.rb +238 -0
  353. data/{lib/google/api_client/service_account.rb → spec/google/apis/generated_spec.rb} +14 -8
  354. data/spec/google/apis/generator/generator_spec.rb +272 -0
  355. data/spec/google/apis/logging_spec.rb +45 -0
  356. data/spec/google/apis/options_spec.rb +40 -0
  357. data/spec/integration_tests/drive_spec.rb +35 -0
  358. data/spec/integration_tests/pubsub_spec.rb +48 -0
  359. data/spec/integration_tests/url_shortener_spec.rb +31 -0
  360. data/spec/spec_helper.rb +102 -46
  361. metadata +433 -178
  362. data/lib/compat/multi_json.rb +0 -19
  363. data/lib/google/api_client.rb +0 -750
  364. data/lib/google/api_client/auth/file_storage.rb +0 -59
  365. data/lib/google/api_client/auth/jwt_asserter.rb +0 -126
  366. data/lib/google/api_client/auth/key_utils.rb +0 -93
  367. data/lib/google/api_client/auth/pkcs12.rb +0 -41
  368. data/lib/google/api_client/batch.rb +0 -326
  369. data/lib/google/api_client/charset.rb +0 -33
  370. data/lib/google/api_client/discovery/api.rb +0 -310
  371. data/lib/google/api_client/discovery/media.rb +0 -77
  372. data/lib/google/api_client/discovery/method.rb +0 -363
  373. data/lib/google/api_client/discovery/resource.rb +0 -156
  374. data/lib/google/api_client/discovery/schema.rb +0 -117
  375. data/lib/google/api_client/environment.rb +0 -42
  376. data/lib/google/api_client/gzip.rb +0 -28
  377. data/lib/google/api_client/logging.rb +0 -32
  378. data/lib/google/api_client/media.rb +0 -259
  379. data/lib/google/api_client/railtie.rb +0 -18
  380. data/lib/google/api_client/request.rb +0 -350
  381. data/lib/google/api_client/result.rb +0 -255
  382. data/lib/google/api_client/service.rb +0 -233
  383. data/lib/google/api_client/service/batch.rb +0 -110
  384. data/lib/google/api_client/service/request.rb +0 -144
  385. data/lib/google/api_client/service/resource.rb +0 -40
  386. data/lib/google/api_client/service/result.rb +0 -162
  387. data/lib/google/api_client/service/simple_file_store.rb +0 -151
  388. data/lib/google/api_client/service/stub_generator.rb +0 -61
  389. data/spec/google/api_client/batch_spec.rb +0 -248
  390. data/spec/google/api_client/discovery_spec.rb +0 -708
  391. data/spec/google/api_client/gzip_spec.rb +0 -98
  392. data/spec/google/api_client/media_spec.rb +0 -178
  393. data/spec/google/api_client/result_spec.rb +0 -207
  394. data/spec/google/api_client/service_account_spec.rb +0 -169
  395. data/spec/google/api_client/service_spec.rb +0 -618
  396. data/spec/google/api_client/simple_file_store_spec.rb +0 -133
  397. data/spec/google/api_client_spec.rb +0 -352
@@ -0,0 +1,339 @@
1
+ # Copyright 2015 Google Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module GmailV1
24
+
25
+ class Draft
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+ end
28
+
29
+ class History
30
+ class Representation < Google::Apis::Core::JsonRepresentation; end
31
+ end
32
+
33
+ class HistoryLabelAdded
34
+ class Representation < Google::Apis::Core::JsonRepresentation; end
35
+ end
36
+
37
+ class HistoryLabelRemoved
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+ end
40
+
41
+ class HistoryMessageAdded
42
+ class Representation < Google::Apis::Core::JsonRepresentation; end
43
+ end
44
+
45
+ class HistoryMessageDeleted
46
+ class Representation < Google::Apis::Core::JsonRepresentation; end
47
+ end
48
+
49
+ class Label
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+ end
52
+
53
+ class ListDraftsResponse
54
+ class Representation < Google::Apis::Core::JsonRepresentation; end
55
+ end
56
+
57
+ class ListHistoryResponse
58
+ class Representation < Google::Apis::Core::JsonRepresentation; end
59
+ end
60
+
61
+ class ListLabelsResponse
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+ end
64
+
65
+ class ListMessagesResponse
66
+ class Representation < Google::Apis::Core::JsonRepresentation; end
67
+ end
68
+
69
+ class ListThreadsResponse
70
+ class Representation < Google::Apis::Core::JsonRepresentation; end
71
+ end
72
+
73
+ class Message
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+ end
76
+
77
+ class MessagePart
78
+ class Representation < Google::Apis::Core::JsonRepresentation; end
79
+ end
80
+
81
+ class MessagePartBody
82
+ class Representation < Google::Apis::Core::JsonRepresentation; end
83
+ end
84
+
85
+ class MessagePartHeader
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+ end
88
+
89
+ class ModifyMessageRequest
90
+ class Representation < Google::Apis::Core::JsonRepresentation; end
91
+ end
92
+
93
+ class ModifyThreadRequest
94
+ class Representation < Google::Apis::Core::JsonRepresentation; end
95
+ end
96
+
97
+ class Profile
98
+ class Representation < Google::Apis::Core::JsonRepresentation; end
99
+ end
100
+
101
+ class Thread
102
+ class Representation < Google::Apis::Core::JsonRepresentation; end
103
+ end
104
+
105
+ class WatchRequest
106
+ class Representation < Google::Apis::Core::JsonRepresentation; end
107
+ end
108
+
109
+ class WatchResponse
110
+ class Representation < Google::Apis::Core::JsonRepresentation; end
111
+ end
112
+
113
+ class Draft
114
+ # @private
115
+ class Representation < Google::Apis::Core::JsonRepresentation
116
+ property :id, as: 'id'
117
+ property :message, as: 'message', class: Google::Apis::GmailV1::Message, decorator: Google::Apis::GmailV1::Message::Representation
118
+
119
+ end
120
+ end
121
+
122
+ class History
123
+ # @private
124
+ class Representation < Google::Apis::Core::JsonRepresentation
125
+ property :id, as: 'id'
126
+ collection :labels_added, as: 'labelsAdded', class: Google::Apis::GmailV1::HistoryLabelAdded, decorator: Google::Apis::GmailV1::HistoryLabelAdded::Representation
127
+
128
+ collection :labels_removed, as: 'labelsRemoved', class: Google::Apis::GmailV1::HistoryLabelRemoved, decorator: Google::Apis::GmailV1::HistoryLabelRemoved::Representation
129
+
130
+ collection :messages, as: 'messages', class: Google::Apis::GmailV1::Message, decorator: Google::Apis::GmailV1::Message::Representation
131
+
132
+ collection :messages_added, as: 'messagesAdded', class: Google::Apis::GmailV1::HistoryMessageAdded, decorator: Google::Apis::GmailV1::HistoryMessageAdded::Representation
133
+
134
+ collection :messages_deleted, as: 'messagesDeleted', class: Google::Apis::GmailV1::HistoryMessageDeleted, decorator: Google::Apis::GmailV1::HistoryMessageDeleted::Representation
135
+
136
+ end
137
+ end
138
+
139
+ class HistoryLabelAdded
140
+ # @private
141
+ class Representation < Google::Apis::Core::JsonRepresentation
142
+ collection :label_ids, as: 'labelIds'
143
+ property :message, as: 'message', class: Google::Apis::GmailV1::Message, decorator: Google::Apis::GmailV1::Message::Representation
144
+
145
+ end
146
+ end
147
+
148
+ class HistoryLabelRemoved
149
+ # @private
150
+ class Representation < Google::Apis::Core::JsonRepresentation
151
+ collection :label_ids, as: 'labelIds'
152
+ property :message, as: 'message', class: Google::Apis::GmailV1::Message, decorator: Google::Apis::GmailV1::Message::Representation
153
+
154
+ end
155
+ end
156
+
157
+ class HistoryMessageAdded
158
+ # @private
159
+ class Representation < Google::Apis::Core::JsonRepresentation
160
+ property :message, as: 'message', class: Google::Apis::GmailV1::Message, decorator: Google::Apis::GmailV1::Message::Representation
161
+
162
+ end
163
+ end
164
+
165
+ class HistoryMessageDeleted
166
+ # @private
167
+ class Representation < Google::Apis::Core::JsonRepresentation
168
+ property :message, as: 'message', class: Google::Apis::GmailV1::Message, decorator: Google::Apis::GmailV1::Message::Representation
169
+
170
+ end
171
+ end
172
+
173
+ class Label
174
+ # @private
175
+ class Representation < Google::Apis::Core::JsonRepresentation
176
+ property :id, as: 'id'
177
+ property :label_list_visibility, as: 'labelListVisibility'
178
+ property :message_list_visibility, as: 'messageListVisibility'
179
+ property :messages_total, as: 'messagesTotal'
180
+ property :messages_unread, as: 'messagesUnread'
181
+ property :name, as: 'name'
182
+ property :threads_total, as: 'threadsTotal'
183
+ property :threads_unread, as: 'threadsUnread'
184
+ property :type, as: 'type'
185
+ end
186
+ end
187
+
188
+ class ListDraftsResponse
189
+ # @private
190
+ class Representation < Google::Apis::Core::JsonRepresentation
191
+ collection :drafts, as: 'drafts', class: Google::Apis::GmailV1::Draft, decorator: Google::Apis::GmailV1::Draft::Representation
192
+
193
+ property :next_page_token, as: 'nextPageToken'
194
+ property :result_size_estimate, as: 'resultSizeEstimate'
195
+ end
196
+ end
197
+
198
+ class ListHistoryResponse
199
+ # @private
200
+ class Representation < Google::Apis::Core::JsonRepresentation
201
+ collection :history, as: 'history', class: Google::Apis::GmailV1::History, decorator: Google::Apis::GmailV1::History::Representation
202
+
203
+ property :history_id, as: 'historyId'
204
+ property :next_page_token, as: 'nextPageToken'
205
+ end
206
+ end
207
+
208
+ class ListLabelsResponse
209
+ # @private
210
+ class Representation < Google::Apis::Core::JsonRepresentation
211
+ collection :labels, as: 'labels', class: Google::Apis::GmailV1::Label, decorator: Google::Apis::GmailV1::Label::Representation
212
+
213
+ end
214
+ end
215
+
216
+ class ListMessagesResponse
217
+ # @private
218
+ class Representation < Google::Apis::Core::JsonRepresentation
219
+ collection :messages, as: 'messages', class: Google::Apis::GmailV1::Message, decorator: Google::Apis::GmailV1::Message::Representation
220
+
221
+ property :next_page_token, as: 'nextPageToken'
222
+ property :result_size_estimate, as: 'resultSizeEstimate'
223
+ end
224
+ end
225
+
226
+ class ListThreadsResponse
227
+ # @private
228
+ class Representation < Google::Apis::Core::JsonRepresentation
229
+ property :next_page_token, as: 'nextPageToken'
230
+ property :result_size_estimate, as: 'resultSizeEstimate'
231
+ collection :threads, as: 'threads', class: Google::Apis::GmailV1::Thread, decorator: Google::Apis::GmailV1::Thread::Representation
232
+
233
+ end
234
+ end
235
+
236
+ class Message
237
+ # @private
238
+ class Representation < Google::Apis::Core::JsonRepresentation
239
+ property :history_id, as: 'historyId'
240
+ property :id, as: 'id'
241
+ property :internal_date, as: 'internalDate'
242
+ collection :label_ids, as: 'labelIds'
243
+ property :payload, as: 'payload', class: Google::Apis::GmailV1::MessagePart, decorator: Google::Apis::GmailV1::MessagePart::Representation
244
+
245
+ property :raw, :base64 => true, as: 'raw'
246
+ property :size_estimate, as: 'sizeEstimate'
247
+ property :snippet, as: 'snippet'
248
+ property :thread_id, as: 'threadId'
249
+ end
250
+ end
251
+
252
+ class MessagePart
253
+ # @private
254
+ class Representation < Google::Apis::Core::JsonRepresentation
255
+ property :body, as: 'body', class: Google::Apis::GmailV1::MessagePartBody, decorator: Google::Apis::GmailV1::MessagePartBody::Representation
256
+
257
+ property :filename, as: 'filename'
258
+ collection :headers, as: 'headers', class: Google::Apis::GmailV1::MessagePartHeader, decorator: Google::Apis::GmailV1::MessagePartHeader::Representation
259
+
260
+ property :mime_type, as: 'mimeType'
261
+ property :part_id, as: 'partId'
262
+ collection :parts, as: 'parts', class: Google::Apis::GmailV1::MessagePart, decorator: Google::Apis::GmailV1::MessagePart::Representation
263
+
264
+ end
265
+ end
266
+
267
+ class MessagePartBody
268
+ # @private
269
+ class Representation < Google::Apis::Core::JsonRepresentation
270
+ property :attachment_id, as: 'attachmentId'
271
+ property :data, :base64 => true, as: 'data'
272
+ property :size, as: 'size'
273
+ end
274
+ end
275
+
276
+ class MessagePartHeader
277
+ # @private
278
+ class Representation < Google::Apis::Core::JsonRepresentation
279
+ property :name, as: 'name'
280
+ property :value, as: 'value'
281
+ end
282
+ end
283
+
284
+ class ModifyMessageRequest
285
+ # @private
286
+ class Representation < Google::Apis::Core::JsonRepresentation
287
+ collection :add_label_ids, as: 'addLabelIds'
288
+ collection :remove_label_ids, as: 'removeLabelIds'
289
+ end
290
+ end
291
+
292
+ class ModifyThreadRequest
293
+ # @private
294
+ class Representation < Google::Apis::Core::JsonRepresentation
295
+ collection :add_label_ids, as: 'addLabelIds'
296
+ collection :remove_label_ids, as: 'removeLabelIds'
297
+ end
298
+ end
299
+
300
+ class Profile
301
+ # @private
302
+ class Representation < Google::Apis::Core::JsonRepresentation
303
+ property :email_address, as: 'emailAddress'
304
+ property :history_id, as: 'historyId'
305
+ property :messages_total, as: 'messagesTotal'
306
+ property :threads_total, as: 'threadsTotal'
307
+ end
308
+ end
309
+
310
+ class Thread
311
+ # @private
312
+ class Representation < Google::Apis::Core::JsonRepresentation
313
+ property :history_id, as: 'historyId'
314
+ property :id, as: 'id'
315
+ collection :messages, as: 'messages', class: Google::Apis::GmailV1::Message, decorator: Google::Apis::GmailV1::Message::Representation
316
+
317
+ property :snippet, as: 'snippet'
318
+ end
319
+ end
320
+
321
+ class WatchRequest
322
+ # @private
323
+ class Representation < Google::Apis::Core::JsonRepresentation
324
+ property :label_filter_action, as: 'labelFilterAction'
325
+ collection :label_ids, as: 'labelIds'
326
+ property :topic_name, as: 'topicName'
327
+ end
328
+ end
329
+
330
+ class WatchResponse
331
+ # @private
332
+ class Representation < Google::Apis::Core::JsonRepresentation
333
+ property :expiration, as: 'expiration'
334
+ property :history_id, as: 'historyId'
335
+ end
336
+ end
337
+ end
338
+ end
339
+ end
@@ -0,0 +1,1502 @@
1
+ # Copyright 2015 Google Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module GmailV1
23
+ # Gmail API
24
+ #
25
+ # The Gmail REST API.
26
+ #
27
+ # @example
28
+ # require 'google/apis/gmail_v1'
29
+ #
30
+ # Gmail = Google::Apis::GmailV1 # Alias the module
31
+ # service = Gmail::GmailService.new
32
+ #
33
+ # @see https://developers.google.com/gmail/api/
34
+ class GmailService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ # Overrides userIp if both are provided.
44
+ attr_accessor :quota_user
45
+
46
+ # @return [String]
47
+ # IP address of the site where the request originates. Use this if you want to
48
+ # enforce per-user limits.
49
+ attr_accessor :user_ip
50
+
51
+ def initialize
52
+ super('https://www.googleapis.com/', 'gmail/v1/users/')
53
+ end
54
+
55
+ # Gets the current user's Gmail profile.
56
+ # @param [String] user_id
57
+ # The user's email address. The special value me can be used to indicate the
58
+ # authenticated user.
59
+ # @param [String] fields
60
+ # Selector specifying which fields to include in a partial response.
61
+ # @param [String] quota_user
62
+ # Available to use for quota purposes for server-side applications. Can be any
63
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
64
+ # Overrides userIp if both are provided.
65
+ # @param [String] user_ip
66
+ # IP address of the site where the request originates. Use this if you want to
67
+ # enforce per-user limits.
68
+ # @param [Google::Apis::RequestOptions] options
69
+ # Request-specific options
70
+ #
71
+ # @yield [result, err] Result & error if block supplied
72
+ # @yieldparam result [Google::Apis::GmailV1::Profile] parsed result object
73
+ # @yieldparam err [StandardError] error object if request failed
74
+ #
75
+ # @return [Google::Apis::GmailV1::Profile]
76
+ #
77
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
78
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
79
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
80
+ def get_user_profile(user_id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
81
+ path = '{userId}/profile'
82
+ command = make_simple_command(:get, path, options)
83
+ command.response_representation = Google::Apis::GmailV1::Profile::Representation
84
+ command.response_class = Google::Apis::GmailV1::Profile
85
+ command.params['userId'] = user_id unless user_id.nil?
86
+ command.query['fields'] = fields unless fields.nil?
87
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
88
+ command.query['userIp'] = user_ip unless user_ip.nil?
89
+ execute_or_queue_command(command, &block)
90
+ end
91
+
92
+ # Stop receiving push notifications for the given user mailbox.
93
+ # @param [String] user_id
94
+ # The user's email address. The special value me can be used to indicate the
95
+ # authenticated user.
96
+ # @param [String] fields
97
+ # Selector specifying which fields to include in a partial response.
98
+ # @param [String] quota_user
99
+ # Available to use for quota purposes for server-side applications. Can be any
100
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
101
+ # Overrides userIp if both are provided.
102
+ # @param [String] user_ip
103
+ # IP address of the site where the request originates. Use this if you want to
104
+ # enforce per-user limits.
105
+ # @param [Google::Apis::RequestOptions] options
106
+ # Request-specific options
107
+ #
108
+ # @yield [result, err] Result & error if block supplied
109
+ # @yieldparam result [NilClass] No result returned for this method
110
+ # @yieldparam err [StandardError] error object if request failed
111
+ #
112
+ # @return [void]
113
+ #
114
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
115
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
116
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
117
+ def stop_user(user_id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
118
+ path = '{userId}/stop'
119
+ command = make_simple_command(:post, path, options)
120
+ command.params['userId'] = user_id unless user_id.nil?
121
+ command.query['fields'] = fields unless fields.nil?
122
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
123
+ command.query['userIp'] = user_ip unless user_ip.nil?
124
+ execute_or_queue_command(command, &block)
125
+ end
126
+
127
+ # Set up or update a push notification watch on the given user mailbox.
128
+ # @param [String] user_id
129
+ # The user's email address. The special value me can be used to indicate the
130
+ # authenticated user.
131
+ # @param [Google::Apis::GmailV1::WatchRequest] watch_request_object
132
+ # @param [String] fields
133
+ # Selector specifying which fields to include in a partial response.
134
+ # @param [String] quota_user
135
+ # Available to use for quota purposes for server-side applications. Can be any
136
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
137
+ # Overrides userIp if both are provided.
138
+ # @param [String] user_ip
139
+ # IP address of the site where the request originates. Use this if you want to
140
+ # enforce per-user limits.
141
+ # @param [Google::Apis::RequestOptions] options
142
+ # Request-specific options
143
+ #
144
+ # @yield [result, err] Result & error if block supplied
145
+ # @yieldparam result [Google::Apis::GmailV1::WatchResponse] parsed result object
146
+ # @yieldparam err [StandardError] error object if request failed
147
+ #
148
+ # @return [Google::Apis::GmailV1::WatchResponse]
149
+ #
150
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
151
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
152
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
153
+ def watch(user_id, watch_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
154
+ path = '{userId}/watch'
155
+ command = make_simple_command(:post, path, options)
156
+ command.request_representation = Google::Apis::GmailV1::WatchRequest::Representation
157
+ command.request_object = watch_request_object
158
+ command.response_representation = Google::Apis::GmailV1::WatchResponse::Representation
159
+ command.response_class = Google::Apis::GmailV1::WatchResponse
160
+ command.params['userId'] = user_id unless user_id.nil?
161
+ command.query['fields'] = fields unless fields.nil?
162
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
163
+ command.query['userIp'] = user_ip unless user_ip.nil?
164
+ execute_or_queue_command(command, &block)
165
+ end
166
+
167
+ # Creates a new draft with the DRAFT label.
168
+ # @param [String] user_id
169
+ # The user's email address. The special value me can be used to indicate the
170
+ # authenticated user.
171
+ # @param [Google::Apis::GmailV1::Draft] draft_object
172
+ # @param [String] fields
173
+ # Selector specifying which fields to include in a partial response.
174
+ # @param [String] quota_user
175
+ # Available to use for quota purposes for server-side applications. Can be any
176
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
177
+ # Overrides userIp if both are provided.
178
+ # @param [String] user_ip
179
+ # IP address of the site where the request originates. Use this if you want to
180
+ # enforce per-user limits.
181
+ # @param [IO, String] upload_source
182
+ # IO stream or filename containing content to upload
183
+ # @param [String] content_type
184
+ # Content type of the uploaded content.
185
+ # @param [Google::Apis::RequestOptions] options
186
+ # Request-specific options
187
+ #
188
+ # @yield [result, err] Result & error if block supplied
189
+ # @yieldparam result [Google::Apis::GmailV1::Draft] parsed result object
190
+ # @yieldparam err [StandardError] error object if request failed
191
+ #
192
+ # @return [Google::Apis::GmailV1::Draft]
193
+ #
194
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
195
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
196
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
197
+ def create_user_draft(user_id, draft_object = nil, fields: nil, quota_user: nil, user_ip: nil, upload_source: nil, content_type: nil, options: nil, &block)
198
+ path = '{userId}/drafts'
199
+ if upload_source.nil?
200
+ command = make_simple_command(:post, path, options)
201
+ else
202
+ command = make_upload_command(:post, path, options)
203
+ command.upload_source = upload_source
204
+ command.upload_content_type = content_type
205
+ end
206
+ command.request_representation = Google::Apis::GmailV1::Draft::Representation
207
+ command.request_object = draft_object
208
+ command.response_representation = Google::Apis::GmailV1::Draft::Representation
209
+ command.response_class = Google::Apis::GmailV1::Draft
210
+ command.params['userId'] = user_id unless user_id.nil?
211
+ command.query['fields'] = fields unless fields.nil?
212
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
213
+ command.query['userIp'] = user_ip unless user_ip.nil?
214
+ execute_or_queue_command(command, &block)
215
+ end
216
+
217
+ # Immediately and permanently deletes the specified draft. Does not simply trash
218
+ # it.
219
+ # @param [String] user_id
220
+ # The user's email address. The special value me can be used to indicate the
221
+ # authenticated user.
222
+ # @param [String] id
223
+ # The ID of the draft to delete.
224
+ # @param [String] fields
225
+ # Selector specifying which fields to include in a partial response.
226
+ # @param [String] quota_user
227
+ # Available to use for quota purposes for server-side applications. Can be any
228
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
229
+ # Overrides userIp if both are provided.
230
+ # @param [String] user_ip
231
+ # IP address of the site where the request originates. Use this if you want to
232
+ # enforce per-user limits.
233
+ # @param [Google::Apis::RequestOptions] options
234
+ # Request-specific options
235
+ #
236
+ # @yield [result, err] Result & error if block supplied
237
+ # @yieldparam result [NilClass] No result returned for this method
238
+ # @yieldparam err [StandardError] error object if request failed
239
+ #
240
+ # @return [void]
241
+ #
242
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
243
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
244
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
245
+ def delete_user_draft(user_id, id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
246
+ path = '{userId}/drafts/{id}'
247
+ command = make_simple_command(:delete, path, options)
248
+ command.params['userId'] = user_id unless user_id.nil?
249
+ command.params['id'] = id unless id.nil?
250
+ command.query['fields'] = fields unless fields.nil?
251
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
252
+ command.query['userIp'] = user_ip unless user_ip.nil?
253
+ execute_or_queue_command(command, &block)
254
+ end
255
+
256
+ # Gets the specified draft.
257
+ # @param [String] user_id
258
+ # The user's email address. The special value me can be used to indicate the
259
+ # authenticated user.
260
+ # @param [String] id
261
+ # The ID of the draft to retrieve.
262
+ # @param [String] format
263
+ # The format to return the draft in.
264
+ # @param [String] fields
265
+ # Selector specifying which fields to include in a partial response.
266
+ # @param [String] quota_user
267
+ # Available to use for quota purposes for server-side applications. Can be any
268
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
269
+ # Overrides userIp if both are provided.
270
+ # @param [String] user_ip
271
+ # IP address of the site where the request originates. Use this if you want to
272
+ # enforce per-user limits.
273
+ # @param [Google::Apis::RequestOptions] options
274
+ # Request-specific options
275
+ #
276
+ # @yield [result, err] Result & error if block supplied
277
+ # @yieldparam result [Google::Apis::GmailV1::Draft] parsed result object
278
+ # @yieldparam err [StandardError] error object if request failed
279
+ #
280
+ # @return [Google::Apis::GmailV1::Draft]
281
+ #
282
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
283
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
284
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
285
+ def get_user_draft(user_id, id, format: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
286
+ path = '{userId}/drafts/{id}'
287
+ command = make_simple_command(:get, path, options)
288
+ command.response_representation = Google::Apis::GmailV1::Draft::Representation
289
+ command.response_class = Google::Apis::GmailV1::Draft
290
+ command.params['userId'] = user_id unless user_id.nil?
291
+ command.params['id'] = id unless id.nil?
292
+ command.query['format'] = format unless format.nil?
293
+ command.query['fields'] = fields unless fields.nil?
294
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
295
+ command.query['userIp'] = user_ip unless user_ip.nil?
296
+ execute_or_queue_command(command, &block)
297
+ end
298
+
299
+ # Lists the drafts in the user's mailbox.
300
+ # @param [String] user_id
301
+ # The user's email address. The special value me can be used to indicate the
302
+ # authenticated user.
303
+ # @param [Fixnum] max_results
304
+ # Maximum number of drafts to return.
305
+ # @param [String] page_token
306
+ # Page token to retrieve a specific page of results in the list.
307
+ # @param [String] fields
308
+ # Selector specifying which fields to include in a partial response.
309
+ # @param [String] quota_user
310
+ # Available to use for quota purposes for server-side applications. Can be any
311
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
312
+ # Overrides userIp if both are provided.
313
+ # @param [String] user_ip
314
+ # IP address of the site where the request originates. Use this if you want to
315
+ # enforce per-user limits.
316
+ # @param [Google::Apis::RequestOptions] options
317
+ # Request-specific options
318
+ #
319
+ # @yield [result, err] Result & error if block supplied
320
+ # @yieldparam result [Google::Apis::GmailV1::ListDraftsResponse] parsed result object
321
+ # @yieldparam err [StandardError] error object if request failed
322
+ #
323
+ # @return [Google::Apis::GmailV1::ListDraftsResponse]
324
+ #
325
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
326
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
327
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
328
+ def list_user_drafts(user_id, max_results: nil, page_token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
329
+ path = '{userId}/drafts'
330
+ command = make_simple_command(:get, path, options)
331
+ command.response_representation = Google::Apis::GmailV1::ListDraftsResponse::Representation
332
+ command.response_class = Google::Apis::GmailV1::ListDraftsResponse
333
+ command.params['userId'] = user_id unless user_id.nil?
334
+ command.query['maxResults'] = max_results unless max_results.nil?
335
+ command.query['pageToken'] = page_token unless page_token.nil?
336
+ command.query['fields'] = fields unless fields.nil?
337
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
338
+ command.query['userIp'] = user_ip unless user_ip.nil?
339
+ execute_or_queue_command(command, &block)
340
+ end
341
+
342
+ # Sends the specified, existing draft to the recipients in the To, Cc, and Bcc
343
+ # headers.
344
+ # @param [String] user_id
345
+ # The user's email address. The special value me can be used to indicate the
346
+ # authenticated user.
347
+ # @param [Google::Apis::GmailV1::Draft] draft_object
348
+ # @param [String] fields
349
+ # Selector specifying which fields to include in a partial response.
350
+ # @param [String] quota_user
351
+ # Available to use for quota purposes for server-side applications. Can be any
352
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
353
+ # Overrides userIp if both are provided.
354
+ # @param [String] user_ip
355
+ # IP address of the site where the request originates. Use this if you want to
356
+ # enforce per-user limits.
357
+ # @param [IO, String] upload_source
358
+ # IO stream or filename containing content to upload
359
+ # @param [String] content_type
360
+ # Content type of the uploaded content.
361
+ # @param [Google::Apis::RequestOptions] options
362
+ # Request-specific options
363
+ #
364
+ # @yield [result, err] Result & error if block supplied
365
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
366
+ # @yieldparam err [StandardError] error object if request failed
367
+ #
368
+ # @return [Google::Apis::GmailV1::Message]
369
+ #
370
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
371
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
372
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
373
+ def send_user_draft(user_id, draft_object = nil, fields: nil, quota_user: nil, user_ip: nil, upload_source: nil, content_type: nil, options: nil, &block)
374
+ path = '{userId}/drafts/send'
375
+ if upload_source.nil?
376
+ command = make_simple_command(:post, path, options)
377
+ else
378
+ command = make_upload_command(:post, path, options)
379
+ command.upload_source = upload_source
380
+ command.upload_content_type = content_type
381
+ end
382
+ command.request_representation = Google::Apis::GmailV1::Draft::Representation
383
+ command.request_object = draft_object
384
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
385
+ command.response_class = Google::Apis::GmailV1::Message
386
+ command.params['userId'] = user_id unless user_id.nil?
387
+ command.query['fields'] = fields unless fields.nil?
388
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
389
+ command.query['userIp'] = user_ip unless user_ip.nil?
390
+ execute_or_queue_command(command, &block)
391
+ end
392
+
393
+ # Replaces a draft's content.
394
+ # @param [String] user_id
395
+ # The user's email address. The special value me can be used to indicate the
396
+ # authenticated user.
397
+ # @param [String] id
398
+ # The ID of the draft to update.
399
+ # @param [Google::Apis::GmailV1::Draft] draft_object
400
+ # @param [String] fields
401
+ # Selector specifying which fields to include in a partial response.
402
+ # @param [String] quota_user
403
+ # Available to use for quota purposes for server-side applications. Can be any
404
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
405
+ # Overrides userIp if both are provided.
406
+ # @param [String] user_ip
407
+ # IP address of the site where the request originates. Use this if you want to
408
+ # enforce per-user limits.
409
+ # @param [IO, String] upload_source
410
+ # IO stream or filename containing content to upload
411
+ # @param [String] content_type
412
+ # Content type of the uploaded content.
413
+ # @param [Google::Apis::RequestOptions] options
414
+ # Request-specific options
415
+ #
416
+ # @yield [result, err] Result & error if block supplied
417
+ # @yieldparam result [Google::Apis::GmailV1::Draft] parsed result object
418
+ # @yieldparam err [StandardError] error object if request failed
419
+ #
420
+ # @return [Google::Apis::GmailV1::Draft]
421
+ #
422
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
423
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
424
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
425
+ def update_user_draft(user_id, id, draft_object = nil, fields: nil, quota_user: nil, user_ip: nil, upload_source: nil, content_type: nil, options: nil, &block)
426
+ path = '{userId}/drafts/{id}'
427
+ if upload_source.nil?
428
+ command = make_simple_command(:put, path, options)
429
+ else
430
+ command = make_upload_command(:put, path, options)
431
+ command.upload_source = upload_source
432
+ command.upload_content_type = content_type
433
+ end
434
+ command.request_representation = Google::Apis::GmailV1::Draft::Representation
435
+ command.request_object = draft_object
436
+ command.response_representation = Google::Apis::GmailV1::Draft::Representation
437
+ command.response_class = Google::Apis::GmailV1::Draft
438
+ command.params['userId'] = user_id unless user_id.nil?
439
+ command.params['id'] = id unless id.nil?
440
+ command.query['fields'] = fields unless fields.nil?
441
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
442
+ command.query['userIp'] = user_ip unless user_ip.nil?
443
+ execute_or_queue_command(command, &block)
444
+ end
445
+
446
+ # Lists the history of all changes to the given mailbox. History results are
447
+ # returned in chronological order (increasing historyId).
448
+ # @param [String] user_id
449
+ # The user's email address. The special value me can be used to indicate the
450
+ # authenticated user.
451
+ # @param [String] label_id
452
+ # Only return messages with a label matching the ID.
453
+ # @param [Fixnum] max_results
454
+ # The maximum number of history records to return.
455
+ # @param [String] page_token
456
+ # Page token to retrieve a specific page of results in the list.
457
+ # @param [String] start_history_id
458
+ # Required. Returns history records after the specified startHistoryId. The
459
+ # supplied startHistoryId should be obtained from the historyId of a message,
460
+ # thread, or previous list response. History IDs increase chronologically but
461
+ # are not contiguous with random gaps in between valid IDs. Supplying an invalid
462
+ # or out of date startHistoryId typically returns an HTTP 404 error code. A
463
+ # historyId is typically valid for at least a week, but in some rare
464
+ # circumstances may be valid for only a few hours. If you receive an HTTP 404
465
+ # error response, your application should perform a full sync. If you receive no
466
+ # nextPageToken in the response, there are no updates to retrieve and you can
467
+ # store the returned historyId for a future request.
468
+ # @param [String] fields
469
+ # Selector specifying which fields to include in a partial response.
470
+ # @param [String] quota_user
471
+ # Available to use for quota purposes for server-side applications. Can be any
472
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
473
+ # Overrides userIp if both are provided.
474
+ # @param [String] user_ip
475
+ # IP address of the site where the request originates. Use this if you want to
476
+ # enforce per-user limits.
477
+ # @param [Google::Apis::RequestOptions] options
478
+ # Request-specific options
479
+ #
480
+ # @yield [result, err] Result & error if block supplied
481
+ # @yieldparam result [Google::Apis::GmailV1::ListHistoryResponse] parsed result object
482
+ # @yieldparam err [StandardError] error object if request failed
483
+ #
484
+ # @return [Google::Apis::GmailV1::ListHistoryResponse]
485
+ #
486
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
487
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
488
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
489
+ def list_user_histories(user_id, label_id: nil, max_results: nil, page_token: nil, start_history_id: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
490
+ path = '{userId}/history'
491
+ command = make_simple_command(:get, path, options)
492
+ command.response_representation = Google::Apis::GmailV1::ListHistoryResponse::Representation
493
+ command.response_class = Google::Apis::GmailV1::ListHistoryResponse
494
+ command.params['userId'] = user_id unless user_id.nil?
495
+ command.query['labelId'] = label_id unless label_id.nil?
496
+ command.query['maxResults'] = max_results unless max_results.nil?
497
+ command.query['pageToken'] = page_token unless page_token.nil?
498
+ command.query['startHistoryId'] = start_history_id unless start_history_id.nil?
499
+ command.query['fields'] = fields unless fields.nil?
500
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
501
+ command.query['userIp'] = user_ip unless user_ip.nil?
502
+ execute_or_queue_command(command, &block)
503
+ end
504
+
505
+ # Creates a new label.
506
+ # @param [String] user_id
507
+ # The user's email address. The special value me can be used to indicate the
508
+ # authenticated user.
509
+ # @param [Google::Apis::GmailV1::Label] label_object
510
+ # @param [String] fields
511
+ # Selector specifying which fields to include in a partial response.
512
+ # @param [String] quota_user
513
+ # Available to use for quota purposes for server-side applications. Can be any
514
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
515
+ # Overrides userIp if both are provided.
516
+ # @param [String] user_ip
517
+ # IP address of the site where the request originates. Use this if you want to
518
+ # enforce per-user limits.
519
+ # @param [Google::Apis::RequestOptions] options
520
+ # Request-specific options
521
+ #
522
+ # @yield [result, err] Result & error if block supplied
523
+ # @yieldparam result [Google::Apis::GmailV1::Label] parsed result object
524
+ # @yieldparam err [StandardError] error object if request failed
525
+ #
526
+ # @return [Google::Apis::GmailV1::Label]
527
+ #
528
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
529
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
530
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
531
+ def create_user_label(user_id, label_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
532
+ path = '{userId}/labels'
533
+ command = make_simple_command(:post, path, options)
534
+ command.request_representation = Google::Apis::GmailV1::Label::Representation
535
+ command.request_object = label_object
536
+ command.response_representation = Google::Apis::GmailV1::Label::Representation
537
+ command.response_class = Google::Apis::GmailV1::Label
538
+ command.params['userId'] = user_id unless user_id.nil?
539
+ command.query['fields'] = fields unless fields.nil?
540
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
541
+ command.query['userIp'] = user_ip unless user_ip.nil?
542
+ execute_or_queue_command(command, &block)
543
+ end
544
+
545
+ # Immediately and permanently deletes the specified label and removes it from
546
+ # any messages and threads that it is applied to.
547
+ # @param [String] user_id
548
+ # The user's email address. The special value me can be used to indicate the
549
+ # authenticated user.
550
+ # @param [String] id
551
+ # The ID of the label to delete.
552
+ # @param [String] fields
553
+ # Selector specifying which fields to include in a partial response.
554
+ # @param [String] quota_user
555
+ # Available to use for quota purposes for server-side applications. Can be any
556
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
557
+ # Overrides userIp if both are provided.
558
+ # @param [String] user_ip
559
+ # IP address of the site where the request originates. Use this if you want to
560
+ # enforce per-user limits.
561
+ # @param [Google::Apis::RequestOptions] options
562
+ # Request-specific options
563
+ #
564
+ # @yield [result, err] Result & error if block supplied
565
+ # @yieldparam result [NilClass] No result returned for this method
566
+ # @yieldparam err [StandardError] error object if request failed
567
+ #
568
+ # @return [void]
569
+ #
570
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
571
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
572
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
573
+ def delete_user_label(user_id, id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
574
+ path = '{userId}/labels/{id}'
575
+ command = make_simple_command(:delete, path, options)
576
+ command.params['userId'] = user_id unless user_id.nil?
577
+ command.params['id'] = id unless id.nil?
578
+ command.query['fields'] = fields unless fields.nil?
579
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
580
+ command.query['userIp'] = user_ip unless user_ip.nil?
581
+ execute_or_queue_command(command, &block)
582
+ end
583
+
584
+ # Gets the specified label.
585
+ # @param [String] user_id
586
+ # The user's email address. The special value me can be used to indicate the
587
+ # authenticated user.
588
+ # @param [String] id
589
+ # The ID of the label to retrieve.
590
+ # @param [String] fields
591
+ # Selector specifying which fields to include in a partial response.
592
+ # @param [String] quota_user
593
+ # Available to use for quota purposes for server-side applications. Can be any
594
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
595
+ # Overrides userIp if both are provided.
596
+ # @param [String] user_ip
597
+ # IP address of the site where the request originates. Use this if you want to
598
+ # enforce per-user limits.
599
+ # @param [Google::Apis::RequestOptions] options
600
+ # Request-specific options
601
+ #
602
+ # @yield [result, err] Result & error if block supplied
603
+ # @yieldparam result [Google::Apis::GmailV1::Label] parsed result object
604
+ # @yieldparam err [StandardError] error object if request failed
605
+ #
606
+ # @return [Google::Apis::GmailV1::Label]
607
+ #
608
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
609
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
610
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
611
+ def get_user_label(user_id, id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
612
+ path = '{userId}/labels/{id}'
613
+ command = make_simple_command(:get, path, options)
614
+ command.response_representation = Google::Apis::GmailV1::Label::Representation
615
+ command.response_class = Google::Apis::GmailV1::Label
616
+ command.params['userId'] = user_id unless user_id.nil?
617
+ command.params['id'] = id unless id.nil?
618
+ command.query['fields'] = fields unless fields.nil?
619
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
620
+ command.query['userIp'] = user_ip unless user_ip.nil?
621
+ execute_or_queue_command(command, &block)
622
+ end
623
+
624
+ # Lists all labels in the user's mailbox.
625
+ # @param [String] user_id
626
+ # The user's email address. The special value me can be used to indicate the
627
+ # authenticated user.
628
+ # @param [String] fields
629
+ # Selector specifying which fields to include in a partial response.
630
+ # @param [String] quota_user
631
+ # Available to use for quota purposes for server-side applications. Can be any
632
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
633
+ # Overrides userIp if both are provided.
634
+ # @param [String] user_ip
635
+ # IP address of the site where the request originates. Use this if you want to
636
+ # enforce per-user limits.
637
+ # @param [Google::Apis::RequestOptions] options
638
+ # Request-specific options
639
+ #
640
+ # @yield [result, err] Result & error if block supplied
641
+ # @yieldparam result [Google::Apis::GmailV1::ListLabelsResponse] parsed result object
642
+ # @yieldparam err [StandardError] error object if request failed
643
+ #
644
+ # @return [Google::Apis::GmailV1::ListLabelsResponse]
645
+ #
646
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
647
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
648
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
649
+ def list_user_labels(user_id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
650
+ path = '{userId}/labels'
651
+ command = make_simple_command(:get, path, options)
652
+ command.response_representation = Google::Apis::GmailV1::ListLabelsResponse::Representation
653
+ command.response_class = Google::Apis::GmailV1::ListLabelsResponse
654
+ command.params['userId'] = user_id unless user_id.nil?
655
+ command.query['fields'] = fields unless fields.nil?
656
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
657
+ command.query['userIp'] = user_ip unless user_ip.nil?
658
+ execute_or_queue_command(command, &block)
659
+ end
660
+
661
+ # Updates the specified label. This method supports patch semantics.
662
+ # @param [String] user_id
663
+ # The user's email address. The special value me can be used to indicate the
664
+ # authenticated user.
665
+ # @param [String] id
666
+ # The ID of the label to update.
667
+ # @param [Google::Apis::GmailV1::Label] label_object
668
+ # @param [String] fields
669
+ # Selector specifying which fields to include in a partial response.
670
+ # @param [String] quota_user
671
+ # Available to use for quota purposes for server-side applications. Can be any
672
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
673
+ # Overrides userIp if both are provided.
674
+ # @param [String] user_ip
675
+ # IP address of the site where the request originates. Use this if you want to
676
+ # enforce per-user limits.
677
+ # @param [Google::Apis::RequestOptions] options
678
+ # Request-specific options
679
+ #
680
+ # @yield [result, err] Result & error if block supplied
681
+ # @yieldparam result [Google::Apis::GmailV1::Label] parsed result object
682
+ # @yieldparam err [StandardError] error object if request failed
683
+ #
684
+ # @return [Google::Apis::GmailV1::Label]
685
+ #
686
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
687
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
688
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
689
+ def patch_user_label(user_id, id, label_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
690
+ path = '{userId}/labels/{id}'
691
+ command = make_simple_command(:patch, path, options)
692
+ command.request_representation = Google::Apis::GmailV1::Label::Representation
693
+ command.request_object = label_object
694
+ command.response_representation = Google::Apis::GmailV1::Label::Representation
695
+ command.response_class = Google::Apis::GmailV1::Label
696
+ command.params['userId'] = user_id unless user_id.nil?
697
+ command.params['id'] = id unless id.nil?
698
+ command.query['fields'] = fields unless fields.nil?
699
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
700
+ command.query['userIp'] = user_ip unless user_ip.nil?
701
+ execute_or_queue_command(command, &block)
702
+ end
703
+
704
+ # Updates the specified label.
705
+ # @param [String] user_id
706
+ # The user's email address. The special value me can be used to indicate the
707
+ # authenticated user.
708
+ # @param [String] id
709
+ # The ID of the label to update.
710
+ # @param [Google::Apis::GmailV1::Label] label_object
711
+ # @param [String] fields
712
+ # Selector specifying which fields to include in a partial response.
713
+ # @param [String] quota_user
714
+ # Available to use for quota purposes for server-side applications. Can be any
715
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
716
+ # Overrides userIp if both are provided.
717
+ # @param [String] user_ip
718
+ # IP address of the site where the request originates. Use this if you want to
719
+ # enforce per-user limits.
720
+ # @param [Google::Apis::RequestOptions] options
721
+ # Request-specific options
722
+ #
723
+ # @yield [result, err] Result & error if block supplied
724
+ # @yieldparam result [Google::Apis::GmailV1::Label] parsed result object
725
+ # @yieldparam err [StandardError] error object if request failed
726
+ #
727
+ # @return [Google::Apis::GmailV1::Label]
728
+ #
729
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
730
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
731
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
732
+ def update_user_label(user_id, id, label_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
733
+ path = '{userId}/labels/{id}'
734
+ command = make_simple_command(:put, path, options)
735
+ command.request_representation = Google::Apis::GmailV1::Label::Representation
736
+ command.request_object = label_object
737
+ command.response_representation = Google::Apis::GmailV1::Label::Representation
738
+ command.response_class = Google::Apis::GmailV1::Label
739
+ command.params['userId'] = user_id unless user_id.nil?
740
+ command.params['id'] = id unless id.nil?
741
+ command.query['fields'] = fields unless fields.nil?
742
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
743
+ command.query['userIp'] = user_ip unless user_ip.nil?
744
+ execute_or_queue_command(command, &block)
745
+ end
746
+
747
+ # Immediately and permanently deletes the specified message. This operation
748
+ # cannot be undone. Prefer messages.trash instead.
749
+ # @param [String] user_id
750
+ # The user's email address. The special value me can be used to indicate the
751
+ # authenticated user.
752
+ # @param [String] id
753
+ # The ID of the message to delete.
754
+ # @param [String] fields
755
+ # Selector specifying which fields to include in a partial response.
756
+ # @param [String] quota_user
757
+ # Available to use for quota purposes for server-side applications. Can be any
758
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
759
+ # Overrides userIp if both are provided.
760
+ # @param [String] user_ip
761
+ # IP address of the site where the request originates. Use this if you want to
762
+ # enforce per-user limits.
763
+ # @param [Google::Apis::RequestOptions] options
764
+ # Request-specific options
765
+ #
766
+ # @yield [result, err] Result & error if block supplied
767
+ # @yieldparam result [NilClass] No result returned for this method
768
+ # @yieldparam err [StandardError] error object if request failed
769
+ #
770
+ # @return [void]
771
+ #
772
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
773
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
774
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
775
+ def delete_user_message(user_id, id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
776
+ path = '{userId}/messages/{id}'
777
+ command = make_simple_command(:delete, path, options)
778
+ command.params['userId'] = user_id unless user_id.nil?
779
+ command.params['id'] = id unless id.nil?
780
+ command.query['fields'] = fields unless fields.nil?
781
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
782
+ command.query['userIp'] = user_ip unless user_ip.nil?
783
+ execute_or_queue_command(command, &block)
784
+ end
785
+
786
+ # Gets the specified message.
787
+ # @param [String] user_id
788
+ # The user's email address. The special value me can be used to indicate the
789
+ # authenticated user.
790
+ # @param [String] id
791
+ # The ID of the message to retrieve.
792
+ # @param [String] format
793
+ # The format to return the message in.
794
+ # @param [Array<String>, String] metadata_headers
795
+ # When given and format is METADATA, only include headers specified.
796
+ # @param [String] fields
797
+ # Selector specifying which fields to include in a partial response.
798
+ # @param [String] quota_user
799
+ # Available to use for quota purposes for server-side applications. Can be any
800
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
801
+ # Overrides userIp if both are provided.
802
+ # @param [String] user_ip
803
+ # IP address of the site where the request originates. Use this if you want to
804
+ # enforce per-user limits.
805
+ # @param [Google::Apis::RequestOptions] options
806
+ # Request-specific options
807
+ #
808
+ # @yield [result, err] Result & error if block supplied
809
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
810
+ # @yieldparam err [StandardError] error object if request failed
811
+ #
812
+ # @return [Google::Apis::GmailV1::Message]
813
+ #
814
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
815
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
816
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
817
+ def get_user_message(user_id, id, format: nil, metadata_headers: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
818
+ path = '{userId}/messages/{id}'
819
+ command = make_simple_command(:get, path, options)
820
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
821
+ command.response_class = Google::Apis::GmailV1::Message
822
+ command.params['userId'] = user_id unless user_id.nil?
823
+ command.params['id'] = id unless id.nil?
824
+ command.query['format'] = format unless format.nil?
825
+ command.query['metadataHeaders'] = metadata_headers unless metadata_headers.nil?
826
+ command.query['fields'] = fields unless fields.nil?
827
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
828
+ command.query['userIp'] = user_ip unless user_ip.nil?
829
+ execute_or_queue_command(command, &block)
830
+ end
831
+
832
+ # Imports a message into only this user's mailbox, with standard email delivery
833
+ # scanning and classification similar to receiving via SMTP. Does not send a
834
+ # message.
835
+ # @param [String] user_id
836
+ # The user's email address. The special value me can be used to indicate the
837
+ # authenticated user.
838
+ # @param [Google::Apis::GmailV1::Message] message_object
839
+ # @param [Boolean] deleted
840
+ # Mark the email as permanently deleted (not TRASH) and only visible in Google
841
+ # Apps Vault to a Vault administrator. Only used for Google Apps for Work
842
+ # accounts.
843
+ # @param [String] internal_date_source
844
+ # Source for Gmail's internal date of the message.
845
+ # @param [Boolean] never_mark_spam
846
+ # Ignore the Gmail spam classifier decision and never mark this email as SPAM in
847
+ # the mailbox.
848
+ # @param [Boolean] process_for_calendar
849
+ # Process calendar invites in the email and add any extracted meetings to the
850
+ # Google Calendar for this user.
851
+ # @param [String] fields
852
+ # Selector specifying which fields to include in a partial response.
853
+ # @param [String] quota_user
854
+ # Available to use for quota purposes for server-side applications. Can be any
855
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
856
+ # Overrides userIp if both are provided.
857
+ # @param [String] user_ip
858
+ # IP address of the site where the request originates. Use this if you want to
859
+ # enforce per-user limits.
860
+ # @param [IO, String] upload_source
861
+ # IO stream or filename containing content to upload
862
+ # @param [String] content_type
863
+ # Content type of the uploaded content.
864
+ # @param [Google::Apis::RequestOptions] options
865
+ # Request-specific options
866
+ #
867
+ # @yield [result, err] Result & error if block supplied
868
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
869
+ # @yieldparam err [StandardError] error object if request failed
870
+ #
871
+ # @return [Google::Apis::GmailV1::Message]
872
+ #
873
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
874
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
875
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
876
+ def import_user_message(user_id, message_object = nil, deleted: nil, internal_date_source: nil, never_mark_spam: nil, process_for_calendar: nil, fields: nil, quota_user: nil, user_ip: nil, upload_source: nil, content_type: nil, options: nil, &block)
877
+ path = '{userId}/messages/import'
878
+ if upload_source.nil?
879
+ command = make_simple_command(:post, path, options)
880
+ else
881
+ command = make_upload_command(:post, path, options)
882
+ command.upload_source = upload_source
883
+ command.upload_content_type = content_type
884
+ end
885
+ command.request_representation = Google::Apis::GmailV1::Message::Representation
886
+ command.request_object = message_object
887
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
888
+ command.response_class = Google::Apis::GmailV1::Message
889
+ command.params['userId'] = user_id unless user_id.nil?
890
+ command.query['deleted'] = deleted unless deleted.nil?
891
+ command.query['internalDateSource'] = internal_date_source unless internal_date_source.nil?
892
+ command.query['neverMarkSpam'] = never_mark_spam unless never_mark_spam.nil?
893
+ command.query['processForCalendar'] = process_for_calendar unless process_for_calendar.nil?
894
+ command.query['fields'] = fields unless fields.nil?
895
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
896
+ command.query['userIp'] = user_ip unless user_ip.nil?
897
+ execute_or_queue_command(command, &block)
898
+ end
899
+
900
+ # Directly inserts a message into only this user's mailbox similar to IMAP
901
+ # APPEND, bypassing most scanning and classification. Does not send a message.
902
+ # @param [String] user_id
903
+ # The user's email address. The special value me can be used to indicate the
904
+ # authenticated user.
905
+ # @param [Google::Apis::GmailV1::Message] message_object
906
+ # @param [Boolean] deleted
907
+ # Mark the email as permanently deleted (not TRASH) and only visible in Google
908
+ # Apps Vault to a Vault administrator. Only used for Google Apps for Work
909
+ # accounts.
910
+ # @param [String] internal_date_source
911
+ # Source for Gmail's internal date of the message.
912
+ # @param [String] fields
913
+ # Selector specifying which fields to include in a partial response.
914
+ # @param [String] quota_user
915
+ # Available to use for quota purposes for server-side applications. Can be any
916
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
917
+ # Overrides userIp if both are provided.
918
+ # @param [String] user_ip
919
+ # IP address of the site where the request originates. Use this if you want to
920
+ # enforce per-user limits.
921
+ # @param [IO, String] upload_source
922
+ # IO stream or filename containing content to upload
923
+ # @param [String] content_type
924
+ # Content type of the uploaded content.
925
+ # @param [Google::Apis::RequestOptions] options
926
+ # Request-specific options
927
+ #
928
+ # @yield [result, err] Result & error if block supplied
929
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
930
+ # @yieldparam err [StandardError] error object if request failed
931
+ #
932
+ # @return [Google::Apis::GmailV1::Message]
933
+ #
934
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
935
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
936
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
937
+ def insert_user_message(user_id, message_object = nil, deleted: nil, internal_date_source: nil, fields: nil, quota_user: nil, user_ip: nil, upload_source: nil, content_type: nil, options: nil, &block)
938
+ path = '{userId}/messages'
939
+ if upload_source.nil?
940
+ command = make_simple_command(:post, path, options)
941
+ else
942
+ command = make_upload_command(:post, path, options)
943
+ command.upload_source = upload_source
944
+ command.upload_content_type = content_type
945
+ end
946
+ command.request_representation = Google::Apis::GmailV1::Message::Representation
947
+ command.request_object = message_object
948
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
949
+ command.response_class = Google::Apis::GmailV1::Message
950
+ command.params['userId'] = user_id unless user_id.nil?
951
+ command.query['deleted'] = deleted unless deleted.nil?
952
+ command.query['internalDateSource'] = internal_date_source unless internal_date_source.nil?
953
+ command.query['fields'] = fields unless fields.nil?
954
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
955
+ command.query['userIp'] = user_ip unless user_ip.nil?
956
+ execute_or_queue_command(command, &block)
957
+ end
958
+
959
+ # Lists the messages in the user's mailbox.
960
+ # @param [String] user_id
961
+ # The user's email address. The special value me can be used to indicate the
962
+ # authenticated user.
963
+ # @param [Boolean] include_spam_trash
964
+ # Include messages from SPAM and TRASH in the results.
965
+ # @param [Array<String>, String] label_ids
966
+ # Only return messages with labels that match all of the specified label IDs.
967
+ # @param [Fixnum] max_results
968
+ # Maximum number of messages to return.
969
+ # @param [String] page_token
970
+ # Page token to retrieve a specific page of results in the list.
971
+ # @param [String] q
972
+ # Only return messages matching the specified query. Supports the same query
973
+ # format as the Gmail search box. For example, "from:someuser@example.com
974
+ # rfc822msgid: is:unread".
975
+ # @param [String] fields
976
+ # Selector specifying which fields to include in a partial response.
977
+ # @param [String] quota_user
978
+ # Available to use for quota purposes for server-side applications. Can be any
979
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
980
+ # Overrides userIp if both are provided.
981
+ # @param [String] user_ip
982
+ # IP address of the site where the request originates. Use this if you want to
983
+ # enforce per-user limits.
984
+ # @param [Google::Apis::RequestOptions] options
985
+ # Request-specific options
986
+ #
987
+ # @yield [result, err] Result & error if block supplied
988
+ # @yieldparam result [Google::Apis::GmailV1::ListMessagesResponse] parsed result object
989
+ # @yieldparam err [StandardError] error object if request failed
990
+ #
991
+ # @return [Google::Apis::GmailV1::ListMessagesResponse]
992
+ #
993
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
994
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
995
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
996
+ def list_user_messages(user_id, include_spam_trash: nil, label_ids: nil, max_results: nil, page_token: nil, q: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
997
+ path = '{userId}/messages'
998
+ command = make_simple_command(:get, path, options)
999
+ command.response_representation = Google::Apis::GmailV1::ListMessagesResponse::Representation
1000
+ command.response_class = Google::Apis::GmailV1::ListMessagesResponse
1001
+ command.params['userId'] = user_id unless user_id.nil?
1002
+ command.query['includeSpamTrash'] = include_spam_trash unless include_spam_trash.nil?
1003
+ command.query['labelIds'] = label_ids unless label_ids.nil?
1004
+ command.query['maxResults'] = max_results unless max_results.nil?
1005
+ command.query['pageToken'] = page_token unless page_token.nil?
1006
+ command.query['q'] = q unless q.nil?
1007
+ command.query['fields'] = fields unless fields.nil?
1008
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1009
+ command.query['userIp'] = user_ip unless user_ip.nil?
1010
+ execute_or_queue_command(command, &block)
1011
+ end
1012
+
1013
+ # Modifies the labels on the specified message.
1014
+ # @param [String] user_id
1015
+ # The user's email address. The special value me can be used to indicate the
1016
+ # authenticated user.
1017
+ # @param [String] id
1018
+ # The ID of the message to modify.
1019
+ # @param [Google::Apis::GmailV1::ModifyMessageRequest] modify_message_request_object
1020
+ # @param [String] fields
1021
+ # Selector specifying which fields to include in a partial response.
1022
+ # @param [String] quota_user
1023
+ # Available to use for quota purposes for server-side applications. Can be any
1024
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1025
+ # Overrides userIp if both are provided.
1026
+ # @param [String] user_ip
1027
+ # IP address of the site where the request originates. Use this if you want to
1028
+ # enforce per-user limits.
1029
+ # @param [Google::Apis::RequestOptions] options
1030
+ # Request-specific options
1031
+ #
1032
+ # @yield [result, err] Result & error if block supplied
1033
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
1034
+ # @yieldparam err [StandardError] error object if request failed
1035
+ #
1036
+ # @return [Google::Apis::GmailV1::Message]
1037
+ #
1038
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1039
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1040
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1041
+ def modify_message(user_id, id, modify_message_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1042
+ path = '{userId}/messages/{id}/modify'
1043
+ command = make_simple_command(:post, path, options)
1044
+ command.request_representation = Google::Apis::GmailV1::ModifyMessageRequest::Representation
1045
+ command.request_object = modify_message_request_object
1046
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
1047
+ command.response_class = Google::Apis::GmailV1::Message
1048
+ command.params['userId'] = user_id unless user_id.nil?
1049
+ command.params['id'] = id unless id.nil?
1050
+ command.query['fields'] = fields unless fields.nil?
1051
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1052
+ command.query['userIp'] = user_ip unless user_ip.nil?
1053
+ execute_or_queue_command(command, &block)
1054
+ end
1055
+
1056
+ # Sends the specified message to the recipients in the To, Cc, and Bcc headers.
1057
+ # @param [String] user_id
1058
+ # The user's email address. The special value me can be used to indicate the
1059
+ # authenticated user.
1060
+ # @param [Google::Apis::GmailV1::Message] message_object
1061
+ # @param [String] fields
1062
+ # Selector specifying which fields to include in a partial response.
1063
+ # @param [String] quota_user
1064
+ # Available to use for quota purposes for server-side applications. Can be any
1065
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1066
+ # Overrides userIp if both are provided.
1067
+ # @param [String] user_ip
1068
+ # IP address of the site where the request originates. Use this if you want to
1069
+ # enforce per-user limits.
1070
+ # @param [IO, String] upload_source
1071
+ # IO stream or filename containing content to upload
1072
+ # @param [String] content_type
1073
+ # Content type of the uploaded content.
1074
+ # @param [Google::Apis::RequestOptions] options
1075
+ # Request-specific options
1076
+ #
1077
+ # @yield [result, err] Result & error if block supplied
1078
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
1079
+ # @yieldparam err [StandardError] error object if request failed
1080
+ #
1081
+ # @return [Google::Apis::GmailV1::Message]
1082
+ #
1083
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1084
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1085
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1086
+ def send_user_message(user_id, message_object = nil, fields: nil, quota_user: nil, user_ip: nil, upload_source: nil, content_type: nil, options: nil, &block)
1087
+ path = '{userId}/messages/send'
1088
+ if upload_source.nil?
1089
+ command = make_simple_command(:post, path, options)
1090
+ else
1091
+ command = make_upload_command(:post, path, options)
1092
+ command.upload_source = upload_source
1093
+ command.upload_content_type = content_type
1094
+ end
1095
+ command.request_representation = Google::Apis::GmailV1::Message::Representation
1096
+ command.request_object = message_object
1097
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
1098
+ command.response_class = Google::Apis::GmailV1::Message
1099
+ command.params['userId'] = user_id unless user_id.nil?
1100
+ command.query['fields'] = fields unless fields.nil?
1101
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1102
+ command.query['userIp'] = user_ip unless user_ip.nil?
1103
+ execute_or_queue_command(command, &block)
1104
+ end
1105
+
1106
+ # Moves the specified message to the trash.
1107
+ # @param [String] user_id
1108
+ # The user's email address. The special value me can be used to indicate the
1109
+ # authenticated user.
1110
+ # @param [String] id
1111
+ # The ID of the message to Trash.
1112
+ # @param [String] fields
1113
+ # Selector specifying which fields to include in a partial response.
1114
+ # @param [String] quota_user
1115
+ # Available to use for quota purposes for server-side applications. Can be any
1116
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1117
+ # Overrides userIp if both are provided.
1118
+ # @param [String] user_ip
1119
+ # IP address of the site where the request originates. Use this if you want to
1120
+ # enforce per-user limits.
1121
+ # @param [Google::Apis::RequestOptions] options
1122
+ # Request-specific options
1123
+ #
1124
+ # @yield [result, err] Result & error if block supplied
1125
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
1126
+ # @yieldparam err [StandardError] error object if request failed
1127
+ #
1128
+ # @return [Google::Apis::GmailV1::Message]
1129
+ #
1130
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1131
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1132
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1133
+ def trash_user_message(user_id, id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1134
+ path = '{userId}/messages/{id}/trash'
1135
+ command = make_simple_command(:post, path, options)
1136
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
1137
+ command.response_class = Google::Apis::GmailV1::Message
1138
+ command.params['userId'] = user_id unless user_id.nil?
1139
+ command.params['id'] = id unless id.nil?
1140
+ command.query['fields'] = fields unless fields.nil?
1141
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1142
+ command.query['userIp'] = user_ip unless user_ip.nil?
1143
+ execute_or_queue_command(command, &block)
1144
+ end
1145
+
1146
+ # Removes the specified message from the trash.
1147
+ # @param [String] user_id
1148
+ # The user's email address. The special value me can be used to indicate the
1149
+ # authenticated user.
1150
+ # @param [String] id
1151
+ # The ID of the message to remove from Trash.
1152
+ # @param [String] fields
1153
+ # Selector specifying which fields to include in a partial response.
1154
+ # @param [String] quota_user
1155
+ # Available to use for quota purposes for server-side applications. Can be any
1156
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1157
+ # Overrides userIp if both are provided.
1158
+ # @param [String] user_ip
1159
+ # IP address of the site where the request originates. Use this if you want to
1160
+ # enforce per-user limits.
1161
+ # @param [Google::Apis::RequestOptions] options
1162
+ # Request-specific options
1163
+ #
1164
+ # @yield [result, err] Result & error if block supplied
1165
+ # @yieldparam result [Google::Apis::GmailV1::Message] parsed result object
1166
+ # @yieldparam err [StandardError] error object if request failed
1167
+ #
1168
+ # @return [Google::Apis::GmailV1::Message]
1169
+ #
1170
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1171
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1172
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1173
+ def untrash_user_message(user_id, id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1174
+ path = '{userId}/messages/{id}/untrash'
1175
+ command = make_simple_command(:post, path, options)
1176
+ command.response_representation = Google::Apis::GmailV1::Message::Representation
1177
+ command.response_class = Google::Apis::GmailV1::Message
1178
+ command.params['userId'] = user_id unless user_id.nil?
1179
+ command.params['id'] = id unless id.nil?
1180
+ command.query['fields'] = fields unless fields.nil?
1181
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1182
+ command.query['userIp'] = user_ip unless user_ip.nil?
1183
+ execute_or_queue_command(command, &block)
1184
+ end
1185
+
1186
+ # Gets the specified message attachment.
1187
+ # @param [String] user_id
1188
+ # The user's email address. The special value me can be used to indicate the
1189
+ # authenticated user.
1190
+ # @param [String] message_id
1191
+ # The ID of the message containing the attachment.
1192
+ # @param [String] id
1193
+ # The ID of the attachment.
1194
+ # @param [String] fields
1195
+ # Selector specifying which fields to include in a partial response.
1196
+ # @param [String] quota_user
1197
+ # Available to use for quota purposes for server-side applications. Can be any
1198
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1199
+ # Overrides userIp if both are provided.
1200
+ # @param [String] user_ip
1201
+ # IP address of the site where the request originates. Use this if you want to
1202
+ # enforce per-user limits.
1203
+ # @param [Google::Apis::RequestOptions] options
1204
+ # Request-specific options
1205
+ #
1206
+ # @yield [result, err] Result & error if block supplied
1207
+ # @yieldparam result [Google::Apis::GmailV1::MessagePartBody] parsed result object
1208
+ # @yieldparam err [StandardError] error object if request failed
1209
+ #
1210
+ # @return [Google::Apis::GmailV1::MessagePartBody]
1211
+ #
1212
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1213
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1214
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1215
+ def get_user_message_attachment(user_id, message_id, id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1216
+ path = '{userId}/messages/{messageId}/attachments/{id}'
1217
+ command = make_simple_command(:get, path, options)
1218
+ command.response_representation = Google::Apis::GmailV1::MessagePartBody::Representation
1219
+ command.response_class = Google::Apis::GmailV1::MessagePartBody
1220
+ command.params['userId'] = user_id unless user_id.nil?
1221
+ command.params['messageId'] = message_id unless message_id.nil?
1222
+ command.params['id'] = id unless id.nil?
1223
+ command.query['fields'] = fields unless fields.nil?
1224
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1225
+ command.query['userIp'] = user_ip unless user_ip.nil?
1226
+ execute_or_queue_command(command, &block)
1227
+ end
1228
+
1229
+ # Immediately and permanently deletes the specified thread. This operation
1230
+ # cannot be undone. Prefer threads.trash instead.
1231
+ # @param [String] user_id
1232
+ # The user's email address. The special value me can be used to indicate the
1233
+ # authenticated user.
1234
+ # @param [String] id
1235
+ # ID of the Thread to delete.
1236
+ # @param [String] fields
1237
+ # Selector specifying which fields to include in a partial response.
1238
+ # @param [String] quota_user
1239
+ # Available to use for quota purposes for server-side applications. Can be any
1240
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1241
+ # Overrides userIp if both are provided.
1242
+ # @param [String] user_ip
1243
+ # IP address of the site where the request originates. Use this if you want to
1244
+ # enforce per-user limits.
1245
+ # @param [Google::Apis::RequestOptions] options
1246
+ # Request-specific options
1247
+ #
1248
+ # @yield [result, err] Result & error if block supplied
1249
+ # @yieldparam result [NilClass] No result returned for this method
1250
+ # @yieldparam err [StandardError] error object if request failed
1251
+ #
1252
+ # @return [void]
1253
+ #
1254
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1255
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1256
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1257
+ def delete_user_thread(user_id, id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1258
+ path = '{userId}/threads/{id}'
1259
+ command = make_simple_command(:delete, path, options)
1260
+ command.params['userId'] = user_id unless user_id.nil?
1261
+ command.params['id'] = id unless id.nil?
1262
+ command.query['fields'] = fields unless fields.nil?
1263
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1264
+ command.query['userIp'] = user_ip unless user_ip.nil?
1265
+ execute_or_queue_command(command, &block)
1266
+ end
1267
+
1268
+ # Gets the specified thread.
1269
+ # @param [String] user_id
1270
+ # The user's email address. The special value me can be used to indicate the
1271
+ # authenticated user.
1272
+ # @param [String] id
1273
+ # The ID of the thread to retrieve.
1274
+ # @param [String] format
1275
+ # The format to return the messages in.
1276
+ # @param [Array<String>, String] metadata_headers
1277
+ # When given and format is METADATA, only include headers specified.
1278
+ # @param [String] fields
1279
+ # Selector specifying which fields to include in a partial response.
1280
+ # @param [String] quota_user
1281
+ # Available to use for quota purposes for server-side applications. Can be any
1282
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1283
+ # Overrides userIp if both are provided.
1284
+ # @param [String] user_ip
1285
+ # IP address of the site where the request originates. Use this if you want to
1286
+ # enforce per-user limits.
1287
+ # @param [Google::Apis::RequestOptions] options
1288
+ # Request-specific options
1289
+ #
1290
+ # @yield [result, err] Result & error if block supplied
1291
+ # @yieldparam result [Google::Apis::GmailV1::Thread] parsed result object
1292
+ # @yieldparam err [StandardError] error object if request failed
1293
+ #
1294
+ # @return [Google::Apis::GmailV1::Thread]
1295
+ #
1296
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1297
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1298
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1299
+ def get_user_thread(user_id, id, format: nil, metadata_headers: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1300
+ path = '{userId}/threads/{id}'
1301
+ command = make_simple_command(:get, path, options)
1302
+ command.response_representation = Google::Apis::GmailV1::Thread::Representation
1303
+ command.response_class = Google::Apis::GmailV1::Thread
1304
+ command.params['userId'] = user_id unless user_id.nil?
1305
+ command.params['id'] = id unless id.nil?
1306
+ command.query['format'] = format unless format.nil?
1307
+ command.query['metadataHeaders'] = metadata_headers unless metadata_headers.nil?
1308
+ command.query['fields'] = fields unless fields.nil?
1309
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1310
+ command.query['userIp'] = user_ip unless user_ip.nil?
1311
+ execute_or_queue_command(command, &block)
1312
+ end
1313
+
1314
+ # Lists the threads in the user's mailbox.
1315
+ # @param [String] user_id
1316
+ # The user's email address. The special value me can be used to indicate the
1317
+ # authenticated user.
1318
+ # @param [Boolean] include_spam_trash
1319
+ # Include threads from SPAM and TRASH in the results.
1320
+ # @param [Array<String>, String] label_ids
1321
+ # Only return threads with labels that match all of the specified label IDs.
1322
+ # @param [Fixnum] max_results
1323
+ # Maximum number of threads to return.
1324
+ # @param [String] page_token
1325
+ # Page token to retrieve a specific page of results in the list.
1326
+ # @param [String] q
1327
+ # Only return threads matching the specified query. Supports the same query
1328
+ # format as the Gmail search box. For example, "from:someuser@example.com
1329
+ # rfc822msgid: is:unread".
1330
+ # @param [String] fields
1331
+ # Selector specifying which fields to include in a partial response.
1332
+ # @param [String] quota_user
1333
+ # Available to use for quota purposes for server-side applications. Can be any
1334
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1335
+ # Overrides userIp if both are provided.
1336
+ # @param [String] user_ip
1337
+ # IP address of the site where the request originates. Use this if you want to
1338
+ # enforce per-user limits.
1339
+ # @param [Google::Apis::RequestOptions] options
1340
+ # Request-specific options
1341
+ #
1342
+ # @yield [result, err] Result & error if block supplied
1343
+ # @yieldparam result [Google::Apis::GmailV1::ListThreadsResponse] parsed result object
1344
+ # @yieldparam err [StandardError] error object if request failed
1345
+ #
1346
+ # @return [Google::Apis::GmailV1::ListThreadsResponse]
1347
+ #
1348
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1349
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1350
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1351
+ def list_user_threads(user_id, include_spam_trash: nil, label_ids: nil, max_results: nil, page_token: nil, q: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1352
+ path = '{userId}/threads'
1353
+ command = make_simple_command(:get, path, options)
1354
+ command.response_representation = Google::Apis::GmailV1::ListThreadsResponse::Representation
1355
+ command.response_class = Google::Apis::GmailV1::ListThreadsResponse
1356
+ command.params['userId'] = user_id unless user_id.nil?
1357
+ command.query['includeSpamTrash'] = include_spam_trash unless include_spam_trash.nil?
1358
+ command.query['labelIds'] = label_ids unless label_ids.nil?
1359
+ command.query['maxResults'] = max_results unless max_results.nil?
1360
+ command.query['pageToken'] = page_token unless page_token.nil?
1361
+ command.query['q'] = q unless q.nil?
1362
+ command.query['fields'] = fields unless fields.nil?
1363
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1364
+ command.query['userIp'] = user_ip unless user_ip.nil?
1365
+ execute_or_queue_command(command, &block)
1366
+ end
1367
+
1368
+ # Modifies the labels applied to the thread. This applies to all messages in the
1369
+ # thread.
1370
+ # @param [String] user_id
1371
+ # The user's email address. The special value me can be used to indicate the
1372
+ # authenticated user.
1373
+ # @param [String] id
1374
+ # The ID of the thread to modify.
1375
+ # @param [Google::Apis::GmailV1::ModifyThreadRequest] modify_thread_request_object
1376
+ # @param [String] fields
1377
+ # Selector specifying which fields to include in a partial response.
1378
+ # @param [String] quota_user
1379
+ # Available to use for quota purposes for server-side applications. Can be any
1380
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1381
+ # Overrides userIp if both are provided.
1382
+ # @param [String] user_ip
1383
+ # IP address of the site where the request originates. Use this if you want to
1384
+ # enforce per-user limits.
1385
+ # @param [Google::Apis::RequestOptions] options
1386
+ # Request-specific options
1387
+ #
1388
+ # @yield [result, err] Result & error if block supplied
1389
+ # @yieldparam result [Google::Apis::GmailV1::Thread] parsed result object
1390
+ # @yieldparam err [StandardError] error object if request failed
1391
+ #
1392
+ # @return [Google::Apis::GmailV1::Thread]
1393
+ #
1394
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1395
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1396
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1397
+ def modify_thread(user_id, id, modify_thread_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1398
+ path = '{userId}/threads/{id}/modify'
1399
+ command = make_simple_command(:post, path, options)
1400
+ command.request_representation = Google::Apis::GmailV1::ModifyThreadRequest::Representation
1401
+ command.request_object = modify_thread_request_object
1402
+ command.response_representation = Google::Apis::GmailV1::Thread::Representation
1403
+ command.response_class = Google::Apis::GmailV1::Thread
1404
+ command.params['userId'] = user_id unless user_id.nil?
1405
+ command.params['id'] = id unless id.nil?
1406
+ command.query['fields'] = fields unless fields.nil?
1407
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1408
+ command.query['userIp'] = user_ip unless user_ip.nil?
1409
+ execute_or_queue_command(command, &block)
1410
+ end
1411
+
1412
+ # Moves the specified thread to the trash.
1413
+ # @param [String] user_id
1414
+ # The user's email address. The special value me can be used to indicate the
1415
+ # authenticated user.
1416
+ # @param [String] id
1417
+ # The ID of the thread to Trash.
1418
+ # @param [String] fields
1419
+ # Selector specifying which fields to include in a partial response.
1420
+ # @param [String] quota_user
1421
+ # Available to use for quota purposes for server-side applications. Can be any
1422
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1423
+ # Overrides userIp if both are provided.
1424
+ # @param [String] user_ip
1425
+ # IP address of the site where the request originates. Use this if you want to
1426
+ # enforce per-user limits.
1427
+ # @param [Google::Apis::RequestOptions] options
1428
+ # Request-specific options
1429
+ #
1430
+ # @yield [result, err] Result & error if block supplied
1431
+ # @yieldparam result [Google::Apis::GmailV1::Thread] parsed result object
1432
+ # @yieldparam err [StandardError] error object if request failed
1433
+ #
1434
+ # @return [Google::Apis::GmailV1::Thread]
1435
+ #
1436
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1437
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1438
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1439
+ def trash_user_thread(user_id, id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1440
+ path = '{userId}/threads/{id}/trash'
1441
+ command = make_simple_command(:post, path, options)
1442
+ command.response_representation = Google::Apis::GmailV1::Thread::Representation
1443
+ command.response_class = Google::Apis::GmailV1::Thread
1444
+ command.params['userId'] = user_id unless user_id.nil?
1445
+ command.params['id'] = id unless id.nil?
1446
+ command.query['fields'] = fields unless fields.nil?
1447
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1448
+ command.query['userIp'] = user_ip unless user_ip.nil?
1449
+ execute_or_queue_command(command, &block)
1450
+ end
1451
+
1452
+ # Removes the specified thread from the trash.
1453
+ # @param [String] user_id
1454
+ # The user's email address. The special value me can be used to indicate the
1455
+ # authenticated user.
1456
+ # @param [String] id
1457
+ # The ID of the thread to remove from Trash.
1458
+ # @param [String] fields
1459
+ # Selector specifying which fields to include in a partial response.
1460
+ # @param [String] quota_user
1461
+ # Available to use for quota purposes for server-side applications. Can be any
1462
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1463
+ # Overrides userIp if both are provided.
1464
+ # @param [String] user_ip
1465
+ # IP address of the site where the request originates. Use this if you want to
1466
+ # enforce per-user limits.
1467
+ # @param [Google::Apis::RequestOptions] options
1468
+ # Request-specific options
1469
+ #
1470
+ # @yield [result, err] Result & error if block supplied
1471
+ # @yieldparam result [Google::Apis::GmailV1::Thread] parsed result object
1472
+ # @yieldparam err [StandardError] error object if request failed
1473
+ #
1474
+ # @return [Google::Apis::GmailV1::Thread]
1475
+ #
1476
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1477
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1478
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1479
+ def untrash_user_thread(user_id, id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1480
+ path = '{userId}/threads/{id}/untrash'
1481
+ command = make_simple_command(:post, path, options)
1482
+ command.response_representation = Google::Apis::GmailV1::Thread::Representation
1483
+ command.response_class = Google::Apis::GmailV1::Thread
1484
+ command.params['userId'] = user_id unless user_id.nil?
1485
+ command.params['id'] = id unless id.nil?
1486
+ command.query['fields'] = fields unless fields.nil?
1487
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1488
+ command.query['userIp'] = user_ip unless user_ip.nil?
1489
+ execute_or_queue_command(command, &block)
1490
+ end
1491
+
1492
+ protected
1493
+
1494
+ def apply_command_defaults(command)
1495
+ command.query['key'] = key unless key.nil?
1496
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1497
+ command.query['userIp'] = user_ip unless user_ip.nil?
1498
+ end
1499
+ end
1500
+ end
1501
+ end
1502
+ end