google-cloud-video_intelligence 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google/cloud/video_intelligence/v1/doc/google/cloud/videointelligence/v1/video_intelligence.rb +149 -4
- data/lib/google/cloud/video_intelligence/v1/video_intelligence_service_client_config.json +1 -1
- data/lib/google/cloud/video_intelligence/v1p1beta1.rb +177 -0
- data/lib/google/cloud/video_intelligence/v1p1beta1/credentials.rb +41 -0
- data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/cloud/videointelligence/v1p1beta1/video_intelligence.rb +410 -0
- data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/longrunning/operations.rb +93 -0
- data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/protobuf/any.rb +130 -0
- data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/protobuf/duration.rb +91 -0
- data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/rpc/status.rb +84 -0
- data/lib/google/cloud/video_intelligence/v1p1beta1/video_intelligence_service_client.rb +296 -0
- data/lib/google/cloud/video_intelligence/v1p1beta1/video_intelligence_service_client_config.json +31 -0
- data/lib/google/cloud/video_intelligence/v1p2beta1.rb +177 -0
- data/lib/google/cloud/video_intelligence/v1p2beta1/credentials.rb +41 -0
- data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/cloud/videointelligence/v1p2beta1/video_intelligence.rb +442 -0
- data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/longrunning/operations.rb +93 -0
- data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/protobuf/any.rb +130 -0
- data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/protobuf/duration.rb +91 -0
- data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/rpc/status.rb +84 -0
- data/lib/google/cloud/video_intelligence/v1p2beta1/video_intelligence_service_client.rb +296 -0
- data/lib/google/cloud/video_intelligence/v1p2beta1/video_intelligence_service_client_config.json +31 -0
- data/lib/google/cloud/videointelligence/v1/video_intelligence_pb.rb +38 -0
- data/lib/google/cloud/videointelligence/v1p1beta1/video_intelligence_pb.rb +169 -0
- data/lib/google/cloud/videointelligence/v1p1beta1/video_intelligence_services_pb.rb +49 -0
- data/lib/google/cloud/videointelligence/v1p2beta1/video_intelligence_pb.rb +190 -0
- data/lib/google/cloud/videointelligence/v1p2beta1/video_intelligence_services_pb.rb +50 -0
- metadata +26 -4
@@ -0,0 +1,93 @@
|
|
1
|
+
# Copyright 2018 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
|
+
|
51
|
+
# The request message for {Google::Longrunning::Operations::GetOperation Operations::GetOperation}.
|
52
|
+
# @!attribute [rw] name
|
53
|
+
# @return [String]
|
54
|
+
# The name of the operation resource.
|
55
|
+
class GetOperationRequest; end
|
56
|
+
|
57
|
+
# The request message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
|
58
|
+
# @!attribute [rw] name
|
59
|
+
# @return [String]
|
60
|
+
# The name of the operation collection.
|
61
|
+
# @!attribute [rw] filter
|
62
|
+
# @return [String]
|
63
|
+
# The standard list filter.
|
64
|
+
# @!attribute [rw] page_size
|
65
|
+
# @return [Integer]
|
66
|
+
# The standard list page size.
|
67
|
+
# @!attribute [rw] page_token
|
68
|
+
# @return [String]
|
69
|
+
# The standard list page token.
|
70
|
+
class ListOperationsRequest; end
|
71
|
+
|
72
|
+
# The response message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
|
73
|
+
# @!attribute [rw] operations
|
74
|
+
# @return [Array<Google::Longrunning::Operation>]
|
75
|
+
# A list of operations that matches the specified filter in the request.
|
76
|
+
# @!attribute [rw] next_page_token
|
77
|
+
# @return [String]
|
78
|
+
# The standard List next-page token.
|
79
|
+
class ListOperationsResponse; end
|
80
|
+
|
81
|
+
# The request message for {Google::Longrunning::Operations::CancelOperation Operations::CancelOperation}.
|
82
|
+
# @!attribute [rw] name
|
83
|
+
# @return [String]
|
84
|
+
# The name of the operation resource to be cancelled.
|
85
|
+
class CancelOperationRequest; end
|
86
|
+
|
87
|
+
# The request message for {Google::Longrunning::Operations::DeleteOperation Operations::DeleteOperation}.
|
88
|
+
# @!attribute [rw] name
|
89
|
+
# @return [String]
|
90
|
+
# The name of the operation resource to be deleted.
|
91
|
+
class DeleteOperationRequest; end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# Copyright 2018 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. The last segment of the URL's path must represent
|
101
|
+
# the fully qualified name of the type (as in
|
102
|
+
# `path/google.protobuf.Duration`). The name should be in a canonical form
|
103
|
+
# (e.g., leading "." is not accepted).
|
104
|
+
#
|
105
|
+
# In practice, teams usually precompile into the binary all types that they
|
106
|
+
# expect it to use in the context of Any. However, for URLs which use the
|
107
|
+
# scheme `http`, `https`, or no scheme, one can optionally set up a type
|
108
|
+
# server that maps type URLs to message definitions as follows:
|
109
|
+
#
|
110
|
+
# * If no scheme is provided, `https` is assumed.
|
111
|
+
# * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
|
112
|
+
# value in binary format, or produce an error.
|
113
|
+
# * Applications are allowed to cache lookup results based on the
|
114
|
+
# URL, or have them precompiled into a binary to avoid any
|
115
|
+
# lookup. Therefore, binary compatibility needs to be preserved
|
116
|
+
# on changes to types. (Use versioned type names to manage
|
117
|
+
# breaking changes.)
|
118
|
+
#
|
119
|
+
# Note: this functionality is not currently available in the official
|
120
|
+
# protobuf release, and it is not used for type URLs beginning with
|
121
|
+
# type.googleapis.com.
|
122
|
+
#
|
123
|
+
# Schemes other than `http`, `https` (or the empty scheme) might be
|
124
|
+
# used with implementation specific semantics.
|
125
|
+
# @!attribute [rw] value
|
126
|
+
# @return [String]
|
127
|
+
# Must be a valid serialized protocol buffer of the above specified type.
|
128
|
+
class Any; end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# Copyright 2018 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
|
+
# A Duration represents a signed, fixed-length span of time represented
|
19
|
+
# as a count of seconds and fractions of seconds at nanosecond
|
20
|
+
# resolution. It is independent of any calendar and concepts like "day"
|
21
|
+
# or "month". It is related to Timestamp in that the difference between
|
22
|
+
# two Timestamp values is a Duration and it can be added or subtracted
|
23
|
+
# from a Timestamp. Range is approximately +-10,000 years.
|
24
|
+
#
|
25
|
+
# = Examples
|
26
|
+
#
|
27
|
+
# Example 1: Compute Duration from two Timestamps in pseudo code.
|
28
|
+
#
|
29
|
+
# Timestamp start = ...;
|
30
|
+
# Timestamp end = ...;
|
31
|
+
# Duration duration = ...;
|
32
|
+
#
|
33
|
+
# duration.seconds = end.seconds - start.seconds;
|
34
|
+
# duration.nanos = end.nanos - start.nanos;
|
35
|
+
#
|
36
|
+
# if (duration.seconds < 0 && duration.nanos > 0) {
|
37
|
+
# duration.seconds += 1;
|
38
|
+
# duration.nanos -= 1000000000;
|
39
|
+
# } else if (durations.seconds > 0 && duration.nanos < 0) {
|
40
|
+
# duration.seconds -= 1;
|
41
|
+
# duration.nanos += 1000000000;
|
42
|
+
# }
|
43
|
+
#
|
44
|
+
# Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
45
|
+
#
|
46
|
+
# Timestamp start = ...;
|
47
|
+
# Duration duration = ...;
|
48
|
+
# Timestamp end = ...;
|
49
|
+
#
|
50
|
+
# end.seconds = start.seconds + duration.seconds;
|
51
|
+
# end.nanos = start.nanos + duration.nanos;
|
52
|
+
#
|
53
|
+
# if (end.nanos < 0) {
|
54
|
+
# end.seconds -= 1;
|
55
|
+
# end.nanos += 1000000000;
|
56
|
+
# } else if (end.nanos >= 1000000000) {
|
57
|
+
# end.seconds += 1;
|
58
|
+
# end.nanos -= 1000000000;
|
59
|
+
# }
|
60
|
+
#
|
61
|
+
# Example 3: Compute Duration from datetime.timedelta in Python.
|
62
|
+
#
|
63
|
+
# td = datetime.timedelta(days=3, minutes=10)
|
64
|
+
# duration = Duration()
|
65
|
+
# duration.FromTimedelta(td)
|
66
|
+
#
|
67
|
+
# = JSON Mapping
|
68
|
+
#
|
69
|
+
# In JSON format, the Duration type is encoded as a string rather than an
|
70
|
+
# object, where the string ends in the suffix "s" (indicating seconds) and
|
71
|
+
# is preceded by the number of seconds, with nanoseconds expressed as
|
72
|
+
# fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
73
|
+
# encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
74
|
+
# be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
75
|
+
# microsecond should be expressed in JSON format as "3.000001s".
|
76
|
+
# @!attribute [rw] seconds
|
77
|
+
# @return [Integer]
|
78
|
+
# Signed seconds of the span of time. Must be from -315,576,000,000
|
79
|
+
# to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
80
|
+
# 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
81
|
+
# @!attribute [rw] nanos
|
82
|
+
# @return [Integer]
|
83
|
+
# Signed fractions of a second at nanosecond resolution of the span
|
84
|
+
# of time. Durations less than one second are represented with a 0
|
85
|
+
# `seconds` field and a positive or negative `nanos` field. For durations
|
86
|
+
# of one second or more, a non-zero value for the `nanos` field must be
|
87
|
+
# of the same sign as the `seconds` field. Must be from -999,999,999
|
88
|
+
# to +999,999,999 inclusive.
|
89
|
+
class Duration; end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Copyright 2018 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 different
|
19
|
+
# programming environments, including REST APIs and RPC APIs. It is used by
|
20
|
+
# [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 message,
|
28
|
+
# and error details. The error code should be an enum value of
|
29
|
+
# {Google::Rpc::Code}, but it may accept additional error codes if needed. The
|
30
|
+
# error message should be a developer-facing English message that helps
|
31
|
+
# developers *understand* and *resolve* the error. If a localized user-facing
|
32
|
+
# error message is needed, put the localized message in the error details or
|
33
|
+
# localize it in the client. The optional error details may contain arbitrary
|
34
|
+
# information about the error. There is a predefined set of error detail types
|
35
|
+
# in the package `google.rpc` that can be used for common error conditions.
|
36
|
+
#
|
37
|
+
# = Language mapping
|
38
|
+
#
|
39
|
+
# The `Status` message is the logical representation of the error model, but it
|
40
|
+
# is not necessarily the actual wire format. When the `Status` message is
|
41
|
+
# exposed in different client libraries and different wire protocols, it can be
|
42
|
+
# mapped differently. For example, it will likely be mapped to some exceptions
|
43
|
+
# in Java, but more likely mapped to some error codes in C.
|
44
|
+
#
|
45
|
+
# = Other uses
|
46
|
+
#
|
47
|
+
# The error model and the `Status` message can be used in a variety of
|
48
|
+
# environments, either with or without APIs, to provide a
|
49
|
+
# consistent developer experience across different environments.
|
50
|
+
#
|
51
|
+
# Example uses of this error model include:
|
52
|
+
#
|
53
|
+
# * Partial errors. If a service needs to return partial errors to the client,
|
54
|
+
# it may embed the `Status` in the normal response to indicate the partial
|
55
|
+
# errors.
|
56
|
+
#
|
57
|
+
# * Workflow errors. A typical workflow has multiple steps. Each step may
|
58
|
+
# have a `Status` message for error reporting.
|
59
|
+
#
|
60
|
+
# * Batch operations. If a client uses batch request and batch response, the
|
61
|
+
# `Status` message should be used directly inside batch response, one for
|
62
|
+
# each error sub-response.
|
63
|
+
#
|
64
|
+
# * Asynchronous operations. If an API call embeds asynchronous operation
|
65
|
+
# results in its response, the status of those operations should be
|
66
|
+
# represented directly using the `Status` message.
|
67
|
+
#
|
68
|
+
# * Logging. If some API errors are stored in logs, the message `Status` could
|
69
|
+
# be used directly after any stripping needed for security/privacy reasons.
|
70
|
+
# @!attribute [rw] code
|
71
|
+
# @return [Integer]
|
72
|
+
# The status code, which should be an enum value of {Google::Rpc::Code}.
|
73
|
+
# @!attribute [rw] message
|
74
|
+
# @return [String]
|
75
|
+
# A developer-facing error message, which should be in English. Any
|
76
|
+
# user-facing error message should be localized and sent in the
|
77
|
+
# {Google::Rpc::Status#details} field, or localized by the client.
|
78
|
+
# @!attribute [rw] details
|
79
|
+
# @return [Array<Google::Protobuf::Any>]
|
80
|
+
# A list of messages that carry the error details. There is a common set of
|
81
|
+
# message types for APIs to use.
|
82
|
+
class Status; end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,296 @@
|
|
1
|
+
# Copyright 2018 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/v1p1beta1/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/v1p1beta1/video_intelligence_pb"
|
31
|
+
require "google/cloud/video_intelligence/v1p1beta1/credentials"
|
32
|
+
|
33
|
+
module Google
|
34
|
+
module Cloud
|
35
|
+
module VideoIntelligence
|
36
|
+
module V1p1beta1
|
37
|
+
# Service that implements Google Cloud Video Intelligence API.
|
38
|
+
#
|
39
|
+
# @!attribute [r] video_intelligence_service_stub
|
40
|
+
# @return [Google::Cloud::Videointelligence::V1p1beta1::VideoIntelligenceService::Stub]
|
41
|
+
class VideoIntelligenceServiceClient
|
42
|
+
# @private
|
43
|
+
attr_reader :video_intelligence_service_stub
|
44
|
+
|
45
|
+
# The default address of the service.
|
46
|
+
SERVICE_ADDRESS = "videointelligence.googleapis.com".freeze
|
47
|
+
|
48
|
+
# The default port of the service.
|
49
|
+
DEFAULT_SERVICE_PORT = 443
|
50
|
+
|
51
|
+
# The default set of gRPC interceptors.
|
52
|
+
GRPC_INTERCEPTORS = []
|
53
|
+
|
54
|
+
DEFAULT_TIMEOUT = 30
|
55
|
+
|
56
|
+
# The scopes needed to make gRPC calls to all of the methods defined in
|
57
|
+
# this service.
|
58
|
+
ALL_SCOPES = [
|
59
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
60
|
+
].freeze
|
61
|
+
|
62
|
+
# @private
|
63
|
+
class OperationsClient < Google::Longrunning::OperationsClient
|
64
|
+
self::SERVICE_ADDRESS = VideoIntelligenceServiceClient::SERVICE_ADDRESS
|
65
|
+
self::GRPC_INTERCEPTORS = VideoIntelligenceServiceClient::GRPC_INTERCEPTORS
|
66
|
+
end
|
67
|
+
|
68
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
69
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
70
|
+
# be many types.
|
71
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
72
|
+
# authenticating requests made by this client.
|
73
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
74
|
+
# credentials for this client.
|
75
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
76
|
+
# credentials for this client.
|
77
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
78
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
79
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
80
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
81
|
+
# metadata for requests, generally, to give OAuth credentials.
|
82
|
+
# @param scopes [Array<String>]
|
83
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
84
|
+
# an updater_proc is supplied.
|
85
|
+
# @param client_config [Hash]
|
86
|
+
# A Hash for call options for each method. See
|
87
|
+
# Google::Gax#construct_settings for the structure of
|
88
|
+
# this data. Falls back to the default config if not specified
|
89
|
+
# or the specified config is missing data points.
|
90
|
+
# @param timeout [Numeric]
|
91
|
+
# The default timeout, in seconds, for calls made through this client.
|
92
|
+
# @param metadata [Hash]
|
93
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
94
|
+
# @param exception_transformer [Proc]
|
95
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
96
|
+
# custom error handling.
|
97
|
+
def initialize \
|
98
|
+
credentials: nil,
|
99
|
+
scopes: ALL_SCOPES,
|
100
|
+
client_config: {},
|
101
|
+
timeout: DEFAULT_TIMEOUT,
|
102
|
+
metadata: nil,
|
103
|
+
exception_transformer: nil,
|
104
|
+
lib_name: nil,
|
105
|
+
lib_version: ""
|
106
|
+
# These require statements are intentionally placed here to initialize
|
107
|
+
# the gRPC module only when it's required.
|
108
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
109
|
+
require "google/gax/grpc"
|
110
|
+
require "google/cloud/videointelligence/v1p1beta1/video_intelligence_services_pb"
|
111
|
+
|
112
|
+
credentials ||= Google::Cloud::VideoIntelligence::V1p1beta1::Credentials.default
|
113
|
+
|
114
|
+
@operations_client = OperationsClient.new(
|
115
|
+
credentials: credentials,
|
116
|
+
scopes: scopes,
|
117
|
+
client_config: client_config,
|
118
|
+
timeout: timeout,
|
119
|
+
lib_name: lib_name,
|
120
|
+
lib_version: lib_version,
|
121
|
+
)
|
122
|
+
|
123
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
124
|
+
updater_proc = Google::Cloud::VideoIntelligence::V1p1beta1::Credentials.new(credentials).updater_proc
|
125
|
+
end
|
126
|
+
if credentials.is_a?(GRPC::Core::Channel)
|
127
|
+
channel = credentials
|
128
|
+
end
|
129
|
+
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
130
|
+
chan_creds = credentials
|
131
|
+
end
|
132
|
+
if credentials.is_a?(Proc)
|
133
|
+
updater_proc = credentials
|
134
|
+
end
|
135
|
+
if credentials.is_a?(Google::Auth::Credentials)
|
136
|
+
updater_proc = credentials.updater_proc
|
137
|
+
end
|
138
|
+
|
139
|
+
package_version = Gem.loaded_specs['google-cloud-video_intelligence'].version.version
|
140
|
+
|
141
|
+
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
142
|
+
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
143
|
+
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
144
|
+
google_api_client << " grpc/#{GRPC::VERSION}"
|
145
|
+
google_api_client.freeze
|
146
|
+
|
147
|
+
headers = { :"x-goog-api-client" => google_api_client }
|
148
|
+
headers.merge!(metadata) unless metadata.nil?
|
149
|
+
client_config_file = Pathname.new(__dir__).join(
|
150
|
+
"video_intelligence_service_client_config.json"
|
151
|
+
)
|
152
|
+
defaults = client_config_file.open do |f|
|
153
|
+
Google::Gax.construct_settings(
|
154
|
+
"google.cloud.videointelligence.v1p1beta1.VideoIntelligenceService",
|
155
|
+
JSON.parse(f.read),
|
156
|
+
client_config,
|
157
|
+
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
158
|
+
timeout,
|
159
|
+
errors: Google::Gax::Grpc::API_ERRORS,
|
160
|
+
metadata: headers
|
161
|
+
)
|
162
|
+
end
|
163
|
+
|
164
|
+
# Allow overriding the service path/port in subclasses.
|
165
|
+
service_path = self.class::SERVICE_ADDRESS
|
166
|
+
port = self.class::DEFAULT_SERVICE_PORT
|
167
|
+
interceptors = self.class::GRPC_INTERCEPTORS
|
168
|
+
@video_intelligence_service_stub = Google::Gax::Grpc.create_stub(
|
169
|
+
service_path,
|
170
|
+
port,
|
171
|
+
chan_creds: chan_creds,
|
172
|
+
channel: channel,
|
173
|
+
updater_proc: updater_proc,
|
174
|
+
scopes: scopes,
|
175
|
+
interceptors: interceptors,
|
176
|
+
&Google::Cloud::Videointelligence::V1p1beta1::VideoIntelligenceService::Stub.method(:new)
|
177
|
+
)
|
178
|
+
|
179
|
+
@annotate_video = Google::Gax.create_api_call(
|
180
|
+
@video_intelligence_service_stub.method(:annotate_video),
|
181
|
+
defaults["annotate_video"],
|
182
|
+
exception_transformer: exception_transformer
|
183
|
+
)
|
184
|
+
end
|
185
|
+
|
186
|
+
# Service calls
|
187
|
+
|
188
|
+
# Performs asynchronous video annotation. Progress and results can be
|
189
|
+
# retrieved through the `google.longrunning.Operations` interface.
|
190
|
+
# `Operation.metadata` contains `AnnotateVideoProgress` (progress).
|
191
|
+
# `Operation.response` contains `AnnotateVideoResponse` (results).
|
192
|
+
#
|
193
|
+
# @param input_uri [String]
|
194
|
+
# Input video location. Currently, only
|
195
|
+
# [Google Cloud Storage](https://cloud.google.com/storage/) URIs are
|
196
|
+
# supported, which must be specified in the following format:
|
197
|
+
# `gs://bucket-id/object-id` (other URI formats return
|
198
|
+
# {Google::Rpc::Code::INVALID_ARGUMENT}). For more information, see
|
199
|
+
# [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
|
200
|
+
# A video URI may include wildcards in `object-id`, and thus identify
|
201
|
+
# multiple videos. Supported wildcards: '*' to match 0 or more characters;
|
202
|
+
# '?' to match 1 character. If unset, the input video should be embedded
|
203
|
+
# in the request as `input_content`. If set, `input_content` should be unset.
|
204
|
+
# @param input_content [String]
|
205
|
+
# The video data bytes.
|
206
|
+
# If unset, the input video(s) should be specified via `input_uri`.
|
207
|
+
# If set, `input_uri` should be unset.
|
208
|
+
# @param features [Array<Google::Cloud::Videointelligence::V1p1beta1::Feature>]
|
209
|
+
# Requested video annotation features.
|
210
|
+
# @param video_context [Google::Cloud::Videointelligence::V1p1beta1::VideoContext | Hash]
|
211
|
+
# Additional video context and/or feature-specific parameters.
|
212
|
+
# A hash of the same form as `Google::Cloud::Videointelligence::V1p1beta1::VideoContext`
|
213
|
+
# can also be provided.
|
214
|
+
# @param output_uri [String]
|
215
|
+
# Optional location where the output (in JSON format) should be stored.
|
216
|
+
# Currently, only [Google Cloud Storage](https://cloud.google.com/storage/)
|
217
|
+
# URIs are supported, which must be specified in the following format:
|
218
|
+
# `gs://bucket-id/object-id` (other URI formats return
|
219
|
+
# {Google::Rpc::Code::INVALID_ARGUMENT}). For more information, see
|
220
|
+
# [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
|
221
|
+
# @param location_id [String]
|
222
|
+
# Optional cloud region where annotation should take place. Supported cloud
|
223
|
+
# regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region
|
224
|
+
# is specified, a region will be determined based on video file location.
|
225
|
+
# @param options [Google::Gax::CallOptions]
|
226
|
+
# Overrides the default settings for this call, e.g, timeout,
|
227
|
+
# retries, etc.
|
228
|
+
# @return [Google::Gax::Operation]
|
229
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
230
|
+
# @example
|
231
|
+
# require "google/cloud/video_intelligence"
|
232
|
+
#
|
233
|
+
# video_intelligence_service_client = Google::Cloud::VideoIntelligence.new(version: :v1p1beta1)
|
234
|
+
# input_uri = "gs://demomaker/cat.mp4"
|
235
|
+
# features_element = :LABEL_DETECTION
|
236
|
+
# features = [features_element]
|
237
|
+
#
|
238
|
+
# # Register a callback during the method call.
|
239
|
+
# operation = video_intelligence_service_client.annotate_video(input_uri: input_uri, features: features) do |op|
|
240
|
+
# raise op.results.message if op.error?
|
241
|
+
# op_results = op.results
|
242
|
+
# # Process the results.
|
243
|
+
#
|
244
|
+
# metadata = op.metadata
|
245
|
+
# # Process the metadata.
|
246
|
+
# end
|
247
|
+
#
|
248
|
+
# # Or use the return value to register a callback.
|
249
|
+
# operation.on_done do |op|
|
250
|
+
# raise op.results.message if op.error?
|
251
|
+
# op_results = op.results
|
252
|
+
# # Process the results.
|
253
|
+
#
|
254
|
+
# metadata = op.metadata
|
255
|
+
# # Process the metadata.
|
256
|
+
# end
|
257
|
+
#
|
258
|
+
# # Manually reload the operation.
|
259
|
+
# operation.reload!
|
260
|
+
#
|
261
|
+
# # Or block until the operation completes, triggering callbacks on
|
262
|
+
# # completion.
|
263
|
+
# operation.wait_until_done!
|
264
|
+
|
265
|
+
def annotate_video \
|
266
|
+
input_uri: nil,
|
267
|
+
input_content: nil,
|
268
|
+
features: nil,
|
269
|
+
video_context: nil,
|
270
|
+
output_uri: nil,
|
271
|
+
location_id: nil,
|
272
|
+
options: nil
|
273
|
+
req = {
|
274
|
+
input_uri: input_uri,
|
275
|
+
input_content: input_content,
|
276
|
+
features: features,
|
277
|
+
video_context: video_context,
|
278
|
+
output_uri: output_uri,
|
279
|
+
location_id: location_id
|
280
|
+
}.delete_if { |_, v| v.nil? }
|
281
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Videointelligence::V1p1beta1::AnnotateVideoRequest)
|
282
|
+
operation = Google::Gax::Operation.new(
|
283
|
+
@annotate_video.call(req, options),
|
284
|
+
@operations_client,
|
285
|
+
Google::Cloud::Videointelligence::V1p1beta1::AnnotateVideoResponse,
|
286
|
+
Google::Cloud::Videointelligence::V1p1beta1::AnnotateVideoProgress,
|
287
|
+
call_options: options
|
288
|
+
)
|
289
|
+
operation.on_done { |operation| yield(operation) } if block_given?
|
290
|
+
operation
|
291
|
+
end
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|