Document.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  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 Document (v1).
  21. *
  22. * <p>
  23. * Service to parse structured information from unstructured or semi-structured
  24. * documents using state-of-the-art Google AI such as natural language, computer
  25. * vision, translation, and AutoML.</p>
  26. *
  27. * <p>
  28. * For more information about this service, see the API
  29. * <a href="https://cloud.google.com/document-ai/docs/" target="_blank">Documentation</a>
  30. * </p>
  31. *
  32. * @author Google, Inc.
  33. */
  34. class Document extends \Google\Service
  35. {
  36. /** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.. */
  37. const CLOUD_PLATFORM =
  38. "https://www.googleapis.com/auth/cloud-platform";
  39. public $operations;
  40. public $projects_locations;
  41. public $projects_locations_operations;
  42. public $projects_locations_processorTypes;
  43. public $projects_locations_processors;
  44. public $projects_locations_processors_humanReviewConfig;
  45. public $projects_locations_processors_processorVersions;
  46. public $projects_locations_processors_processorVersions_evaluations;
  47. public $projects_locations_schemas;
  48. public $projects_locations_schemas_schemaVersions;
  49. public $projects_operations;
  50. public $rootUrlTemplate;
  51. /**
  52. * Constructs the internal representation of the Document service.
  53. *
  54. * @param Client|array $clientOrConfig The client used to deliver requests, or a
  55. * config array to pass to a new Client instance.
  56. * @param string $rootUrl The root URL used for requests to the service.
  57. */
  58. public function __construct($clientOrConfig = [], $rootUrl = null)
  59. {
  60. parent::__construct($clientOrConfig);
  61. $this->rootUrl = $rootUrl ?: 'https://documentai.googleapis.com/';
  62. $this->rootUrlTemplate = $rootUrl ?: 'https://documentai.UNIVERSE_DOMAIN/';
  63. $this->servicePath = '';
  64. $this->batchPath = 'batch';
  65. $this->version = 'v1';
  66. $this->serviceName = 'documentai';
  67. $this->operations = new Document\Resource\Operations(
  68. $this,
  69. $this->serviceName,
  70. 'operations',
  71. [
  72. 'methods' => [
  73. 'delete' => [
  74. 'path' => 'v1/{+name}',
  75. 'httpMethod' => 'DELETE',
  76. 'parameters' => [
  77. 'name' => [
  78. 'location' => 'path',
  79. 'type' => 'string',
  80. 'required' => true,
  81. ],
  82. ],
  83. ],
  84. ]
  85. ]
  86. );
  87. $this->projects_locations = new Document\Resource\ProjectsLocations(
  88. $this,
  89. $this->serviceName,
  90. 'locations',
  91. [
  92. 'methods' => [
  93. 'fetchProcessorTypes' => [
  94. 'path' => 'v1/{+parent}:fetchProcessorTypes',
  95. 'httpMethod' => 'GET',
  96. 'parameters' => [
  97. 'parent' => [
  98. 'location' => 'path',
  99. 'type' => 'string',
  100. 'required' => true,
  101. ],
  102. ],
  103. ],'get' => [
  104. 'path' => 'v1/{+name}',
  105. 'httpMethod' => 'GET',
  106. 'parameters' => [
  107. 'name' => [
  108. 'location' => 'path',
  109. 'type' => 'string',
  110. 'required' => true,
  111. ],
  112. ],
  113. ],'list' => [
  114. 'path' => 'v1/{+name}/locations',
  115. 'httpMethod' => 'GET',
  116. 'parameters' => [
  117. 'name' => [
  118. 'location' => 'path',
  119. 'type' => 'string',
  120. 'required' => true,
  121. ],
  122. 'extraLocationTypes' => [
  123. 'location' => 'query',
  124. 'type' => 'string',
  125. 'repeated' => true,
  126. ],
  127. 'filter' => [
  128. 'location' => 'query',
  129. 'type' => 'string',
  130. ],
  131. 'pageSize' => [
  132. 'location' => 'query',
  133. 'type' => 'integer',
  134. ],
  135. 'pageToken' => [
  136. 'location' => 'query',
  137. 'type' => 'string',
  138. ],
  139. ],
  140. ],
  141. ]
  142. ]
  143. );
  144. $this->projects_locations_operations = new Document\Resource\ProjectsLocationsOperations(
  145. $this,
  146. $this->serviceName,
  147. 'operations',
  148. [
  149. 'methods' => [
  150. 'cancel' => [
  151. 'path' => 'v1/{+name}:cancel',
  152. 'httpMethod' => 'POST',
  153. 'parameters' => [
  154. 'name' => [
  155. 'location' => 'path',
  156. 'type' => 'string',
  157. 'required' => true,
  158. ],
  159. ],
  160. ],'get' => [
  161. 'path' => 'v1/{+name}',
  162. 'httpMethod' => 'GET',
  163. 'parameters' => [
  164. 'name' => [
  165. 'location' => 'path',
  166. 'type' => 'string',
  167. 'required' => true,
  168. ],
  169. ],
  170. ],'list' => [
  171. 'path' => 'v1/{+name}',
  172. 'httpMethod' => 'GET',
  173. 'parameters' => [
  174. 'name' => [
  175. 'location' => 'path',
  176. 'type' => 'string',
  177. 'required' => true,
  178. ],
  179. 'filter' => [
  180. 'location' => 'query',
  181. 'type' => 'string',
  182. ],
  183. 'pageSize' => [
  184. 'location' => 'query',
  185. 'type' => 'integer',
  186. ],
  187. 'pageToken' => [
  188. 'location' => 'query',
  189. 'type' => 'string',
  190. ],
  191. 'returnPartialSuccess' => [
  192. 'location' => 'query',
  193. 'type' => 'boolean',
  194. ],
  195. ],
  196. ],
  197. ]
  198. ]
  199. );
  200. $this->projects_locations_processorTypes = new Document\Resource\ProjectsLocationsProcessorTypes(
  201. $this,
  202. $this->serviceName,
  203. 'processorTypes',
  204. [
  205. 'methods' => [
  206. 'get' => [
  207. 'path' => 'v1/{+name}',
  208. 'httpMethod' => 'GET',
  209. 'parameters' => [
  210. 'name' => [
  211. 'location' => 'path',
  212. 'type' => 'string',
  213. 'required' => true,
  214. ],
  215. ],
  216. ],'list' => [
  217. 'path' => 'v1/{+parent}/processorTypes',
  218. 'httpMethod' => 'GET',
  219. 'parameters' => [
  220. 'parent' => [
  221. 'location' => 'path',
  222. 'type' => 'string',
  223. 'required' => true,
  224. ],
  225. 'pageSize' => [
  226. 'location' => 'query',
  227. 'type' => 'integer',
  228. ],
  229. 'pageToken' => [
  230. 'location' => 'query',
  231. 'type' => 'string',
  232. ],
  233. ],
  234. ],
  235. ]
  236. ]
  237. );
  238. $this->projects_locations_processors = new Document\Resource\ProjectsLocationsProcessors(
  239. $this,
  240. $this->serviceName,
  241. 'processors',
  242. [
  243. 'methods' => [
  244. 'batchProcess' => [
  245. 'path' => 'v1/{+name}:batchProcess',
  246. 'httpMethod' => 'POST',
  247. 'parameters' => [
  248. 'name' => [
  249. 'location' => 'path',
  250. 'type' => 'string',
  251. 'required' => true,
  252. ],
  253. ],
  254. ],'create' => [
  255. 'path' => 'v1/{+parent}/processors',
  256. 'httpMethod' => 'POST',
  257. 'parameters' => [
  258. 'parent' => [
  259. 'location' => 'path',
  260. 'type' => 'string',
  261. 'required' => true,
  262. ],
  263. ],
  264. ],'delete' => [
  265. 'path' => 'v1/{+name}',
  266. 'httpMethod' => 'DELETE',
  267. 'parameters' => [
  268. 'name' => [
  269. 'location' => 'path',
  270. 'type' => 'string',
  271. 'required' => true,
  272. ],
  273. ],
  274. ],'disable' => [
  275. 'path' => 'v1/{+name}:disable',
  276. 'httpMethod' => 'POST',
  277. 'parameters' => [
  278. 'name' => [
  279. 'location' => 'path',
  280. 'type' => 'string',
  281. 'required' => true,
  282. ],
  283. ],
  284. ],'enable' => [
  285. 'path' => 'v1/{+name}:enable',
  286. 'httpMethod' => 'POST',
  287. 'parameters' => [
  288. 'name' => [
  289. 'location' => 'path',
  290. 'type' => 'string',
  291. 'required' => true,
  292. ],
  293. ],
  294. ],'get' => [
  295. 'path' => 'v1/{+name}',
  296. 'httpMethod' => 'GET',
  297. 'parameters' => [
  298. 'name' => [
  299. 'location' => 'path',
  300. 'type' => 'string',
  301. 'required' => true,
  302. ],
  303. ],
  304. ],'list' => [
  305. 'path' => 'v1/{+parent}/processors',
  306. 'httpMethod' => 'GET',
  307. 'parameters' => [
  308. 'parent' => [
  309. 'location' => 'path',
  310. 'type' => 'string',
  311. 'required' => true,
  312. ],
  313. 'pageSize' => [
  314. 'location' => 'query',
  315. 'type' => 'integer',
  316. ],
  317. 'pageToken' => [
  318. 'location' => 'query',
  319. 'type' => 'string',
  320. ],
  321. ],
  322. ],'process' => [
  323. 'path' => 'v1/{+name}:process',
  324. 'httpMethod' => 'POST',
  325. 'parameters' => [
  326. 'name' => [
  327. 'location' => 'path',
  328. 'type' => 'string',
  329. 'required' => true,
  330. ],
  331. ],
  332. ],'setDefaultProcessorVersion' => [
  333. 'path' => 'v1/{+processor}:setDefaultProcessorVersion',
  334. 'httpMethod' => 'POST',
  335. 'parameters' => [
  336. 'processor' => [
  337. 'location' => 'path',
  338. 'type' => 'string',
  339. 'required' => true,
  340. ],
  341. ],
  342. ],
  343. ]
  344. ]
  345. );
  346. $this->projects_locations_processors_humanReviewConfig = new Document\Resource\ProjectsLocationsProcessorsHumanReviewConfig(
  347. $this,
  348. $this->serviceName,
  349. 'humanReviewConfig',
  350. [
  351. 'methods' => [
  352. 'reviewDocument' => [
  353. 'path' => 'v1/{+humanReviewConfig}:reviewDocument',
  354. 'httpMethod' => 'POST',
  355. 'parameters' => [
  356. 'humanReviewConfig' => [
  357. 'location' => 'path',
  358. 'type' => 'string',
  359. 'required' => true,
  360. ],
  361. ],
  362. ],
  363. ]
  364. ]
  365. );
  366. $this->projects_locations_processors_processorVersions = new Document\Resource\ProjectsLocationsProcessorsProcessorVersions(
  367. $this,
  368. $this->serviceName,
  369. 'processorVersions',
  370. [
  371. 'methods' => [
  372. 'batchProcess' => [
  373. 'path' => 'v1/{+name}:batchProcess',
  374. 'httpMethod' => 'POST',
  375. 'parameters' => [
  376. 'name' => [
  377. 'location' => 'path',
  378. 'type' => 'string',
  379. 'required' => true,
  380. ],
  381. ],
  382. ],'delete' => [
  383. 'path' => 'v1/{+name}',
  384. 'httpMethod' => 'DELETE',
  385. 'parameters' => [
  386. 'name' => [
  387. 'location' => 'path',
  388. 'type' => 'string',
  389. 'required' => true,
  390. ],
  391. ],
  392. ],'deploy' => [
  393. 'path' => 'v1/{+name}:deploy',
  394. 'httpMethod' => 'POST',
  395. 'parameters' => [
  396. 'name' => [
  397. 'location' => 'path',
  398. 'type' => 'string',
  399. 'required' => true,
  400. ],
  401. ],
  402. ],'evaluateProcessorVersion' => [
  403. 'path' => 'v1/{+processorVersion}:evaluateProcessorVersion',
  404. 'httpMethod' => 'POST',
  405. 'parameters' => [
  406. 'processorVersion' => [
  407. 'location' => 'path',
  408. 'type' => 'string',
  409. 'required' => true,
  410. ],
  411. ],
  412. ],'get' => [
  413. 'path' => 'v1/{+name}',
  414. 'httpMethod' => 'GET',
  415. 'parameters' => [
  416. 'name' => [
  417. 'location' => 'path',
  418. 'type' => 'string',
  419. 'required' => true,
  420. ],
  421. ],
  422. ],'list' => [
  423. 'path' => 'v1/{+parent}/processorVersions',
  424. 'httpMethod' => 'GET',
  425. 'parameters' => [
  426. 'parent' => [
  427. 'location' => 'path',
  428. 'type' => 'string',
  429. 'required' => true,
  430. ],
  431. 'pageSize' => [
  432. 'location' => 'query',
  433. 'type' => 'integer',
  434. ],
  435. 'pageToken' => [
  436. 'location' => 'query',
  437. 'type' => 'string',
  438. ],
  439. ],
  440. ],'process' => [
  441. 'path' => 'v1/{+name}:process',
  442. 'httpMethod' => 'POST',
  443. 'parameters' => [
  444. 'name' => [
  445. 'location' => 'path',
  446. 'type' => 'string',
  447. 'required' => true,
  448. ],
  449. ],
  450. ],'train' => [
  451. 'path' => 'v1/{+parent}/processorVersions:train',
  452. 'httpMethod' => 'POST',
  453. 'parameters' => [
  454. 'parent' => [
  455. 'location' => 'path',
  456. 'type' => 'string',
  457. 'required' => true,
  458. ],
  459. ],
  460. ],'undeploy' => [
  461. 'path' => 'v1/{+name}:undeploy',
  462. 'httpMethod' => 'POST',
  463. 'parameters' => [
  464. 'name' => [
  465. 'location' => 'path',
  466. 'type' => 'string',
  467. 'required' => true,
  468. ],
  469. ],
  470. ],
  471. ]
  472. ]
  473. );
  474. $this->projects_locations_processors_processorVersions_evaluations = new Document\Resource\ProjectsLocationsProcessorsProcessorVersionsEvaluations(
  475. $this,
  476. $this->serviceName,
  477. 'evaluations',
  478. [
  479. 'methods' => [
  480. 'get' => [
  481. 'path' => 'v1/{+name}',
  482. 'httpMethod' => 'GET',
  483. 'parameters' => [
  484. 'name' => [
  485. 'location' => 'path',
  486. 'type' => 'string',
  487. 'required' => true,
  488. ],
  489. ],
  490. ],'list' => [
  491. 'path' => 'v1/{+parent}/evaluations',
  492. 'httpMethod' => 'GET',
  493. 'parameters' => [
  494. 'parent' => [
  495. 'location' => 'path',
  496. 'type' => 'string',
  497. 'required' => true,
  498. ],
  499. 'pageSize' => [
  500. 'location' => 'query',
  501. 'type' => 'integer',
  502. ],
  503. 'pageToken' => [
  504. 'location' => 'query',
  505. 'type' => 'string',
  506. ],
  507. ],
  508. ],
  509. ]
  510. ]
  511. );
  512. $this->projects_locations_schemas = new Document\Resource\ProjectsLocationsSchemas(
  513. $this,
  514. $this->serviceName,
  515. 'schemas',
  516. [
  517. 'methods' => [
  518. 'create' => [
  519. 'path' => 'v1/{+parent}/schemas',
  520. 'httpMethod' => 'POST',
  521. 'parameters' => [
  522. 'parent' => [
  523. 'location' => 'path',
  524. 'type' => 'string',
  525. 'required' => true,
  526. ],
  527. ],
  528. ],'delete' => [
  529. 'path' => 'v1/{+name}',
  530. 'httpMethod' => 'DELETE',
  531. 'parameters' => [
  532. 'name' => [
  533. 'location' => 'path',
  534. 'type' => 'string',
  535. 'required' => true,
  536. ],
  537. 'force' => [
  538. 'location' => 'query',
  539. 'type' => 'boolean',
  540. ],
  541. ],
  542. ],'get' => [
  543. 'path' => 'v1/{+name}',
  544. 'httpMethod' => 'GET',
  545. 'parameters' => [
  546. 'name' => [
  547. 'location' => 'path',
  548. 'type' => 'string',
  549. 'required' => true,
  550. ],
  551. ],
  552. ],'list' => [
  553. 'path' => 'v1/{+parent}/schemas',
  554. 'httpMethod' => 'GET',
  555. 'parameters' => [
  556. 'parent' => [
  557. 'location' => 'path',
  558. 'type' => 'string',
  559. 'required' => true,
  560. ],
  561. 'pageSize' => [
  562. 'location' => 'query',
  563. 'type' => 'integer',
  564. ],
  565. 'pageToken' => [
  566. 'location' => 'query',
  567. 'type' => 'string',
  568. ],
  569. ],
  570. ],'patch' => [
  571. 'path' => 'v1/{+name}',
  572. 'httpMethod' => 'PATCH',
  573. 'parameters' => [
  574. 'name' => [
  575. 'location' => 'path',
  576. 'type' => 'string',
  577. 'required' => true,
  578. ],
  579. 'updateMask' => [
  580. 'location' => 'query',
  581. 'type' => 'string',
  582. ],
  583. ],
  584. ],
  585. ]
  586. ]
  587. );
  588. $this->projects_locations_schemas_schemaVersions = new Document\Resource\ProjectsLocationsSchemasSchemaVersions(
  589. $this,
  590. $this->serviceName,
  591. 'schemaVersions',
  592. [
  593. 'methods' => [
  594. 'create' => [
  595. 'path' => 'v1/{+parent}/schemaVersions',
  596. 'httpMethod' => 'POST',
  597. 'parameters' => [
  598. 'parent' => [
  599. 'location' => 'path',
  600. 'type' => 'string',
  601. 'required' => true,
  602. ],
  603. ],
  604. ],'delete' => [
  605. 'path' => 'v1/{+name}',
  606. 'httpMethod' => 'DELETE',
  607. 'parameters' => [
  608. 'name' => [
  609. 'location' => 'path',
  610. 'type' => 'string',
  611. 'required' => true,
  612. ],
  613. ],
  614. ],'generate' => [
  615. 'path' => 'v1/{+parent}/schemaVersions:generate',
  616. 'httpMethod' => 'POST',
  617. 'parameters' => [
  618. 'parent' => [
  619. 'location' => 'path',
  620. 'type' => 'string',
  621. 'required' => true,
  622. ],
  623. ],
  624. ],'get' => [
  625. 'path' => 'v1/{+name}',
  626. 'httpMethod' => 'GET',
  627. 'parameters' => [
  628. 'name' => [
  629. 'location' => 'path',
  630. 'type' => 'string',
  631. 'required' => true,
  632. ],
  633. ],
  634. ],'list' => [
  635. 'path' => 'v1/{+parent}/schemaVersions',
  636. 'httpMethod' => 'GET',
  637. 'parameters' => [
  638. 'parent' => [
  639. 'location' => 'path',
  640. 'type' => 'string',
  641. 'required' => true,
  642. ],
  643. 'pageSize' => [
  644. 'location' => 'query',
  645. 'type' => 'integer',
  646. ],
  647. 'pageToken' => [
  648. 'location' => 'query',
  649. 'type' => 'string',
  650. ],
  651. ],
  652. ],'patch' => [
  653. 'path' => 'v1/{+name}',
  654. 'httpMethod' => 'PATCH',
  655. 'parameters' => [
  656. 'name' => [
  657. 'location' => 'path',
  658. 'type' => 'string',
  659. 'required' => true,
  660. ],
  661. 'updateMask' => [
  662. 'location' => 'query',
  663. 'type' => 'string',
  664. ],
  665. ],
  666. ],
  667. ]
  668. ]
  669. );
  670. $this->projects_operations = new Document\Resource\ProjectsOperations(
  671. $this,
  672. $this->serviceName,
  673. 'operations',
  674. [
  675. 'methods' => [
  676. 'get' => [
  677. 'path' => 'v1/{+name}',
  678. 'httpMethod' => 'GET',
  679. 'parameters' => [
  680. 'name' => [
  681. 'location' => 'path',
  682. 'type' => 'string',
  683. 'required' => true,
  684. ],
  685. ],
  686. ],
  687. ]
  688. ]
  689. );
  690. }
  691. }
  692. // Adding a class alias for backwards compatibility with the previous class name.
  693. class_alias(Document::class, 'Google_Service_Document');