HangoutsChat.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <?php
  2. /*
  3. * Copyright 2014 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  6. * use this file except in compliance with the License. You may obtain a copy of
  7. * the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. * License for the specific language governing permissions and limitations under
  15. * the License.
  16. */
  17. namespace Google\Service;
  18. use Google\Client;
  19. /**
  20. * Service definition for HangoutsChat (v1).
  21. *
  22. * <p>
  23. * Enables apps to fetch information and perform actions in Google Chat.
  24. * Authentication is a prerequisite for using the Google Chat REST API.</p>
  25. *
  26. * <p>
  27. * For more information about this service, see the API
  28. * <a href="https://developers.google.com/hangouts/chat" target="_blank">Documentation</a>
  29. * </p>
  30. *
  31. * @author Google, Inc.
  32. */
  33. class HangoutsChat extends \Google\Service
  34. {
  35. public $dms;
  36. public $dms_conversations;
  37. public $media;
  38. public $rooms;
  39. public $rooms_conversations;
  40. public $spaces;
  41. public $spaces_members;
  42. public $spaces_messages;
  43. public $spaces_messages_attachments;
  44. /**
  45. * Constructs the internal representation of the HangoutsChat service.
  46. *
  47. * @param Client|array $clientOrConfig The client used to deliver requests, or a
  48. * config array to pass to a new Client instance.
  49. * @param string $rootUrl The root URL used for requests to the service.
  50. */
  51. public function __construct($clientOrConfig = [], $rootUrl = null)
  52. {
  53. parent::__construct($clientOrConfig);
  54. $this->rootUrl = $rootUrl ?: 'https://chat.googleapis.com/';
  55. $this->servicePath = '';
  56. $this->batchPath = 'batch';
  57. $this->version = 'v1';
  58. $this->serviceName = 'chat';
  59. $this->dms = new HangoutsChat\Resource\Dms(
  60. $this,
  61. $this->serviceName,
  62. 'dms',
  63. [
  64. 'methods' => [
  65. 'messages' => [
  66. 'path' => 'v1/{+parent}/messages',
  67. 'httpMethod' => 'POST',
  68. 'parameters' => [
  69. 'parent' => [
  70. 'location' => 'path',
  71. 'type' => 'string',
  72. 'required' => true,
  73. ],
  74. 'requestId' => [
  75. 'location' => 'query',
  76. 'type' => 'string',
  77. ],
  78. 'threadKey' => [
  79. 'location' => 'query',
  80. 'type' => 'string',
  81. ],
  82. ],
  83. ],'webhooks' => [
  84. 'path' => 'v1/{+parent}/webhooks',
  85. 'httpMethod' => 'POST',
  86. 'parameters' => [
  87. 'parent' => [
  88. 'location' => 'path',
  89. 'type' => 'string',
  90. 'required' => true,
  91. ],
  92. 'requestId' => [
  93. 'location' => 'query',
  94. 'type' => 'string',
  95. ],
  96. 'threadKey' => [
  97. 'location' => 'query',
  98. 'type' => 'string',
  99. ],
  100. ],
  101. ],
  102. ]
  103. ]
  104. );
  105. $this->dms_conversations = new HangoutsChat\Resource\DmsConversations(
  106. $this,
  107. $this->serviceName,
  108. 'conversations',
  109. [
  110. 'methods' => [
  111. 'messages' => [
  112. 'path' => 'v1/{+parent}/messages',
  113. 'httpMethod' => 'POST',
  114. 'parameters' => [
  115. 'parent' => [
  116. 'location' => 'path',
  117. 'type' => 'string',
  118. 'required' => true,
  119. ],
  120. 'requestId' => [
  121. 'location' => 'query',
  122. 'type' => 'string',
  123. ],
  124. 'threadKey' => [
  125. 'location' => 'query',
  126. 'type' => 'string',
  127. ],
  128. ],
  129. ],
  130. ]
  131. ]
  132. );
  133. $this->media = new HangoutsChat\Resource\Media(
  134. $this,
  135. $this->serviceName,
  136. 'media',
  137. [
  138. 'methods' => [
  139. 'download' => [
  140. 'path' => 'v1/media/{+resourceName}',
  141. 'httpMethod' => 'GET',
  142. 'parameters' => [
  143. 'resourceName' => [
  144. 'location' => 'path',
  145. 'type' => 'string',
  146. 'required' => true,
  147. ],
  148. ],
  149. ],
  150. ]
  151. ]
  152. );
  153. $this->rooms = new HangoutsChat\Resource\Rooms(
  154. $this,
  155. $this->serviceName,
  156. 'rooms',
  157. [
  158. 'methods' => [
  159. 'messages' => [
  160. 'path' => 'v1/{+parent}/messages',
  161. 'httpMethod' => 'POST',
  162. 'parameters' => [
  163. 'parent' => [
  164. 'location' => 'path',
  165. 'type' => 'string',
  166. 'required' => true,
  167. ],
  168. 'requestId' => [
  169. 'location' => 'query',
  170. 'type' => 'string',
  171. ],
  172. 'threadKey' => [
  173. 'location' => 'query',
  174. 'type' => 'string',
  175. ],
  176. ],
  177. ],'webhooks' => [
  178. 'path' => 'v1/{+parent}/webhooks',
  179. 'httpMethod' => 'POST',
  180. 'parameters' => [
  181. 'parent' => [
  182. 'location' => 'path',
  183. 'type' => 'string',
  184. 'required' => true,
  185. ],
  186. 'requestId' => [
  187. 'location' => 'query',
  188. 'type' => 'string',
  189. ],
  190. 'threadKey' => [
  191. 'location' => 'query',
  192. 'type' => 'string',
  193. ],
  194. ],
  195. ],
  196. ]
  197. ]
  198. );
  199. $this->rooms_conversations = new HangoutsChat\Resource\RoomsConversations(
  200. $this,
  201. $this->serviceName,
  202. 'conversations',
  203. [
  204. 'methods' => [
  205. 'messages' => [
  206. 'path' => 'v1/{+parent}/messages',
  207. 'httpMethod' => 'POST',
  208. 'parameters' => [
  209. 'parent' => [
  210. 'location' => 'path',
  211. 'type' => 'string',
  212. 'required' => true,
  213. ],
  214. 'requestId' => [
  215. 'location' => 'query',
  216. 'type' => 'string',
  217. ],
  218. 'threadKey' => [
  219. 'location' => 'query',
  220. 'type' => 'string',
  221. ],
  222. ],
  223. ],
  224. ]
  225. ]
  226. );
  227. $this->spaces = new HangoutsChat\Resource\Spaces(
  228. $this,
  229. $this->serviceName,
  230. 'spaces',
  231. [
  232. 'methods' => [
  233. 'get' => [
  234. 'path' => 'v1/{+name}',
  235. 'httpMethod' => 'GET',
  236. 'parameters' => [
  237. 'name' => [
  238. 'location' => 'path',
  239. 'type' => 'string',
  240. 'required' => true,
  241. ],
  242. ],
  243. ],'list' => [
  244. 'path' => 'v1/spaces',
  245. 'httpMethod' => 'GET',
  246. 'parameters' => [
  247. 'pageSize' => [
  248. 'location' => 'query',
  249. 'type' => 'integer',
  250. ],
  251. 'pageToken' => [
  252. 'location' => 'query',
  253. 'type' => 'string',
  254. ],
  255. ],
  256. ],'webhooks' => [
  257. 'path' => 'v1/{+parent}/webhooks',
  258. 'httpMethod' => 'POST',
  259. 'parameters' => [
  260. 'parent' => [
  261. 'location' => 'path',
  262. 'type' => 'string',
  263. 'required' => true,
  264. ],
  265. 'requestId' => [
  266. 'location' => 'query',
  267. 'type' => 'string',
  268. ],
  269. 'threadKey' => [
  270. 'location' => 'query',
  271. 'type' => 'string',
  272. ],
  273. ],
  274. ],
  275. ]
  276. ]
  277. );
  278. $this->spaces_members = new HangoutsChat\Resource\SpacesMembers(
  279. $this,
  280. $this->serviceName,
  281. 'members',
  282. [
  283. 'methods' => [
  284. 'get' => [
  285. 'path' => 'v1/{+name}',
  286. 'httpMethod' => 'GET',
  287. 'parameters' => [
  288. 'name' => [
  289. 'location' => 'path',
  290. 'type' => 'string',
  291. 'required' => true,
  292. ],
  293. ],
  294. ],'list' => [
  295. 'path' => 'v1/{+parent}/members',
  296. 'httpMethod' => 'GET',
  297. 'parameters' => [
  298. 'parent' => [
  299. 'location' => 'path',
  300. 'type' => 'string',
  301. 'required' => true,
  302. ],
  303. 'pageSize' => [
  304. 'location' => 'query',
  305. 'type' => 'integer',
  306. ],
  307. 'pageToken' => [
  308. 'location' => 'query',
  309. 'type' => 'string',
  310. ],
  311. ],
  312. ],
  313. ]
  314. ]
  315. );
  316. $this->spaces_messages = new HangoutsChat\Resource\SpacesMessages(
  317. $this,
  318. $this->serviceName,
  319. 'messages',
  320. [
  321. 'methods' => [
  322. 'create' => [
  323. 'path' => 'v1/{+parent}/messages',
  324. 'httpMethod' => 'POST',
  325. 'parameters' => [
  326. 'parent' => [
  327. 'location' => 'path',
  328. 'type' => 'string',
  329. 'required' => true,
  330. ],
  331. 'requestId' => [
  332. 'location' => 'query',
  333. 'type' => 'string',
  334. ],
  335. 'threadKey' => [
  336. 'location' => 'query',
  337. 'type' => 'string',
  338. ],
  339. ],
  340. ],'delete' => [
  341. 'path' => 'v1/{+name}',
  342. 'httpMethod' => 'DELETE',
  343. 'parameters' => [
  344. 'name' => [
  345. 'location' => 'path',
  346. 'type' => 'string',
  347. 'required' => true,
  348. ],
  349. ],
  350. ],'get' => [
  351. 'path' => 'v1/{+name}',
  352. 'httpMethod' => 'GET',
  353. 'parameters' => [
  354. 'name' => [
  355. 'location' => 'path',
  356. 'type' => 'string',
  357. 'required' => true,
  358. ],
  359. ],
  360. ],'update' => [
  361. 'path' => 'v1/{+name}',
  362. 'httpMethod' => 'PUT',
  363. 'parameters' => [
  364. 'name' => [
  365. 'location' => 'path',
  366. 'type' => 'string',
  367. 'required' => true,
  368. ],
  369. 'updateMask' => [
  370. 'location' => 'query',
  371. 'type' => 'string',
  372. ],
  373. ],
  374. ],
  375. ]
  376. ]
  377. );
  378. $this->spaces_messages_attachments = new HangoutsChat\Resource\SpacesMessagesAttachments(
  379. $this,
  380. $this->serviceName,
  381. 'attachments',
  382. [
  383. 'methods' => [
  384. 'get' => [
  385. 'path' => 'v1/{+name}',
  386. 'httpMethod' => 'GET',
  387. 'parameters' => [
  388. 'name' => [
  389. 'location' => 'path',
  390. 'type' => 'string',
  391. 'required' => true,
  392. ],
  393. ],
  394. ],
  395. ]
  396. ]
  397. );
  398. }
  399. }
  400. // Adding a class alias for backwards compatibility with the previous class name.
  401. class_alias(HangoutsChat::class, 'Google_Service_HangoutsChat');