google-apis-documentai_v1beta3 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,344 @@
1
+ # Copyright 2020 Google LLC
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 DocumentaiV1beta3
23
+ # Cloud Document AI API
24
+ #
25
+ # Service to parse structured information from unstructured or semi-structured
26
+ # documents using state-of-the-art Google AI such as natural language, computer
27
+ # vision, translation, and AutoML.
28
+ #
29
+ # @example
30
+ # require 'google/apis/documentai_v1beta3'
31
+ #
32
+ # Documentai = Google::Apis::DocumentaiV1beta3 # Alias the module
33
+ # service = Documentai::DocumentService.new
34
+ #
35
+ # @see https://cloud.google.com/document-ai/docs/
36
+ class DocumentService < Google::Apis::Core::BaseService
37
+ # @return [String]
38
+ # API key. Your API key identifies your project and provides you with API access,
39
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
40
+ attr_accessor :key
41
+
42
+ # @return [String]
43
+ # Available to use for quota purposes for server-side applications. Can be any
44
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
45
+ attr_accessor :quota_user
46
+
47
+ def initialize
48
+ super('https://documentai.googleapis.com/', '',
49
+ client_name: 'google-apis-documentai_v1beta3',
50
+ client_version: Google::Apis::DocumentaiV1beta3::GEM_VERSION)
51
+ @batch_path = 'batch'
52
+ end
53
+
54
+ # Gets information about a location.
55
+ # @param [String] name
56
+ # Resource name for the location.
57
+ # @param [String] fields
58
+ # Selector specifying which fields to include in a partial response.
59
+ # @param [String] quota_user
60
+ # Available to use for quota purposes for server-side applications. Can be any
61
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
62
+ # @param [Google::Apis::RequestOptions] options
63
+ # Request-specific options
64
+ #
65
+ # @yield [result, err] Result & error if block supplied
66
+ # @yieldparam result [Google::Apis::DocumentaiV1beta3::GoogleCloudLocationLocation] parsed result object
67
+ # @yieldparam err [StandardError] error object if request failed
68
+ #
69
+ # @return [Google::Apis::DocumentaiV1beta3::GoogleCloudLocationLocation]
70
+ #
71
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
72
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
73
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
74
+ def get_project_location(name, fields: nil, quota_user: nil, options: nil, &block)
75
+ command = make_simple_command(:get, 'v1beta3/{+name}', options)
76
+ command.response_representation = Google::Apis::DocumentaiV1beta3::GoogleCloudLocationLocation::Representation
77
+ command.response_class = Google::Apis::DocumentaiV1beta3::GoogleCloudLocationLocation
78
+ command.params['name'] = name unless name.nil?
79
+ command.query['fields'] = fields unless fields.nil?
80
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
81
+ execute_or_queue_command(command, &block)
82
+ end
83
+
84
+ # Lists information about the supported locations for this service.
85
+ # @param [String] name
86
+ # The resource that owns the locations collection, if applicable.
87
+ # @param [String] filter
88
+ # The standard list filter.
89
+ # @param [Fixnum] page_size
90
+ # The standard list page size.
91
+ # @param [String] page_token
92
+ # The standard list page token.
93
+ # @param [String] fields
94
+ # Selector specifying which fields to include in a partial response.
95
+ # @param [String] quota_user
96
+ # Available to use for quota purposes for server-side applications. Can be any
97
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
98
+ # @param [Google::Apis::RequestOptions] options
99
+ # Request-specific options
100
+ #
101
+ # @yield [result, err] Result & error if block supplied
102
+ # @yieldparam result [Google::Apis::DocumentaiV1beta3::GoogleCloudLocationListLocationsResponse] parsed result object
103
+ # @yieldparam err [StandardError] error object if request failed
104
+ #
105
+ # @return [Google::Apis::DocumentaiV1beta3::GoogleCloudLocationListLocationsResponse]
106
+ #
107
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
108
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
109
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
110
+ def list_project_locations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
111
+ command = make_simple_command(:get, 'v1beta3/{+name}/locations', options)
112
+ command.response_representation = Google::Apis::DocumentaiV1beta3::GoogleCloudLocationListLocationsResponse::Representation
113
+ command.response_class = Google::Apis::DocumentaiV1beta3::GoogleCloudLocationListLocationsResponse
114
+ command.params['name'] = name unless name.nil?
115
+ command.query['filter'] = filter unless filter.nil?
116
+ command.query['pageSize'] = page_size unless page_size.nil?
117
+ command.query['pageToken'] = page_token unless page_token.nil?
118
+ command.query['fields'] = fields unless fields.nil?
119
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
120
+ execute_or_queue_command(command, &block)
121
+ end
122
+
123
+ # Gets the latest state of a long-running operation. Clients can use this method
124
+ # to poll the operation result at intervals as recommended by the API service.
125
+ # @param [String] name
126
+ # The name of the operation resource.
127
+ # @param [String] fields
128
+ # Selector specifying which fields to include in a partial response.
129
+ # @param [String] quota_user
130
+ # Available to use for quota purposes for server-side applications. Can be any
131
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
132
+ # @param [Google::Apis::RequestOptions] options
133
+ # Request-specific options
134
+ #
135
+ # @yield [result, err] Result & error if block supplied
136
+ # @yieldparam result [Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation] parsed result object
137
+ # @yieldparam err [StandardError] error object if request failed
138
+ #
139
+ # @return [Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation]
140
+ #
141
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
142
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
143
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
144
+ def get_project_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
145
+ command = make_simple_command(:get, 'v1beta3/{+name}', options)
146
+ command.response_representation = Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation::Representation
147
+ command.response_class = Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation
148
+ command.params['name'] = name unless name.nil?
149
+ command.query['fields'] = fields unless fields.nil?
150
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
151
+ execute_or_queue_command(command, &block)
152
+ end
153
+
154
+ # LRO endpoint to batch process many documents. The output is written to Cloud
155
+ # Storage as JSON in the [Document] format.
156
+ # @param [String] name
157
+ # Required. The resource name of Processor or ProcessorVersion. Format: projects/
158
+ # `project`/locations/`location`/processors/`processor`, or projects/`project`/
159
+ # locations/`location`/processors/`processor`/processorVerions/`processorVersion`
160
+ # @param [Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3BatchProcessRequest] google_cloud_documentai_v1beta3_batch_process_request_object
161
+ # @param [String] fields
162
+ # Selector specifying which fields to include in a partial response.
163
+ # @param [String] quota_user
164
+ # Available to use for quota purposes for server-side applications. Can be any
165
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
166
+ # @param [Google::Apis::RequestOptions] options
167
+ # Request-specific options
168
+ #
169
+ # @yield [result, err] Result & error if block supplied
170
+ # @yieldparam result [Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation] parsed result object
171
+ # @yieldparam err [StandardError] error object if request failed
172
+ #
173
+ # @return [Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation]
174
+ #
175
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
176
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
177
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
178
+ def batch_project_location_processor_process(name, google_cloud_documentai_v1beta3_batch_process_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
179
+ command = make_simple_command(:post, 'v1beta3/{+name}:batchProcess', options)
180
+ command.request_representation = Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3BatchProcessRequest::Representation
181
+ command.request_object = google_cloud_documentai_v1beta3_batch_process_request_object
182
+ command.response_representation = Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation::Representation
183
+ command.response_class = Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation
184
+ command.params['name'] = name unless name.nil?
185
+ command.query['fields'] = fields unless fields.nil?
186
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
187
+ execute_or_queue_command(command, &block)
188
+ end
189
+
190
+ # Processes a single document.
191
+ # @param [String] name
192
+ # Required. The resource name of the Processor or ProcessorVersion to use for
193
+ # processing. If a Processor is specified, the server will use its default
194
+ # version. Format: projects/`project`/locations/`location`/processors/`processor`
195
+ # , or projects/`project`/locations/`location`/processors/`processor`/
196
+ # processorVerions/`processorVersion`
197
+ # @param [Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ProcessRequest] google_cloud_documentai_v1beta3_process_request_object
198
+ # @param [String] fields
199
+ # Selector specifying which fields to include in a partial response.
200
+ # @param [String] quota_user
201
+ # Available to use for quota purposes for server-side applications. Can be any
202
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
203
+ # @param [Google::Apis::RequestOptions] options
204
+ # Request-specific options
205
+ #
206
+ # @yield [result, err] Result & error if block supplied
207
+ # @yieldparam result [Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ProcessResponse] parsed result object
208
+ # @yieldparam err [StandardError] error object if request failed
209
+ #
210
+ # @return [Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ProcessResponse]
211
+ #
212
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
213
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
214
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
215
+ def process_project_location_processor(name, google_cloud_documentai_v1beta3_process_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
216
+ command = make_simple_command(:post, 'v1beta3/{+name}:process', options)
217
+ command.request_representation = Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ProcessRequest::Representation
218
+ command.request_object = google_cloud_documentai_v1beta3_process_request_object
219
+ command.response_representation = Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ProcessResponse::Representation
220
+ command.response_class = Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ProcessResponse
221
+ command.params['name'] = name unless name.nil?
222
+ command.query['fields'] = fields unless fields.nil?
223
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
224
+ execute_or_queue_command(command, &block)
225
+ end
226
+
227
+ # Send a document for Human Review. The input document should be processed by
228
+ # the specified processor.
229
+ # @param [String] human_review_config
230
+ # Required. The resource name of the HumanReviewConfig that the document will be
231
+ # reviewed with.
232
+ # @param [Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ReviewDocumentRequest] google_cloud_documentai_v1beta3_review_document_request_object
233
+ # @param [String] fields
234
+ # Selector specifying which fields to include in a partial response.
235
+ # @param [String] quota_user
236
+ # Available to use for quota purposes for server-side applications. Can be any
237
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
238
+ # @param [Google::Apis::RequestOptions] options
239
+ # Request-specific options
240
+ #
241
+ # @yield [result, err] Result & error if block supplied
242
+ # @yieldparam result [Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation] parsed result object
243
+ # @yieldparam err [StandardError] error object if request failed
244
+ #
245
+ # @return [Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation]
246
+ #
247
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
248
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
249
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
250
+ def review_project_location_processor_human_review_config_document(human_review_config, google_cloud_documentai_v1beta3_review_document_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
251
+ command = make_simple_command(:post, 'v1beta3/{+humanReviewConfig}:reviewDocument', options)
252
+ command.request_representation = Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ReviewDocumentRequest::Representation
253
+ command.request_object = google_cloud_documentai_v1beta3_review_document_request_object
254
+ command.response_representation = Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation::Representation
255
+ command.response_class = Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation
256
+ command.params['humanReviewConfig'] = human_review_config unless human_review_config.nil?
257
+ command.query['fields'] = fields unless fields.nil?
258
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
259
+ execute_or_queue_command(command, &block)
260
+ end
261
+
262
+ # LRO endpoint to batch process many documents. The output is written to Cloud
263
+ # Storage as JSON in the [Document] format.
264
+ # @param [String] name
265
+ # Required. The resource name of Processor or ProcessorVersion. Format: projects/
266
+ # `project`/locations/`location`/processors/`processor`, or projects/`project`/
267
+ # locations/`location`/processors/`processor`/processorVerions/`processorVersion`
268
+ # @param [Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3BatchProcessRequest] google_cloud_documentai_v1beta3_batch_process_request_object
269
+ # @param [String] fields
270
+ # Selector specifying which fields to include in a partial response.
271
+ # @param [String] quota_user
272
+ # Available to use for quota purposes for server-side applications. Can be any
273
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
274
+ # @param [Google::Apis::RequestOptions] options
275
+ # Request-specific options
276
+ #
277
+ # @yield [result, err] Result & error if block supplied
278
+ # @yieldparam result [Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation] parsed result object
279
+ # @yieldparam err [StandardError] error object if request failed
280
+ #
281
+ # @return [Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation]
282
+ #
283
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
284
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
285
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
286
+ def batch_project_location_processor_processor_version_process(name, google_cloud_documentai_v1beta3_batch_process_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
287
+ command = make_simple_command(:post, 'v1beta3/{+name}:batchProcess', options)
288
+ command.request_representation = Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3BatchProcessRequest::Representation
289
+ command.request_object = google_cloud_documentai_v1beta3_batch_process_request_object
290
+ command.response_representation = Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation::Representation
291
+ command.response_class = Google::Apis::DocumentaiV1beta3::GoogleLongrunningOperation
292
+ command.params['name'] = name unless name.nil?
293
+ command.query['fields'] = fields unless fields.nil?
294
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
295
+ execute_or_queue_command(command, &block)
296
+ end
297
+
298
+ # Processes a single document.
299
+ # @param [String] name
300
+ # Required. The resource name of the Processor or ProcessorVersion to use for
301
+ # processing. If a Processor is specified, the server will use its default
302
+ # version. Format: projects/`project`/locations/`location`/processors/`processor`
303
+ # , or projects/`project`/locations/`location`/processors/`processor`/
304
+ # processorVerions/`processorVersion`
305
+ # @param [Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ProcessRequest] google_cloud_documentai_v1beta3_process_request_object
306
+ # @param [String] fields
307
+ # Selector specifying which fields to include in a partial response.
308
+ # @param [String] quota_user
309
+ # Available to use for quota purposes for server-side applications. Can be any
310
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
311
+ # @param [Google::Apis::RequestOptions] options
312
+ # Request-specific options
313
+ #
314
+ # @yield [result, err] Result & error if block supplied
315
+ # @yieldparam result [Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ProcessResponse] parsed result object
316
+ # @yieldparam err [StandardError] error object if request failed
317
+ #
318
+ # @return [Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ProcessResponse]
319
+ #
320
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
321
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
322
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
323
+ def process_project_location_processor_processor_version(name, google_cloud_documentai_v1beta3_process_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
324
+ command = make_simple_command(:post, 'v1beta3/{+name}:process', options)
325
+ command.request_representation = Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ProcessRequest::Representation
326
+ command.request_object = google_cloud_documentai_v1beta3_process_request_object
327
+ command.response_representation = Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ProcessResponse::Representation
328
+ command.response_class = Google::Apis::DocumentaiV1beta3::GoogleCloudDocumentaiV1beta3ProcessResponse
329
+ command.params['name'] = name unless name.nil?
330
+ command.query['fields'] = fields unless fields.nil?
331
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
332
+ execute_or_queue_command(command, &block)
333
+ end
334
+
335
+ protected
336
+
337
+ def apply_command_defaults(command)
338
+ command.query['key'] = key unless key.nil?
339
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
340
+ end
341
+ end
342
+ end
343
+ end
344
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: google-apis-documentai_v1beta3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Google LLC
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-01-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: google-apis-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ description: This is the simple REST client for Cloud Document AI API V1beta3. Simple
28
+ REST clients are Ruby client libraries that provide access to Google services via
29
+ their HTTP REST API endpoints. These libraries are generated and updated automatically
30
+ based on the discovery documents published by the service, and they handle most
31
+ concerns such as authentication, pagination, retry, timeouts, and logging. You can
32
+ use this client to access the Cloud Document AI API, but note that some services
33
+ may provide a separate modern client that is easier to use.
34
+ email: googleapis-packages@google.com
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - ".yardopts"
40
+ - CHANGELOG.md
41
+ - LICENSE.md
42
+ - OVERVIEW.md
43
+ - lib/google-apis-documentai_v1beta3.rb
44
+ - lib/google/apis/documentai_v1beta3.rb
45
+ - lib/google/apis/documentai_v1beta3/classes.rb
46
+ - lib/google/apis/documentai_v1beta3/gem_version.rb
47
+ - lib/google/apis/documentai_v1beta3/representations.rb
48
+ - lib/google/apis/documentai_v1beta3/service.rb
49
+ homepage: https://github.com/google/google-api-ruby-client
50
+ licenses:
51
+ - Apache-2.0
52
+ metadata:
53
+ bug_tracker_uri: https://github.com/googleapis/google-api-ruby-client/issues
54
+ changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-documentai_v1beta3/CHANGELOG.md
55
+ documentation_uri: https://googleapis.dev/ruby/google-apis-documentai_v1beta3/v0.1.0
56
+ source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-documentai_v1beta3
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '2.4'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.1.4
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Simple REST client for Cloud Document AI API V1beta3
76
+ test_files: []