google-cloud-video_intelligence 1.4.0 → 2.0.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.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +6 -28
- data/README.md +3 -3
- data/lib/google/cloud/video_intelligence.rb +1 -1
- data/lib/google/cloud/video_intelligence/v1.rb +1 -2
- data/lib/google/cloud/video_intelligence/v1/doc/google/cloud/videointelligence/v1/video_intelligence.rb +37 -34
- data/lib/google/cloud/video_intelligence/v1/video_intelligence_service_client.rb +14 -14
- data/lib/google/cloud/video_intelligence/v1/video_intelligence_service_client_config.json +7 -7
- data/lib/google/cloud/video_intelligence/version.rb +1 -1
- data/lib/google/cloud/videointelligence/v1/video_intelligence_pb.rb +5 -4
- metadata +9 -19
- data/lib/google/cloud/video_intelligence/v1beta1.rb +0 -149
- data/lib/google/cloud/video_intelligence/v1beta1/credentials.rb +0 -41
- data/lib/google/cloud/video_intelligence/v1beta1/doc/google/cloud/videointelligence/v1beta1/video_intelligence.rb +0 -322
- data/lib/google/cloud/video_intelligence/v1beta1/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/video_intelligence/v1beta1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/video_intelligence/v1beta1/doc/google/rpc/status.rb +0 -87
- data/lib/google/cloud/video_intelligence/v1beta1/video_intelligence_service_client.rb +0 -305
- data/lib/google/cloud/video_intelligence/v1beta1/video_intelligence_service_client_config.json +0 -31
- data/lib/google/cloud/videointelligence/v1beta1/video_intelligence_pb.rb +0 -141
- data/lib/google/cloud/videointelligence/v1beta1/video_intelligence_services_pb.rb +0 -50
@@ -1,51 +0,0 @@
|
|
1
|
-
# Copyright 2019 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
|
-
# https://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
|
-
|
16
|
-
module Google
|
17
|
-
module Longrunning
|
18
|
-
# This resource represents a long-running operation that is the result of a
|
19
|
-
# network API call.
|
20
|
-
# @!attribute [rw] name
|
21
|
-
# @return [String]
|
22
|
-
# The server-assigned name, which is only unique within the same service that
|
23
|
-
# originally returns it. If you use the default HTTP mapping, the
|
24
|
-
# `name` should have the format of `operations/some/unique/name`.
|
25
|
-
# @!attribute [rw] metadata
|
26
|
-
# @return [Google::Protobuf::Any]
|
27
|
-
# Service-specific metadata associated with the operation. It typically
|
28
|
-
# contains progress information and common metadata such as create time.
|
29
|
-
# Some services might not provide such metadata. Any method that returns a
|
30
|
-
# long-running operation should document the metadata type, if any.
|
31
|
-
# @!attribute [rw] done
|
32
|
-
# @return [true, false]
|
33
|
-
# If the value is `false`, it means the operation is still in progress.
|
34
|
-
# If `true`, the operation is completed, and either `error` or `response` is
|
35
|
-
# available.
|
36
|
-
# @!attribute [rw] error
|
37
|
-
# @return [Google::Rpc::Status]
|
38
|
-
# The error result of the operation in case of failure or cancellation.
|
39
|
-
# @!attribute [rw] response
|
40
|
-
# @return [Google::Protobuf::Any]
|
41
|
-
# The normal response of the operation in case of success. If the original
|
42
|
-
# method returns no data on success, such as `Delete`, the response is
|
43
|
-
# `google.protobuf.Empty`. If the original method is standard
|
44
|
-
# `Get`/`Create`/`Update`, the response should be the resource. For other
|
45
|
-
# methods, the response should have the type `XxxResponse`, where `Xxx`
|
46
|
-
# is the original method name. For example, if the original method name
|
47
|
-
# is `TakeSnapshot()`, the inferred response type is
|
48
|
-
# `TakeSnapshotResponse`.
|
49
|
-
class Operation; end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,131 +0,0 @@
|
|
1
|
-
# Copyright 2019 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
|
-
# https://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
|
-
|
16
|
-
module Google
|
17
|
-
module Protobuf
|
18
|
-
# `Any` contains an arbitrary serialized protocol buffer message along with a
|
19
|
-
# URL that describes the type of the serialized message.
|
20
|
-
#
|
21
|
-
# Protobuf library provides support to pack/unpack Any values in the form
|
22
|
-
# of utility functions or additional generated methods of the Any type.
|
23
|
-
#
|
24
|
-
# Example 1: Pack and unpack a message in C++.
|
25
|
-
#
|
26
|
-
# Foo foo = ...;
|
27
|
-
# Any any;
|
28
|
-
# any.PackFrom(foo);
|
29
|
-
# ...
|
30
|
-
# if (any.UnpackTo(&foo)) {
|
31
|
-
# ...
|
32
|
-
# }
|
33
|
-
#
|
34
|
-
# Example 2: Pack and unpack a message in Java.
|
35
|
-
#
|
36
|
-
# Foo foo = ...;
|
37
|
-
# Any any = Any.pack(foo);
|
38
|
-
# ...
|
39
|
-
# if (any.is(Foo.class)) {
|
40
|
-
# foo = any.unpack(Foo.class);
|
41
|
-
# }
|
42
|
-
#
|
43
|
-
# Example 3: Pack and unpack a message in Python.
|
44
|
-
#
|
45
|
-
# foo = Foo(...)
|
46
|
-
# any = Any()
|
47
|
-
# any.Pack(foo)
|
48
|
-
# ...
|
49
|
-
# if any.Is(Foo.DESCRIPTOR):
|
50
|
-
# any.Unpack(foo)
|
51
|
-
# ...
|
52
|
-
#
|
53
|
-
# Example 4: Pack and unpack a message in Go
|
54
|
-
#
|
55
|
-
# foo := &pb.Foo{...}
|
56
|
-
# any, err := ptypes.MarshalAny(foo)
|
57
|
-
# ...
|
58
|
-
# foo := &pb.Foo{}
|
59
|
-
# if err := ptypes.UnmarshalAny(any, foo); err != nil {
|
60
|
-
# ...
|
61
|
-
# }
|
62
|
-
#
|
63
|
-
# The pack methods provided by protobuf library will by default use
|
64
|
-
# 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
65
|
-
# methods only use the fully qualified type name after the last '/'
|
66
|
-
# in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
67
|
-
# name "y.z".
|
68
|
-
#
|
69
|
-
#
|
70
|
-
# = JSON
|
71
|
-
#
|
72
|
-
# The JSON representation of an `Any` value uses the regular
|
73
|
-
# representation of the deserialized, embedded message, with an
|
74
|
-
# additional field `@type` which contains the type URL. Example:
|
75
|
-
#
|
76
|
-
# package google.profile;
|
77
|
-
# message Person {
|
78
|
-
# string first_name = 1;
|
79
|
-
# string last_name = 2;
|
80
|
-
# }
|
81
|
-
#
|
82
|
-
# {
|
83
|
-
# "@type": "type.googleapis.com/google.profile.Person",
|
84
|
-
# "firstName": <string>,
|
85
|
-
# "lastName": <string>
|
86
|
-
# }
|
87
|
-
#
|
88
|
-
# If the embedded message type is well-known and has a custom JSON
|
89
|
-
# representation, that representation will be embedded adding a field
|
90
|
-
# `value` which holds the custom JSON in addition to the `@type`
|
91
|
-
# field. Example (for message {Google::Protobuf::Duration}):
|
92
|
-
#
|
93
|
-
# {
|
94
|
-
# "@type": "type.googleapis.com/google.protobuf.Duration",
|
95
|
-
# "value": "1.212s"
|
96
|
-
# }
|
97
|
-
# @!attribute [rw] type_url
|
98
|
-
# @return [String]
|
99
|
-
# A URL/resource name that uniquely identifies the type of the serialized
|
100
|
-
# protocol buffer message. This string must contain at least
|
101
|
-
# one "/" character. The last segment of the URL's path must represent
|
102
|
-
# the fully qualified name of the type (as in
|
103
|
-
# `path/google.protobuf.Duration`). The name should be in a canonical form
|
104
|
-
# (e.g., leading "." is not accepted).
|
105
|
-
#
|
106
|
-
# In practice, teams usually precompile into the binary all types that they
|
107
|
-
# expect it to use in the context of Any. However, for URLs which use the
|
108
|
-
# scheme `http`, `https`, or no scheme, one can optionally set up a type
|
109
|
-
# server that maps type URLs to message definitions as follows:
|
110
|
-
#
|
111
|
-
# * If no scheme is provided, `https` is assumed.
|
112
|
-
# * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
|
113
|
-
# value in binary format, or produce an error.
|
114
|
-
# * Applications are allowed to cache lookup results based on the
|
115
|
-
# URL, or have them precompiled into a binary to avoid any
|
116
|
-
# lookup. Therefore, binary compatibility needs to be preserved
|
117
|
-
# on changes to types. (Use versioned type names to manage
|
118
|
-
# breaking changes.)
|
119
|
-
#
|
120
|
-
# Note: this functionality is not currently available in the official
|
121
|
-
# protobuf release, and it is not used for type URLs beginning with
|
122
|
-
# type.googleapis.com.
|
123
|
-
#
|
124
|
-
# Schemes other than `http`, `https` (or the empty scheme) might be
|
125
|
-
# used with implementation specific semantics.
|
126
|
-
# @!attribute [rw] value
|
127
|
-
# @return [String]
|
128
|
-
# Must be a valid serialized protocol buffer of the above specified type.
|
129
|
-
class Any; end
|
130
|
-
end
|
131
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
# Copyright 2019 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
|
-
# https://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
|
-
|
16
|
-
module Google
|
17
|
-
module Rpc
|
18
|
-
# The `Status` type defines a logical error model that is suitable for
|
19
|
-
# different programming environments, including REST APIs and RPC APIs. It is
|
20
|
-
# used by [gRPC](https://github.com/grpc). The error model is designed to be:
|
21
|
-
#
|
22
|
-
# * Simple to use and understand for most users
|
23
|
-
# * Flexible enough to meet unexpected needs
|
24
|
-
#
|
25
|
-
# = Overview
|
26
|
-
#
|
27
|
-
# The `Status` message contains three pieces of data: error code, error
|
28
|
-
# message, and error details. The error code should be an enum value of
|
29
|
-
# {Google::Rpc::Code}, but it may accept additional error codes
|
30
|
-
# if needed. The error message should be a developer-facing English message
|
31
|
-
# that helps developers *understand* and *resolve* the error. If a localized
|
32
|
-
# user-facing error message is needed, put the localized message in the error
|
33
|
-
# details or localize it in the client. The optional error details may contain
|
34
|
-
# arbitrary information about the error. There is a predefined set of error
|
35
|
-
# detail types in the package `google.rpc` that can be used for common error
|
36
|
-
# conditions.
|
37
|
-
#
|
38
|
-
# = Language mapping
|
39
|
-
#
|
40
|
-
# The `Status` message is the logical representation of the error model, but it
|
41
|
-
# is not necessarily the actual wire format. When the `Status` message is
|
42
|
-
# exposed in different client libraries and different wire protocols, it can be
|
43
|
-
# mapped differently. For example, it will likely be mapped to some exceptions
|
44
|
-
# in Java, but more likely mapped to some error codes in C.
|
45
|
-
#
|
46
|
-
# = Other uses
|
47
|
-
#
|
48
|
-
# The error model and the `Status` message can be used in a variety of
|
49
|
-
# environments, either with or without APIs, to provide a
|
50
|
-
# consistent developer experience across different environments.
|
51
|
-
#
|
52
|
-
# Example uses of this error model include:
|
53
|
-
#
|
54
|
-
# * Partial errors. If a service needs to return partial errors to the client,
|
55
|
-
# it may embed the `Status` in the normal response to indicate the partial
|
56
|
-
# errors.
|
57
|
-
#
|
58
|
-
# * Workflow errors. A typical workflow has multiple steps. Each step may
|
59
|
-
# have a `Status` message for error reporting.
|
60
|
-
#
|
61
|
-
# * Batch operations. If a client uses batch request and batch response, the
|
62
|
-
# `Status` message should be used directly inside batch response, one for
|
63
|
-
# each error sub-response.
|
64
|
-
#
|
65
|
-
# * Asynchronous operations. If an API call embeds asynchronous operation
|
66
|
-
# results in its response, the status of those operations should be
|
67
|
-
# represented directly using the `Status` message.
|
68
|
-
#
|
69
|
-
# * Logging. If some API errors are stored in logs, the message `Status` could
|
70
|
-
# be used directly after any stripping needed for security/privacy reasons.
|
71
|
-
# @!attribute [rw] code
|
72
|
-
# @return [Integer]
|
73
|
-
# The status code, which should be an enum value of
|
74
|
-
# {Google::Rpc::Code}.
|
75
|
-
# @!attribute [rw] message
|
76
|
-
# @return [String]
|
77
|
-
# A developer-facing error message, which should be in English. Any
|
78
|
-
# user-facing error message should be localized and sent in the
|
79
|
-
# {Google::Rpc::Status#details} field, or localized
|
80
|
-
# by the client.
|
81
|
-
# @!attribute [rw] details
|
82
|
-
# @return [Array<Google::Protobuf::Any>]
|
83
|
-
# A list of messages that carry the error details. There is a common set of
|
84
|
-
# message types for APIs to use.
|
85
|
-
class Status; end
|
86
|
-
end
|
87
|
-
end
|
@@ -1,305 +0,0 @@
|
|
1
|
-
# Copyright 2019 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
|
-
# https://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/v1beta1/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
|
-
|
23
|
-
require "json"
|
24
|
-
require "pathname"
|
25
|
-
|
26
|
-
require "google/gax"
|
27
|
-
require "google/gax/operation"
|
28
|
-
require "google/longrunning/operations_client"
|
29
|
-
|
30
|
-
require "google/cloud/videointelligence/v1beta1/video_intelligence_pb"
|
31
|
-
require "google/cloud/video_intelligence/v1beta1/credentials"
|
32
|
-
require "google/cloud/video_intelligence/version"
|
33
|
-
|
34
|
-
module Google
|
35
|
-
module Cloud
|
36
|
-
module VideoIntelligence
|
37
|
-
module V1beta1
|
38
|
-
# Service that implements Google Cloud Video Intelligence API.
|
39
|
-
#
|
40
|
-
# @!attribute [r] video_intelligence_service_stub
|
41
|
-
# @return [Google::Cloud::VideoIntelligence::V1beta1::VideoIntelligenceService::Stub]
|
42
|
-
class VideoIntelligenceServiceClient
|
43
|
-
# @private
|
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
|
-
# The default set of gRPC interceptors.
|
53
|
-
GRPC_INTERCEPTORS = []
|
54
|
-
|
55
|
-
DEFAULT_TIMEOUT = 30
|
56
|
-
|
57
|
-
# The scopes needed to make gRPC calls to all of the methods defined in
|
58
|
-
# this service.
|
59
|
-
ALL_SCOPES = [
|
60
|
-
"https://www.googleapis.com/auth/cloud-platform"
|
61
|
-
].freeze
|
62
|
-
|
63
|
-
# @private
|
64
|
-
class OperationsClient < Google::Longrunning::OperationsClient
|
65
|
-
self::SERVICE_ADDRESS = VideoIntelligenceServiceClient::SERVICE_ADDRESS
|
66
|
-
self::GRPC_INTERCEPTORS = VideoIntelligenceServiceClient::GRPC_INTERCEPTORS
|
67
|
-
end
|
68
|
-
|
69
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
70
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
71
|
-
# be many types.
|
72
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
73
|
-
# authenticating requests made by this client.
|
74
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
75
|
-
# credentials for this client.
|
76
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
77
|
-
# credentials for this client.
|
78
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
79
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
80
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
81
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
82
|
-
# metadata for requests, generally, to give OAuth credentials.
|
83
|
-
# @param scopes [Array<String>]
|
84
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
85
|
-
# an updater_proc is supplied.
|
86
|
-
# @param client_config [Hash]
|
87
|
-
# A Hash for call options for each method. See
|
88
|
-
# Google::Gax#construct_settings for the structure of
|
89
|
-
# this data. Falls back to the default config if not specified
|
90
|
-
# or the specified config is missing data points.
|
91
|
-
# @param timeout [Numeric]
|
92
|
-
# The default timeout, in seconds, for calls made through this client.
|
93
|
-
# @param metadata [Hash]
|
94
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
95
|
-
# @param service_address [String]
|
96
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
97
|
-
# @param service_port [Integer]
|
98
|
-
# Override for the service port, or `nil` to leave as the default.
|
99
|
-
# @param exception_transformer [Proc]
|
100
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
101
|
-
# custom error handling.
|
102
|
-
def initialize \
|
103
|
-
credentials: nil,
|
104
|
-
scopes: ALL_SCOPES,
|
105
|
-
client_config: {},
|
106
|
-
timeout: DEFAULT_TIMEOUT,
|
107
|
-
metadata: nil,
|
108
|
-
service_address: nil,
|
109
|
-
service_port: nil,
|
110
|
-
exception_transformer: nil,
|
111
|
-
lib_name: nil,
|
112
|
-
lib_version: ""
|
113
|
-
# These require statements are intentionally placed here to initialize
|
114
|
-
# the gRPC module only when it's required.
|
115
|
-
# See https://github.com/googleapis/toolkit/issues/446
|
116
|
-
require "google/gax/grpc"
|
117
|
-
require "google/cloud/videointelligence/v1beta1/video_intelligence_services_pb"
|
118
|
-
|
119
|
-
credentials ||= Google::Cloud::VideoIntelligence::V1beta1::Credentials.default
|
120
|
-
|
121
|
-
@operations_client = OperationsClient.new(
|
122
|
-
credentials: credentials,
|
123
|
-
scopes: scopes,
|
124
|
-
client_config: client_config,
|
125
|
-
timeout: timeout,
|
126
|
-
lib_name: lib_name,
|
127
|
-
service_address: service_address,
|
128
|
-
service_port: service_port,
|
129
|
-
lib_version: lib_version,
|
130
|
-
metadata: metadata,
|
131
|
-
)
|
132
|
-
|
133
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
134
|
-
updater_proc = Google::Cloud::VideoIntelligence::V1beta1::Credentials.new(credentials).updater_proc
|
135
|
-
end
|
136
|
-
if credentials.is_a?(GRPC::Core::Channel)
|
137
|
-
channel = credentials
|
138
|
-
end
|
139
|
-
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
140
|
-
chan_creds = credentials
|
141
|
-
end
|
142
|
-
if credentials.is_a?(Proc)
|
143
|
-
updater_proc = credentials
|
144
|
-
end
|
145
|
-
if credentials.is_a?(Google::Auth::Credentials)
|
146
|
-
updater_proc = credentials.updater_proc
|
147
|
-
end
|
148
|
-
|
149
|
-
package_version = Google::Cloud::VideoIntelligence::VERSION
|
150
|
-
|
151
|
-
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
152
|
-
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
153
|
-
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
154
|
-
google_api_client << " grpc/#{GRPC::VERSION}"
|
155
|
-
google_api_client.freeze
|
156
|
-
|
157
|
-
headers = { :"x-goog-api-client" => google_api_client }
|
158
|
-
headers.merge!(metadata) unless metadata.nil?
|
159
|
-
client_config_file = Pathname.new(__dir__).join(
|
160
|
-
"video_intelligence_service_client_config.json"
|
161
|
-
)
|
162
|
-
defaults = client_config_file.open do |f|
|
163
|
-
Google::Gax.construct_settings(
|
164
|
-
"google.cloud.videointelligence.v1beta1.VideoIntelligenceService",
|
165
|
-
JSON.parse(f.read),
|
166
|
-
client_config,
|
167
|
-
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
168
|
-
timeout,
|
169
|
-
errors: Google::Gax::Grpc::API_ERRORS,
|
170
|
-
metadata: headers
|
171
|
-
)
|
172
|
-
end
|
173
|
-
|
174
|
-
# Allow overriding the service path/port in subclasses.
|
175
|
-
service_path = service_address || self.class::SERVICE_ADDRESS
|
176
|
-
port = service_port || self.class::DEFAULT_SERVICE_PORT
|
177
|
-
interceptors = self.class::GRPC_INTERCEPTORS
|
178
|
-
@video_intelligence_service_stub = Google::Gax::Grpc.create_stub(
|
179
|
-
service_path,
|
180
|
-
port,
|
181
|
-
chan_creds: chan_creds,
|
182
|
-
channel: channel,
|
183
|
-
updater_proc: updater_proc,
|
184
|
-
scopes: scopes,
|
185
|
-
interceptors: interceptors,
|
186
|
-
&Google::Cloud::VideoIntelligence::V1beta1::VideoIntelligenceService::Stub.method(:new)
|
187
|
-
)
|
188
|
-
|
189
|
-
@annotate_video = Google::Gax.create_api_call(
|
190
|
-
@video_intelligence_service_stub.method(:annotate_video),
|
191
|
-
defaults["annotate_video"],
|
192
|
-
exception_transformer: exception_transformer
|
193
|
-
)
|
194
|
-
end
|
195
|
-
|
196
|
-
# Service calls
|
197
|
-
|
198
|
-
# Performs asynchronous video annotation. Progress and results can be
|
199
|
-
# retrieved through the `google.longrunning.Operations` interface.
|
200
|
-
# `Operation.metadata` contains `AnnotateVideoProgress` (progress).
|
201
|
-
# `Operation.response` contains `AnnotateVideoResponse` (results).
|
202
|
-
#
|
203
|
-
# @param input_uri [String]
|
204
|
-
# Input video location. Currently, only
|
205
|
-
# [Google Cloud Storage](https://cloud.google.com/storage/) URIs are
|
206
|
-
# supported, which must be specified in the following format:
|
207
|
-
# `gs://bucket-id/object-id` (other URI formats return
|
208
|
-
# {Google::Rpc::Code::INVALID_ARGUMENT}). For
|
209
|
-
# more information, see [Request URIs](https://cloud.google.com/storage/docs/reference-uris). A video
|
210
|
-
# URI may include wildcards in `object-id`, and thus identify multiple
|
211
|
-
# videos. Supported wildcards: '*' to match 0 or more characters;
|
212
|
-
# '?' to match 1 character. If unset, the input video should be embedded
|
213
|
-
# in the request as `input_content`. If set, `input_content` should be unset.
|
214
|
-
# @param features [Array<Google::Cloud::VideoIntelligence::V1beta1::Feature>]
|
215
|
-
# Requested video annotation features.
|
216
|
-
# @param input_content [String]
|
217
|
-
# The video data bytes. Encoding: base64. If unset, the input video(s)
|
218
|
-
# should be specified via `input_uri`. If set, `input_uri` should be unset.
|
219
|
-
# @param video_context [Google::Cloud::VideoIntelligence::V1beta1::VideoContext | Hash]
|
220
|
-
# Additional video context and/or feature-specific parameters.
|
221
|
-
# A hash of the same form as `Google::Cloud::VideoIntelligence::V1beta1::VideoContext`
|
222
|
-
# can also be provided.
|
223
|
-
# @param output_uri [String]
|
224
|
-
# Optional location where the output (in JSON format) should be stored.
|
225
|
-
# Currently, only [Google Cloud Storage](https://cloud.google.com/storage/)
|
226
|
-
# URIs are supported, which must be specified in the following format:
|
227
|
-
# `gs://bucket-id/object-id` (other URI formats return
|
228
|
-
# {Google::Rpc::Code::INVALID_ARGUMENT}). For
|
229
|
-
# more information, see [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
|
230
|
-
# @param location_id [String]
|
231
|
-
# Optional cloud region where annotation should take place. Supported cloud
|
232
|
-
# regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region
|
233
|
-
# is specified, a region will be determined based on video file location.
|
234
|
-
# @param options [Google::Gax::CallOptions]
|
235
|
-
# Overrides the default settings for this call, e.g, timeout,
|
236
|
-
# retries, etc.
|
237
|
-
# @return [Google::Gax::Operation]
|
238
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
239
|
-
# @example
|
240
|
-
# require "google/cloud/video_intelligence"
|
241
|
-
#
|
242
|
-
# video_intelligence_client = Google::Cloud::VideoIntelligence.new(version: :v1beta1)
|
243
|
-
# input_uri = "gs://cloud-samples-data/video/cat.mp4"
|
244
|
-
# features_element = :LABEL_DETECTION
|
245
|
-
# features = [features_element]
|
246
|
-
#
|
247
|
-
# # Register a callback during the method call.
|
248
|
-
# operation = video_intelligence_client.annotate_video(input_uri, features) do |op|
|
249
|
-
# raise op.results.message if op.error?
|
250
|
-
# op_results = op.results
|
251
|
-
# # Process the results.
|
252
|
-
#
|
253
|
-
# metadata = op.metadata
|
254
|
-
# # Process the metadata.
|
255
|
-
# end
|
256
|
-
#
|
257
|
-
# # Or use the return value to register a callback.
|
258
|
-
# operation.on_done do |op|
|
259
|
-
# raise op.results.message if op.error?
|
260
|
-
# op_results = op.results
|
261
|
-
# # Process the results.
|
262
|
-
#
|
263
|
-
# metadata = op.metadata
|
264
|
-
# # Process the metadata.
|
265
|
-
# end
|
266
|
-
#
|
267
|
-
# # Manually reload the operation.
|
268
|
-
# operation.reload!
|
269
|
-
#
|
270
|
-
# # Or block until the operation completes, triggering callbacks on
|
271
|
-
# # completion.
|
272
|
-
# operation.wait_until_done!
|
273
|
-
|
274
|
-
def annotate_video \
|
275
|
-
input_uri,
|
276
|
-
features,
|
277
|
-
input_content: nil,
|
278
|
-
video_context: nil,
|
279
|
-
output_uri: nil,
|
280
|
-
location_id: nil,
|
281
|
-
options: nil
|
282
|
-
req = {
|
283
|
-
input_uri: input_uri,
|
284
|
-
features: features,
|
285
|
-
input_content: input_content,
|
286
|
-
video_context: video_context,
|
287
|
-
output_uri: output_uri,
|
288
|
-
location_id: location_id
|
289
|
-
}.delete_if { |_, v| v.nil? }
|
290
|
-
req = Google::Gax::to_proto(req, Google::Cloud::VideoIntelligence::V1beta1::AnnotateVideoRequest)
|
291
|
-
operation = Google::Gax::Operation.new(
|
292
|
-
@annotate_video.call(req, options),
|
293
|
-
@operations_client,
|
294
|
-
Google::Cloud::VideoIntelligence::V1beta1::AnnotateVideoResponse,
|
295
|
-
Google::Cloud::VideoIntelligence::V1beta1::AnnotateVideoProgress,
|
296
|
-
call_options: options
|
297
|
-
)
|
298
|
-
operation.on_done { |operation| yield(operation) } if block_given?
|
299
|
-
operation
|
300
|
-
end
|
301
|
-
end
|
302
|
-
end
|
303
|
-
end
|
304
|
-
end
|
305
|
-
end
|