google-cloud-automl-v1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +71 -0
- data/lib/google/cloud/automl/v1/annotation_payload_pb.rb +37 -0
- data/lib/google/cloud/automl/v1/annotation_spec_pb.rb +26 -0
- data/lib/google/cloud/automl/v1/automl/client.rb +1851 -0
- data/lib/google/cloud/automl/v1/automl/credentials.rb +51 -0
- data/lib/google/cloud/automl/v1/automl/operations.rb +564 -0
- data/lib/google/cloud/automl/v1/automl/paths.rb +130 -0
- data/lib/google/cloud/automl/v1/automl.rb +63 -0
- data/lib/google/cloud/automl/v1/classification_pb.rb +65 -0
- data/lib/google/cloud/automl/v1/data_items_pb.rb +87 -0
- data/lib/google/cloud/automl/v1/dataset_pb.rb +42 -0
- data/lib/google/cloud/automl/v1/detection_pb.rb +45 -0
- data/lib/google/cloud/automl/v1/geometry_pb.rb +28 -0
- data/lib/google/cloud/automl/v1/image_pb.rb +57 -0
- data/lib/google/cloud/automl/v1/io_pb.rb +65 -0
- data/lib/google/cloud/automl/v1/model_evaluation_pb.rb +41 -0
- data/lib/google/cloud/automl/v1/model_pb.rb +49 -0
- data/lib/google/cloud/automl/v1/operations_pb.rb +88 -0
- data/lib/google/cloud/automl/v1/prediction_service/client.rb +634 -0
- data/lib/google/cloud/automl/v1/prediction_service/credentials.rb +51 -0
- data/lib/google/cloud/automl/v1/prediction_service/operations.rb +564 -0
- data/lib/google/cloud/automl/v1/prediction_service/paths.rb +52 -0
- data/lib/google/cloud/automl/v1/prediction_service.rb +53 -0
- data/lib/google/cloud/automl/v1/prediction_service_pb.rb +50 -0
- data/lib/google/cloud/automl/v1/prediction_service_services_pb.rb +103 -0
- data/lib/google/cloud/automl/v1/service_pb.rb +139 -0
- data/lib/google/cloud/automl/v1/service_services_pb.rb +137 -0
- data/lib/google/cloud/automl/v1/text_extraction_pb.rb +39 -0
- data/lib/google/cloud/automl/v1/text_pb.rb +41 -0
- data/lib/google/cloud/automl/v1/text_segment_pb.rb +25 -0
- data/lib/google/cloud/automl/v1/text_sentiment_pb.rb +35 -0
- data/lib/google/cloud/automl/v1/translation_pb.rb +41 -0
- data/lib/google/cloud/automl/v1/version.rb +28 -0
- data/lib/google/cloud/automl/v1.rb +36 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/lib/google-cloud-automl-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/automl/v1/annotation_payload.rb +60 -0
- data/proto_docs/google/cloud/automl/v1/annotation_spec.rb +46 -0
- data/proto_docs/google/cloud/automl/v1/classification.rb +191 -0
- data/proto_docs/google/cloud/automl/v1/data_items.rb +197 -0
- data/proto_docs/google/cloud/automl/v1/dataset.rb +94 -0
- data/proto_docs/google/cloud/automl/v1/detection.rb +97 -0
- data/proto_docs/google/cloud/automl/v1/geometry.rb +53 -0
- data/proto_docs/google/cloud/automl/v1/image.rb +217 -0
- data/proto_docs/google/cloud/automl/v1/io.rb +1402 -0
- data/proto_docs/google/cloud/automl/v1/model.rb +109 -0
- data/proto_docs/google/cloud/automl/v1/model_evaluation.rb +94 -0
- data/proto_docs/google/cloud/automl/v1/operations.rb +180 -0
- data/proto_docs/google/cloud/automl/v1/prediction_service.rb +271 -0
- data/proto_docs/google/cloud/automl/v1/service.rb +322 -0
- data/proto_docs/google/cloud/automl/v1/text.rb +76 -0
- data/proto_docs/google/cloud/automl/v1/text_extraction.rb +73 -0
- data/proto_docs/google/cloud/automl/v1/text_segment.rb +44 -0
- data/proto_docs/google/cloud/automl/v1/text_sentiment.rb +82 -0
- data/proto_docs/google/cloud/automl/v1/translation.rb +79 -0
- data/proto_docs/google/longrunning/operations.rb +150 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/struct.rb +96 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- metadata +227 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module AutoML
|
23
|
+
module V1
|
24
|
+
# A contiguous part of a text (string), assuming it has an UTF-8 NFC encoding.
|
25
|
+
# @!attribute [rw] content
|
26
|
+
# @return [String]
|
27
|
+
# Output only. The content of the TextSegment.
|
28
|
+
# @!attribute [rw] start_offset
|
29
|
+
# @return [Integer]
|
30
|
+
# Required. Zero-based character index of the first character of the text
|
31
|
+
# segment (counting characters from the beginning of the text).
|
32
|
+
# @!attribute [rw] end_offset
|
33
|
+
# @return [Integer]
|
34
|
+
# Required. Zero-based character index of the first character past the end of
|
35
|
+
# the text segment (counting character from the beginning of the text).
|
36
|
+
# The character at the end_offset is NOT included in the text segment.
|
37
|
+
class TextSegment
|
38
|
+
include Google::Protobuf::MessageExts
|
39
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module AutoML
|
23
|
+
module V1
|
24
|
+
# Contains annotation details specific to text sentiment.
|
25
|
+
# @!attribute [rw] sentiment
|
26
|
+
# @return [Integer]
|
27
|
+
# Output only. The sentiment with the semantic, as given to the
|
28
|
+
# {Google::Cloud::AutoML::V1::AutoML::Client#import_data AutoMl.ImportData} when populating the dataset from which the model used
|
29
|
+
# for the prediction had been trained.
|
30
|
+
# The sentiment values are between 0 and
|
31
|
+
# Dataset.text_sentiment_dataset_metadata.sentiment_max (inclusive),
|
32
|
+
# with higher value meaning more positive sentiment. They are completely
|
33
|
+
# relative, i.e. 0 means least positive sentiment and sentiment_max means
|
34
|
+
# the most positive from the sentiments present in the train data. Therefore
|
35
|
+
# e.g. if train data had only negative sentiment, then sentiment_max, would
|
36
|
+
# be still negative (although least negative).
|
37
|
+
# The sentiment shouldn't be confused with "score" or "magnitude"
|
38
|
+
# from the previous Natural Language Sentiment Analysis API.
|
39
|
+
class TextSentimentAnnotation
|
40
|
+
include Google::Protobuf::MessageExts
|
41
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
42
|
+
end
|
43
|
+
|
44
|
+
# Model evaluation metrics for text sentiment problems.
|
45
|
+
# @!attribute [rw] precision
|
46
|
+
# @return [Float]
|
47
|
+
# Output only. Precision.
|
48
|
+
# @!attribute [rw] recall
|
49
|
+
# @return [Float]
|
50
|
+
# Output only. Recall.
|
51
|
+
# @!attribute [rw] f1_score
|
52
|
+
# @return [Float]
|
53
|
+
# Output only. The harmonic mean of recall and precision.
|
54
|
+
# @!attribute [rw] mean_absolute_error
|
55
|
+
# @return [Float]
|
56
|
+
# Output only. Mean absolute error. Only set for the overall model
|
57
|
+
# evaluation, not for evaluation of a single annotation spec.
|
58
|
+
# @!attribute [rw] mean_squared_error
|
59
|
+
# @return [Float]
|
60
|
+
# Output only. Mean squared error. Only set for the overall model
|
61
|
+
# evaluation, not for evaluation of a single annotation spec.
|
62
|
+
# @!attribute [rw] linear_kappa
|
63
|
+
# @return [Float]
|
64
|
+
# Output only. Linear weighted kappa. Only set for the overall model
|
65
|
+
# evaluation, not for evaluation of a single annotation spec.
|
66
|
+
# @!attribute [rw] quadratic_kappa
|
67
|
+
# @return [Float]
|
68
|
+
# Output only. Quadratic weighted kappa. Only set for the overall model
|
69
|
+
# evaluation, not for evaluation of a single annotation spec.
|
70
|
+
# @!attribute [rw] confusion_matrix
|
71
|
+
# @return [Google::Cloud::AutoML::V1::ClassificationEvaluationMetrics::ConfusionMatrix]
|
72
|
+
# Output only. Confusion matrix of the evaluation.
|
73
|
+
# Only set for the overall model evaluation, not for evaluation of a single
|
74
|
+
# annotation spec.
|
75
|
+
class TextSentimentEvaluationMetrics
|
76
|
+
include Google::Protobuf::MessageExts
|
77
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module AutoML
|
23
|
+
module V1
|
24
|
+
# Dataset metadata that is specific to translation.
|
25
|
+
# @!attribute [rw] source_language_code
|
26
|
+
# @return [String]
|
27
|
+
# Required. The BCP-47 language code of the source language.
|
28
|
+
# @!attribute [rw] target_language_code
|
29
|
+
# @return [String]
|
30
|
+
# Required. The BCP-47 language code of the target language.
|
31
|
+
class TranslationDatasetMetadata
|
32
|
+
include Google::Protobuf::MessageExts
|
33
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
34
|
+
end
|
35
|
+
|
36
|
+
# Evaluation metrics for the dataset.
|
37
|
+
# @!attribute [rw] bleu_score
|
38
|
+
# @return [Float]
|
39
|
+
# Output only. BLEU score.
|
40
|
+
# @!attribute [rw] base_bleu_score
|
41
|
+
# @return [Float]
|
42
|
+
# Output only. BLEU score for base model.
|
43
|
+
class TranslationEvaluationMetrics
|
44
|
+
include Google::Protobuf::MessageExts
|
45
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
46
|
+
end
|
47
|
+
|
48
|
+
# Model metadata that is specific to translation.
|
49
|
+
# @!attribute [rw] base_model
|
50
|
+
# @return [String]
|
51
|
+
# The resource name of the model to use as a baseline to train the custom
|
52
|
+
# model. If unset, we use the default base model provided by Google
|
53
|
+
# Translate. Format:
|
54
|
+
# `projects/{project_id}/locations/{location_id}/models/{model_id}`
|
55
|
+
# @!attribute [rw] source_language_code
|
56
|
+
# @return [String]
|
57
|
+
# Output only. Inferred from the dataset.
|
58
|
+
# The source language (The BCP-47 language code) that is used for training.
|
59
|
+
# @!attribute [rw] target_language_code
|
60
|
+
# @return [String]
|
61
|
+
# Output only. The target language (The BCP-47 language code) that is used
|
62
|
+
# for training.
|
63
|
+
class TranslationModelMetadata
|
64
|
+
include Google::Protobuf::MessageExts
|
65
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
66
|
+
end
|
67
|
+
|
68
|
+
# Annotation details specific to translation.
|
69
|
+
# @!attribute [rw] translated_content
|
70
|
+
# @return [Google::Cloud::AutoML::V1::TextSnippet]
|
71
|
+
# Output only . The translated content.
|
72
|
+
class TranslationAnnotation
|
73
|
+
include Google::Protobuf::MessageExts
|
74
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Longrunning
|
22
|
+
# This resource represents a long-running operation that is the result of a
|
23
|
+
# network API call.
|
24
|
+
# @!attribute [rw] name
|
25
|
+
# @return [String]
|
26
|
+
# The server-assigned name, which is only unique within the same service that
|
27
|
+
# originally returns it. If you use the default HTTP mapping, the
|
28
|
+
# `name` should have the format of `operations/some/unique/name`.
|
29
|
+
# @!attribute [rw] metadata
|
30
|
+
# @return [Google::Protobuf::Any]
|
31
|
+
# Service-specific metadata associated with the operation. It typically
|
32
|
+
# contains progress information and common metadata such as create time.
|
33
|
+
# Some services might not provide such metadata. Any method that returns a
|
34
|
+
# long-running operation should document the metadata type, if any.
|
35
|
+
# @!attribute [rw] done
|
36
|
+
# @return [Boolean]
|
37
|
+
# If the value is `false`, it means the operation is still in progress.
|
38
|
+
# If true, the operation is completed, and either `error` or `response` is
|
39
|
+
# available.
|
40
|
+
# @!attribute [rw] error
|
41
|
+
# @return [Google::Rpc::Status]
|
42
|
+
# The error result of the operation in case of failure or cancellation.
|
43
|
+
# @!attribute [rw] response
|
44
|
+
# @return [Google::Protobuf::Any]
|
45
|
+
# The normal response of the operation in case of success. If the original
|
46
|
+
# method returns no data on success, such as `Delete`, the response is
|
47
|
+
# `google.protobuf.Empty`. If the original method is standard
|
48
|
+
# `Get`/`Create`/`Update`, the response should be the resource. For other
|
49
|
+
# methods, the response should have the type `XxxResponse`, where `Xxx`
|
50
|
+
# is the original method name. For example, if the original method name
|
51
|
+
# is `TakeSnapshot()`, the inferred response type is
|
52
|
+
# `TakeSnapshotResponse`.
|
53
|
+
class Operation
|
54
|
+
include Google::Protobuf::MessageExts
|
55
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
56
|
+
end
|
57
|
+
|
58
|
+
# The request message for Operations.GetOperation.
|
59
|
+
# @!attribute [rw] name
|
60
|
+
# @return [String]
|
61
|
+
# The name of the operation resource.
|
62
|
+
class GetOperationRequest
|
63
|
+
include Google::Protobuf::MessageExts
|
64
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
65
|
+
end
|
66
|
+
|
67
|
+
# The request message for Operations.ListOperations.
|
68
|
+
# @!attribute [rw] name
|
69
|
+
# @return [String]
|
70
|
+
# The name of the operation collection.
|
71
|
+
# @!attribute [rw] filter
|
72
|
+
# @return [String]
|
73
|
+
# The standard list filter.
|
74
|
+
# @!attribute [rw] page_size
|
75
|
+
# @return [Integer]
|
76
|
+
# The standard list page size.
|
77
|
+
# @!attribute [rw] page_token
|
78
|
+
# @return [String]
|
79
|
+
# The standard list page token.
|
80
|
+
class ListOperationsRequest
|
81
|
+
include Google::Protobuf::MessageExts
|
82
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
83
|
+
end
|
84
|
+
|
85
|
+
# The response message for Operations.ListOperations.
|
86
|
+
# @!attribute [rw] operations
|
87
|
+
# @return [Array<Google::Longrunning::Operation>]
|
88
|
+
# A list of operations that matches the specified filter in the request.
|
89
|
+
# @!attribute [rw] next_page_token
|
90
|
+
# @return [String]
|
91
|
+
# The standard List next-page token.
|
92
|
+
class ListOperationsResponse
|
93
|
+
include Google::Protobuf::MessageExts
|
94
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
95
|
+
end
|
96
|
+
|
97
|
+
# The request message for Operations.CancelOperation.
|
98
|
+
# @!attribute [rw] name
|
99
|
+
# @return [String]
|
100
|
+
# The name of the operation resource to be cancelled.
|
101
|
+
class CancelOperationRequest
|
102
|
+
include Google::Protobuf::MessageExts
|
103
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
104
|
+
end
|
105
|
+
|
106
|
+
# The request message for Operations.DeleteOperation.
|
107
|
+
# @!attribute [rw] name
|
108
|
+
# @return [String]
|
109
|
+
# The name of the operation resource to be deleted.
|
110
|
+
class DeleteOperationRequest
|
111
|
+
include Google::Protobuf::MessageExts
|
112
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
113
|
+
end
|
114
|
+
|
115
|
+
# A message representing the message types used by a long-running operation.
|
116
|
+
#
|
117
|
+
# Example:
|
118
|
+
#
|
119
|
+
# rpc LongRunningRecognize(LongRunningRecognizeRequest)
|
120
|
+
# returns (google.longrunning.Operation) {
|
121
|
+
# option (google.longrunning.operation_info) = {
|
122
|
+
# response_type: "LongRunningRecognizeResponse"
|
123
|
+
# metadata_type: "LongRunningRecognizeMetadata"
|
124
|
+
# };
|
125
|
+
# }
|
126
|
+
# @!attribute [rw] response_type
|
127
|
+
# @return [String]
|
128
|
+
# Required. The message name of the primary return type for this
|
129
|
+
# long-running operation.
|
130
|
+
# This type will be used to deserialize the LRO's response.
|
131
|
+
#
|
132
|
+
# If the response is in a different package from the rpc, a fully-qualified
|
133
|
+
# message name must be used (e.g. `google.protobuf.Struct`).
|
134
|
+
#
|
135
|
+
# Note: Altering this value constitutes a breaking change.
|
136
|
+
# @!attribute [rw] metadata_type
|
137
|
+
# @return [String]
|
138
|
+
# Required. The message name of the metadata type for this long-running
|
139
|
+
# operation.
|
140
|
+
#
|
141
|
+
# If the response is in a different package from the rpc, a fully-qualified
|
142
|
+
# message name must be used (e.g. `google.protobuf.Struct`).
|
143
|
+
#
|
144
|
+
# Note: Altering this value constitutes a breaking change.
|
145
|
+
class OperationInfo
|
146
|
+
include Google::Protobuf::MessageExts
|
147
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Protobuf
|
22
|
+
# `Any` contains an arbitrary serialized protocol buffer message along with a
|
23
|
+
# URL that describes the type of the serialized message.
|
24
|
+
#
|
25
|
+
# Protobuf library provides support to pack/unpack Any values in the form
|
26
|
+
# of utility functions or additional generated methods of the Any type.
|
27
|
+
#
|
28
|
+
# Example 1: Pack and unpack a message in C++.
|
29
|
+
#
|
30
|
+
# Foo foo = ...;
|
31
|
+
# Any any;
|
32
|
+
# any.PackFrom(foo);
|
33
|
+
# ...
|
34
|
+
# if (any.UnpackTo(&foo)) {
|
35
|
+
# ...
|
36
|
+
# }
|
37
|
+
#
|
38
|
+
# Example 2: Pack and unpack a message in Java.
|
39
|
+
#
|
40
|
+
# Foo foo = ...;
|
41
|
+
# Any any = Any.pack(foo);
|
42
|
+
# ...
|
43
|
+
# if (any.is(Foo.class)) {
|
44
|
+
# foo = any.unpack(Foo.class);
|
45
|
+
# }
|
46
|
+
#
|
47
|
+
# Example 3: Pack and unpack a message in Python.
|
48
|
+
#
|
49
|
+
# foo = Foo(...)
|
50
|
+
# any = Any()
|
51
|
+
# any.Pack(foo)
|
52
|
+
# ...
|
53
|
+
# if any.Is(Foo.DESCRIPTOR):
|
54
|
+
# any.Unpack(foo)
|
55
|
+
# ...
|
56
|
+
#
|
57
|
+
# Example 4: Pack and unpack a message in Go
|
58
|
+
#
|
59
|
+
# foo := &pb.Foo{...}
|
60
|
+
# any, err := ptypes.MarshalAny(foo)
|
61
|
+
# ...
|
62
|
+
# foo := &pb.Foo{}
|
63
|
+
# if err := ptypes.UnmarshalAny(any, foo); err != nil {
|
64
|
+
# ...
|
65
|
+
# }
|
66
|
+
#
|
67
|
+
# The pack methods provided by protobuf library will by default use
|
68
|
+
# 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
69
|
+
# methods only use the fully qualified type name after the last '/'
|
70
|
+
# in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
71
|
+
# name "y.z".
|
72
|
+
#
|
73
|
+
#
|
74
|
+
# JSON
|
75
|
+
# ====
|
76
|
+
# The JSON representation of an `Any` value uses the regular
|
77
|
+
# representation of the deserialized, embedded message, with an
|
78
|
+
# additional field `@type` which contains the type URL. Example:
|
79
|
+
#
|
80
|
+
# package google.profile;
|
81
|
+
# message Person {
|
82
|
+
# string first_name = 1;
|
83
|
+
# string last_name = 2;
|
84
|
+
# }
|
85
|
+
#
|
86
|
+
# {
|
87
|
+
# "@type": "type.googleapis.com/google.profile.Person",
|
88
|
+
# "firstName": <string>,
|
89
|
+
# "lastName": <string>
|
90
|
+
# }
|
91
|
+
#
|
92
|
+
# If the embedded message type is well-known and has a custom JSON
|
93
|
+
# representation, that representation will be embedded adding a field
|
94
|
+
# `value` which holds the custom JSON in addition to the `@type`
|
95
|
+
# field. Example (for message [google.protobuf.Duration][]):
|
96
|
+
#
|
97
|
+
# {
|
98
|
+
# "@type": "type.googleapis.com/google.protobuf.Duration",
|
99
|
+
# "value": "1.212s"
|
100
|
+
# }
|
101
|
+
# @!attribute [rw] type_url
|
102
|
+
# @return [String]
|
103
|
+
# A URL/resource name that uniquely identifies the type of the serialized
|
104
|
+
# protocol buffer message. This string must contain at least
|
105
|
+
# one "/" character. The last segment of the URL's path must represent
|
106
|
+
# the fully qualified name of the type (as in
|
107
|
+
# `path/google.protobuf.Duration`). The name should be in a canonical form
|
108
|
+
# (e.g., leading "." is not accepted).
|
109
|
+
#
|
110
|
+
# In practice, teams usually precompile into the binary all types that they
|
111
|
+
# expect it to use in the context of Any. However, for URLs which use the
|
112
|
+
# scheme `http`, `https`, or no scheme, one can optionally set up a type
|
113
|
+
# server that maps type URLs to message definitions as follows:
|
114
|
+
#
|
115
|
+
# * If no scheme is provided, `https` is assumed.
|
116
|
+
# * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
117
|
+
# value in binary format, or produce an error.
|
118
|
+
# * Applications are allowed to cache lookup results based on the
|
119
|
+
# URL, or have them precompiled into a binary to avoid any
|
120
|
+
# lookup. Therefore, binary compatibility needs to be preserved
|
121
|
+
# on changes to types. (Use versioned type names to manage
|
122
|
+
# breaking changes.)
|
123
|
+
#
|
124
|
+
# Note: this functionality is not currently available in the official
|
125
|
+
# protobuf release, and it is not used for type URLs beginning with
|
126
|
+
# type.googleapis.com.
|
127
|
+
#
|
128
|
+
# Schemes other than `http`, `https` (or the empty scheme) might be
|
129
|
+
# used with implementation specific semantics.
|
130
|
+
# @!attribute [rw] value
|
131
|
+
# @return [String]
|
132
|
+
# Must be a valid serialized protocol buffer of the above specified type.
|
133
|
+
class Any
|
134
|
+
include Google::Protobuf::MessageExts
|
135
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|