google-cloud-video_intelligence 0.24.1 → 0.25.0

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.
@@ -0,0 +1,124 @@
1
+ # Copyright 2017, Google LLC All rights reserved.
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
+ module Google
16
+ module Protobuf
17
+ # +Any+ contains an arbitrary serialized protocol buffer message along with a
18
+ # URL that describes the type of the serialized message.
19
+ #
20
+ # Protobuf library provides support to pack/unpack Any values in the form
21
+ # of utility functions or additional generated methods of the Any type.
22
+ #
23
+ # Example 1: Pack and unpack a message in C++.
24
+ #
25
+ # Foo foo = ...;
26
+ # Any any;
27
+ # any.PackFrom(foo);
28
+ # ...
29
+ # if (any.UnpackTo(&foo)) {
30
+ # ...
31
+ # }
32
+ #
33
+ # Example 2: Pack and unpack a message in Java.
34
+ #
35
+ # Foo foo = ...;
36
+ # Any any = Any.pack(foo);
37
+ # ...
38
+ # if (any.is(Foo.class)) {
39
+ # foo = any.unpack(Foo.class);
40
+ # }
41
+ #
42
+ # Example 3: Pack and unpack a message in Python.
43
+ #
44
+ # foo = Foo(...)
45
+ # any = Any()
46
+ # any.Pack(foo)
47
+ # ...
48
+ # if any.Is(Foo.DESCRIPTOR):
49
+ # any.Unpack(foo)
50
+ # ...
51
+ #
52
+ # Example 4: Pack and unpack a message in Go
53
+ #
54
+ # foo := &pb.Foo{...}
55
+ # any, err := ptypes.MarshalAny(foo)
56
+ # ...
57
+ # foo := &pb.Foo{}
58
+ # if err := ptypes.UnmarshalAny(any, foo); err != nil {
59
+ # ...
60
+ # }
61
+ #
62
+ # The pack methods provided by protobuf library will by default use
63
+ # 'type.googleapis.com/full.type.name' as the type URL and the unpack
64
+ # methods only use the fully qualified type name after the last '/'
65
+ # in the type URL, for example "foo.bar.com/x/y.z" will yield type
66
+ # name "y.z".
67
+ #
68
+ #
69
+ # = JSON
70
+ #
71
+ # The JSON representation of an +Any+ value uses the regular
72
+ # representation of the deserialized, embedded message, with an
73
+ # additional field +@type+ which contains the type URL. Example:
74
+ #
75
+ # package google.profile;
76
+ # message Person {
77
+ # string first_name = 1;
78
+ # string last_name = 2;
79
+ # }
80
+ #
81
+ # {
82
+ # "@type": "type.googleapis.com/google.profile.Person",
83
+ # "firstName": <string>,
84
+ # "lastName": <string>
85
+ # }
86
+ #
87
+ # If the embedded message type is well-known and has a custom JSON
88
+ # representation, that representation will be embedded adding a field
89
+ # +value+ which holds the custom JSON in addition to the +@type+
90
+ # field. Example (for message {Google::Protobuf::Duration}):
91
+ #
92
+ # {
93
+ # "@type": "type.googleapis.com/google.protobuf.Duration",
94
+ # "value": "1.212s"
95
+ # }
96
+ # @!attribute [rw] type_url
97
+ # @return [String]
98
+ # A URL/resource name whose content describes the type of the
99
+ # serialized protocol buffer message.
100
+ #
101
+ # For URLs which use the scheme +http+, +https+, or no scheme, the
102
+ # following restrictions and interpretations apply:
103
+ #
104
+ # * If no scheme is provided, +https+ is assumed.
105
+ # * The last segment of the URL's path must represent the fully
106
+ # qualified name of the type (as in +path/google.protobuf.Duration+).
107
+ # The name should be in a canonical form (e.g., leading "." is
108
+ # not accepted).
109
+ # * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
110
+ # value in binary format, or produce an error.
111
+ # * Applications are allowed to cache lookup results based on the
112
+ # URL, or have them precompiled into a binary to avoid any
113
+ # lookup. Therefore, binary compatibility needs to be preserved
114
+ # on changes to types. (Use versioned type names to manage
115
+ # breaking changes.)
116
+ #
117
+ # Schemes other than +http+, +https+ (or the empty scheme) might be
118
+ # used with implementation specific semantics.
119
+ # @!attribute [rw] value
120
+ # @return [String]
121
+ # Must be a valid serialized protocol buffer of the above specified type.
122
+ class Any; end
123
+ end
124
+ end
@@ -0,0 +1,90 @@
1
+ # Copyright 2017, Google LLC All rights reserved.
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
+ module Google
16
+ module Protobuf
17
+ # A Duration represents a signed, fixed-length span of time represented
18
+ # as a count of seconds and fractions of seconds at nanosecond
19
+ # resolution. It is independent of any calendar and concepts like "day"
20
+ # or "month". It is related to Timestamp in that the difference between
21
+ # two Timestamp values is a Duration and it can be added or subtracted
22
+ # from a Timestamp. Range is approximately +-10,000 years.
23
+ #
24
+ # = Examples
25
+ #
26
+ # Example 1: Compute Duration from two Timestamps in pseudo code.
27
+ #
28
+ # Timestamp start = ...;
29
+ # Timestamp end = ...;
30
+ # Duration duration = ...;
31
+ #
32
+ # duration.seconds = end.seconds - start.seconds;
33
+ # duration.nanos = end.nanos - start.nanos;
34
+ #
35
+ # if (duration.seconds < 0 && duration.nanos > 0) {
36
+ # duration.seconds += 1;
37
+ # duration.nanos -= 1000000000;
38
+ # } else if (durations.seconds > 0 && duration.nanos < 0) {
39
+ # duration.seconds -= 1;
40
+ # duration.nanos += 1000000000;
41
+ # }
42
+ #
43
+ # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
44
+ #
45
+ # Timestamp start = ...;
46
+ # Duration duration = ...;
47
+ # Timestamp end = ...;
48
+ #
49
+ # end.seconds = start.seconds + duration.seconds;
50
+ # end.nanos = start.nanos + duration.nanos;
51
+ #
52
+ # if (end.nanos < 0) {
53
+ # end.seconds -= 1;
54
+ # end.nanos += 1000000000;
55
+ # } else if (end.nanos >= 1000000000) {
56
+ # end.seconds += 1;
57
+ # end.nanos -= 1000000000;
58
+ # }
59
+ #
60
+ # Example 3: Compute Duration from datetime.timedelta in Python.
61
+ #
62
+ # td = datetime.timedelta(days=3, minutes=10)
63
+ # duration = Duration()
64
+ # duration.FromTimedelta(td)
65
+ #
66
+ # = JSON Mapping
67
+ #
68
+ # In JSON format, the Duration type is encoded as a string rather than an
69
+ # object, where the string ends in the suffix "s" (indicating seconds) and
70
+ # is preceded by the number of seconds, with nanoseconds expressed as
71
+ # fractional seconds. For example, 3 seconds with 0 nanoseconds should be
72
+ # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
73
+ # be expressed in JSON format as "3.000000001s", and 3 seconds and 1
74
+ # microsecond should be expressed in JSON format as "3.000001s".
75
+ # @!attribute [rw] seconds
76
+ # @return [Integer]
77
+ # Signed seconds of the span of time. Must be from -315,576,000,000
78
+ # to +315,576,000,000 inclusive. Note: these bounds are computed from:
79
+ # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
80
+ # @!attribute [rw] nanos
81
+ # @return [Integer]
82
+ # Signed fractions of a second at nanosecond resolution of the span
83
+ # of time. Durations less than one second are represented with a 0
84
+ # +seconds+ field and a positive or negative +nanos+ field. For durations
85
+ # of one second or more, a non-zero value for the +nanos+ field must be
86
+ # of the same sign as the +seconds+ field. Must be from -999,999,999
87
+ # to +999,999,999 inclusive.
88
+ class Duration; end
89
+ end
90
+ end
@@ -0,0 +1,83 @@
1
+ # Copyright 2017, Google LLC All rights reserved.
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
+ module Google
16
+ module Rpc
17
+ # The +Status+ type defines a logical error model that is suitable for different
18
+ # programming environments, including REST APIs and RPC APIs. It is used by
19
+ # [gRPC](https://github.com/grpc). The error model is designed to be:
20
+ #
21
+ # * Simple to use and understand for most users
22
+ # * Flexible enough to meet unexpected needs
23
+ #
24
+ # = Overview
25
+ #
26
+ # The +Status+ message contains three pieces of data: error code, error message,
27
+ # and error details. The error code should be an enum value of
28
+ # {Google::Rpc::Code}, but it may accept additional error codes if needed. The
29
+ # error message should be a developer-facing English message that helps
30
+ # developers *understand* and *resolve* the error. If a localized user-facing
31
+ # error message is needed, put the localized message in the error details or
32
+ # localize it in the client. The optional error details may contain arbitrary
33
+ # information about the error. There is a predefined set of error detail types
34
+ # in the package +google.rpc+ that can be used for common error conditions.
35
+ #
36
+ # = Language mapping
37
+ #
38
+ # The +Status+ message is the logical representation of the error model, but it
39
+ # is not necessarily the actual wire format. When the +Status+ message is
40
+ # exposed in different client libraries and different wire protocols, it can be
41
+ # mapped differently. For example, it will likely be mapped to some exceptions
42
+ # in Java, but more likely mapped to some error codes in C.
43
+ #
44
+ # = Other uses
45
+ #
46
+ # The error model and the +Status+ message can be used in a variety of
47
+ # environments, either with or without APIs, to provide a
48
+ # consistent developer experience across different environments.
49
+ #
50
+ # Example uses of this error model include:
51
+ #
52
+ # * Partial errors. If a service needs to return partial errors to the client,
53
+ # it may embed the +Status+ in the normal response to indicate the partial
54
+ # errors.
55
+ #
56
+ # * Workflow errors. A typical workflow has multiple steps. Each step may
57
+ # have a +Status+ message for error reporting.
58
+ #
59
+ # * Batch operations. If a client uses batch request and batch response, the
60
+ # +Status+ message should be used directly inside batch response, one for
61
+ # each error sub-response.
62
+ #
63
+ # * Asynchronous operations. If an API call embeds asynchronous operation
64
+ # results in its response, the status of those operations should be
65
+ # represented directly using the +Status+ message.
66
+ #
67
+ # * Logging. If some API errors are stored in logs, the message +Status+ could
68
+ # be used directly after any stripping needed for security/privacy reasons.
69
+ # @!attribute [rw] code
70
+ # @return [Integer]
71
+ # The status code, which should be an enum value of {Google::Rpc::Code}.
72
+ # @!attribute [rw] message
73
+ # @return [String]
74
+ # A developer-facing error message, which should be in English. Any
75
+ # user-facing error message should be localized and sent in the
76
+ # {Google::Rpc::Status#details} field, or localized by the client.
77
+ # @!attribute [rw] details
78
+ # @return [Array<Google::Protobuf::Any>]
79
+ # A list of messages that carry the error details. There is a common set of
80
+ # message types for APIs to use.
81
+ class Status; end
82
+ end
83
+ end
@@ -0,0 +1,53 @@
1
+ # Copyright 2017, Google LLC All rights reserved.
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
+ module Google
16
+ module Cloud
17
+ # rubocop:disable LineLength
18
+
19
+ ##
20
+ # # Ruby Client for Cloud Video Intelligence API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
21
+ #
22
+ # [Cloud Video Intelligence API][Product Documentation]:
23
+ # Cloud Video Intelligence API.
24
+ # - [Product Documentation][]
25
+ #
26
+ # ## Quick Start
27
+ # In order to use this library, you first need to go through the following
28
+ # steps:
29
+ #
30
+ # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
31
+ # 2. [Enable the Cloud Video Intelligence API.](https://console.cloud.google.com/apis/api/video-intelligence)
32
+ # 3. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
33
+ #
34
+ # ### Installation
35
+ # ```
36
+ # $ gem install google-cloud-video_intelligence
37
+ # ```
38
+ #
39
+ # ### Next Steps
40
+ # - Read the [Cloud Video Intelligence API Product documentation][Product Documentation]
41
+ # to learn more about the product and see How-to Guides.
42
+ # - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
43
+ # to see the full list of Cloud APIs that we cover.
44
+ #
45
+ # [Product Documentation]: https://cloud.google.com/video-intelligence
46
+ #
47
+ #
48
+ module VideoIntelligence
49
+ module V1
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,275 @@
1
+ # Copyright 2017, Google LLC All rights reserved.
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
+ # EDITING INSTRUCTIONS
16
+ # This file was generated from the file
17
+ # https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1/video_intelligence.proto,
18
+ # and updates to that file get reflected here through a refresh process.
19
+ # For the short term, the refresh process will only be runnable by Google
20
+ # engineers.
21
+ #
22
+ # The only allowed edits are to method and file documentation. A 3-way
23
+ # merge preserves those additions if the generated source changes.
24
+
25
+ require "json"
26
+ require "pathname"
27
+
28
+ require "google/gax"
29
+ require "google/gax/operation"
30
+ require "google/longrunning/operations_client"
31
+
32
+ require "google/cloud/videointelligence/v1/video_intelligence_pb"
33
+ require "google/cloud/video_intelligence/credentials"
34
+
35
+ module Google
36
+ module Cloud
37
+ module VideoIntelligence
38
+ module V1
39
+ # Service that implements Google Cloud Video Intelligence API.
40
+ #
41
+ # @!attribute [r] video_intelligence_service_stub
42
+ # @return [Google::Cloud::Videointelligence::V1::VideoIntelligenceService::Stub]
43
+ class VideoIntelligenceServiceClient
44
+ attr_reader :video_intelligence_service_stub
45
+
46
+ # The default address of the service.
47
+ SERVICE_ADDRESS = "videointelligence.googleapis.com".freeze
48
+
49
+ # The default port of the service.
50
+ DEFAULT_SERVICE_PORT = 443
51
+
52
+ DEFAULT_TIMEOUT = 30
53
+
54
+ # The scopes needed to make gRPC calls to all of the methods defined in
55
+ # this service.
56
+ ALL_SCOPES = [
57
+ "https://www.googleapis.com/auth/cloud-platform"
58
+ ].freeze
59
+
60
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
61
+ # Provides the means for authenticating requests made by the client. This parameter can
62
+ # be many types.
63
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
64
+ # authenticating requests made by this client.
65
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
66
+ # credentials for this client.
67
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
68
+ # credentials for this client.
69
+ # A `GRPC::Core::Channel` will be used to make calls through.
70
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
71
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
72
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
73
+ # metadata for requests, generally, to give OAuth credentials.
74
+ # @param scopes [Array<String>]
75
+ # The OAuth scopes for this service. This parameter is ignored if
76
+ # an updater_proc is supplied.
77
+ # @param client_config [Hash]
78
+ # A Hash for call options for each method. See
79
+ # Google::Gax#construct_settings for the structure of
80
+ # this data. Falls back to the default config if not specified
81
+ # or the specified config is missing data points.
82
+ # @param timeout [Numeric]
83
+ # The default timeout, in seconds, for calls made through this client.
84
+ def initialize \
85
+ service_path: SERVICE_ADDRESS,
86
+ port: DEFAULT_SERVICE_PORT,
87
+ credentials: nil,
88
+ scopes: ALL_SCOPES,
89
+ client_config: {},
90
+ timeout: DEFAULT_TIMEOUT,
91
+ lib_name: nil,
92
+ lib_version: ""
93
+ # These require statements are intentionally placed here to initialize
94
+ # the gRPC module only when it's required.
95
+ # See https://github.com/googleapis/toolkit/issues/446
96
+ require "google/gax/grpc"
97
+ require "google/cloud/videointelligence/v1/video_intelligence_services_pb"
98
+
99
+ if service_path != SERVICE_ADDRESS || port != DEFAULT_SERVICE_PORT
100
+ warn "`service_path` and `port` parameters are deprecated and will be removed"
101
+ end
102
+
103
+ credentials ||= Google::Cloud::VideoIntelligence::Credentials.default
104
+
105
+ @operations_client = Google::Longrunning::OperationsClient.new(
106
+ service_path: service_path,
107
+ credentials: credentials,
108
+ scopes: scopes,
109
+ client_config: client_config,
110
+ timeout: timeout,
111
+ lib_name: lib_name,
112
+ lib_version: lib_version,
113
+ )
114
+
115
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
116
+ updater_proc = Google::Cloud::VideoIntelligence::Credentials.new(credentials).updater_proc
117
+ end
118
+ if credentials.is_a?(GRPC::Core::Channel)
119
+ channel = credentials
120
+ end
121
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
122
+ chan_creds = credentials
123
+ end
124
+ if credentials.is_a?(Proc)
125
+ updater_proc = credentials
126
+ end
127
+ if credentials.is_a?(Google::Auth::Credentials)
128
+ updater_proc = credentials.updater_proc
129
+ end
130
+
131
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
132
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
133
+ google_api_client << " gapic/0.1.0 gax/#{Google::Gax::VERSION}"
134
+ google_api_client << " grpc/#{GRPC::VERSION}"
135
+ google_api_client.freeze
136
+
137
+ headers = { :"x-goog-api-client" => google_api_client }
138
+ client_config_file = Pathname.new(__dir__).join(
139
+ "video_intelligence_service_client_config.json"
140
+ )
141
+ defaults = client_config_file.open do |f|
142
+ Google::Gax.construct_settings(
143
+ "google.cloud.videointelligence.v1.VideoIntelligenceService",
144
+ JSON.parse(f.read),
145
+ client_config,
146
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
147
+ timeout,
148
+ errors: Google::Gax::Grpc::API_ERRORS,
149
+ kwargs: headers
150
+ )
151
+ end
152
+ @video_intelligence_service_stub = Google::Gax::Grpc.create_stub(
153
+ service_path,
154
+ port,
155
+ chan_creds: chan_creds,
156
+ channel: channel,
157
+ updater_proc: updater_proc,
158
+ scopes: scopes,
159
+ &Google::Cloud::Videointelligence::V1::VideoIntelligenceService::Stub.method(:new)
160
+ )
161
+
162
+ @annotate_video = Google::Gax.create_api_call(
163
+ @video_intelligence_service_stub.method(:annotate_video),
164
+ defaults["annotate_video"]
165
+ )
166
+ end
167
+
168
+ # Service calls
169
+
170
+ # Performs asynchronous video annotation. Progress and results can be
171
+ # retrieved through the +google.longrunning.Operations+ interface.
172
+ # +Operation.metadata+ contains +AnnotateVideoProgress+ (progress).
173
+ # +Operation.response+ contains +AnnotateVideoResponse+ (results).
174
+ #
175
+ # @param input_uri [String]
176
+ # Input video location. Currently, only
177
+ # [Google Cloud Storage](https://cloud.google.com/storage/) URIs are
178
+ # supported, which must be specified in the following format:
179
+ # +gs://bucket-id/object-id+ (other URI formats return
180
+ # {Google::Rpc::Code::INVALID_ARGUMENT}). For more information, see
181
+ # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
182
+ # A video URI may include wildcards in +object-id+, and thus identify
183
+ # multiple videos. Supported wildcards: '*' to match 0 or more characters;
184
+ # '?' to match 1 character. If unset, the input video should be embedded
185
+ # in the request as +input_content+. If set, +input_content+ should be unset.
186
+ # @param input_content [String]
187
+ # The video data bytes.
188
+ # If unset, the input video(s) should be specified via +input_uri+.
189
+ # If set, +input_uri+ should be unset.
190
+ # @param features [Array<Google::Cloud::Videointelligence::V1::Feature>]
191
+ # Requested video annotation features.
192
+ # @param video_context [Google::Cloud::Videointelligence::V1::VideoContext | Hash]
193
+ # Additional video context and/or feature-specific parameters.
194
+ # A hash of the same form as `Google::Cloud::Videointelligence::V1::VideoContext`
195
+ # can also be provided.
196
+ # @param output_uri [String]
197
+ # Optional location where the output (in JSON format) should be stored.
198
+ # Currently, only [Google Cloud Storage](https://cloud.google.com/storage/)
199
+ # URIs are supported, which must be specified in the following format:
200
+ # +gs://bucket-id/object-id+ (other URI formats return
201
+ # {Google::Rpc::Code::INVALID_ARGUMENT}). For more information, see
202
+ # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
203
+ # @param location_id [String]
204
+ # Optional cloud region where annotation should take place. Supported cloud
205
+ # regions: +us-east1+, +us-west1+, +europe-west1+, +asia-east1+. If no region
206
+ # is specified, a region will be determined based on video file location.
207
+ # @param options [Google::Gax::CallOptions]
208
+ # Overrides the default settings for this call, e.g, timeout,
209
+ # retries, etc.
210
+ # @return [Google::Gax::Operation]
211
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
212
+ # @example
213
+ # require "google/cloud/video_intelligence/v1"
214
+ #
215
+ # video_intelligence_service_client = Google::Cloud::VideoIntelligence::V1.new
216
+ #
217
+ # # Register a callback during the method call.
218
+ # operation = video_intelligence_service_client.annotate_video do |op|
219
+ # raise op.results.message if op.error?
220
+ # op_results = op.results
221
+ # # Process the results.
222
+ #
223
+ # metadata = op.metadata
224
+ # # Process the metadata.
225
+ # end
226
+ #
227
+ # # Or use the return value to register a callback.
228
+ # operation.on_done do |op|
229
+ # raise op.results.message if op.error?
230
+ # op_results = op.results
231
+ # # Process the results.
232
+ #
233
+ # metadata = op.metadata
234
+ # # Process the metadata.
235
+ # end
236
+ #
237
+ # # Manually reload the operation.
238
+ # operation.reload!
239
+ #
240
+ # # Or block until the operation completes, triggering callbacks on
241
+ # # completion.
242
+ # operation.wait_until_done!
243
+
244
+ def annotate_video \
245
+ input_uri: nil,
246
+ input_content: nil,
247
+ features: nil,
248
+ video_context: nil,
249
+ output_uri: nil,
250
+ location_id: nil,
251
+ options: nil
252
+ req = {
253
+ input_uri: input_uri,
254
+ input_content: input_content,
255
+ features: features,
256
+ video_context: video_context,
257
+ output_uri: output_uri,
258
+ location_id: location_id
259
+ }.delete_if { |_, v| v.nil? }
260
+ req = Google::Gax::to_proto(req, Google::Cloud::Videointelligence::V1::AnnotateVideoRequest)
261
+ operation = Google::Gax::Operation.new(
262
+ @annotate_video.call(req, options),
263
+ @operations_client,
264
+ Google::Cloud::Videointelligence::V1::AnnotateVideoResponse,
265
+ Google::Cloud::Videointelligence::V1::AnnotateVideoProgress,
266
+ call_options: options
267
+ )
268
+ operation.on_done { |operation| yield(operation) } if block_given?
269
+ operation
270
+ end
271
+ end
272
+ end
273
+ end
274
+ end
275
+ end