google-cloud-vision 0.37.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +343 -0
  6. data/README.md +35 -49
  7. data/lib/{google/cloud/vision/v1/doc/google/protobuf/wrappers.rb → google-cloud-vision.rb} +5 -12
  8. data/lib/google/cloud/vision.rb +132 -215
  9. data/lib/google/cloud/vision/version.rb +6 -2
  10. metadata +74 -102
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/vision/v1.rb +0 -249
  13. data/lib/google/cloud/vision/v1/credentials.rb +0 -42
  14. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/geometry.rb +0 -66
  15. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +0 -923
  16. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search.rb +0 -115
  17. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search_service.rb +0 -569
  18. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb +0 -254
  19. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +0 -102
  20. data/lib/google/cloud/vision/v1/doc/google/longrunning/operations.rb +0 -51
  21. data/lib/google/cloud/vision/v1/doc/google/protobuf/any.rb +0 -131
  22. data/lib/google/cloud/vision/v1/doc/google/protobuf/empty.rb +0 -29
  23. data/lib/google/cloud/vision/v1/doc/google/protobuf/field_mask.rb +0 -222
  24. data/lib/google/cloud/vision/v1/doc/google/protobuf/timestamp.rb +0 -113
  25. data/lib/google/cloud/vision/v1/doc/google/rpc/status.rb +0 -87
  26. data/lib/google/cloud/vision/v1/doc/google/type/color.rb +0 -161
  27. data/lib/google/cloud/vision/v1/doc/google/type/latlng.rb +0 -31
  28. data/lib/google/cloud/vision/v1/geometry_pb.rb +0 -39
  29. data/lib/google/cloud/vision/v1/helpers.rb +0 -1154
  30. data/lib/google/cloud/vision/v1/image_annotator_client.rb +0 -516
  31. data/lib/google/cloud/vision/v1/image_annotator_client_config.json +0 -46
  32. data/lib/google/cloud/vision/v1/image_annotator_pb.rb +0 -344
  33. data/lib/google/cloud/vision/v1/image_annotator_services_pb.rb +0 -74
  34. data/lib/google/cloud/vision/v1/product_search_client.rb +0 -1490
  35. data/lib/google/cloud/vision/v1/product_search_client_config.json +0 -121
  36. data/lib/google/cloud/vision/v1/product_search_pb.rb +0 -54
  37. data/lib/google/cloud/vision/v1/product_search_service_pb.rb +0 -207
  38. data/lib/google/cloud/vision/v1/product_search_service_services_pb.rb +0 -233
  39. data/lib/google/cloud/vision/v1/text_annotation_pb.rb +0 -94
  40. data/lib/google/cloud/vision/v1/web_detection_pb.rb +0 -51
  41. data/lib/google/cloud/vision/v1p3beta1.rb +0 -253
  42. data/lib/google/cloud/vision/v1p3beta1/credentials.rb +0 -42
  43. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/geometry.rb +0 -72
  44. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/image_annotator.rb +0 -763
  45. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search.rb +0 -156
  46. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search_service.rb +0 -538
  47. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/text_annotation.rb +0 -255
  48. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/web_detection.rb +0 -101
  49. data/lib/google/cloud/vision/v1p3beta1/doc/google/longrunning/operations.rb +0 -51
  50. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/any.rb +0 -131
  51. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/empty.rb +0 -29
  52. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/field_mask.rb +0 -222
  53. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/timestamp.rb +0 -113
  54. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/wrappers.rb +0 -26
  55. data/lib/google/cloud/vision/v1p3beta1/doc/google/rpc/status.rb +0 -87
  56. data/lib/google/cloud/vision/v1p3beta1/doc/google/type/color.rb +0 -161
  57. data/lib/google/cloud/vision/v1p3beta1/doc/google/type/latlng.rb +0 -31
  58. data/lib/google/cloud/vision/v1p3beta1/geometry_pb.rb +0 -43
  59. data/lib/google/cloud/vision/v1p3beta1/helpers.rb +0 -1154
  60. data/lib/google/cloud/vision/v1p3beta1/image_annotator_client.rb +0 -312
  61. data/lib/google/cloud/vision/v1p3beta1/image_annotator_client_config.json +0 -36
  62. data/lib/google/cloud/vision/v1p3beta1/image_annotator_pb.rb +0 -304
  63. data/lib/google/cloud/vision/v1p3beta1/image_annotator_services_pb.rb +0 -55
  64. data/lib/google/cloud/vision/v1p3beta1/product_search_client.rb +0 -1419
  65. data/lib/google/cloud/vision/v1p3beta1/product_search_client_config.json +0 -116
  66. data/lib/google/cloud/vision/v1p3beta1/product_search_pb.rb +0 -64
  67. data/lib/google/cloud/vision/v1p3beta1/product_search_service_pb.rb +0 -191
  68. data/lib/google/cloud/vision/v1p3beta1/product_search_service_services_pb.rb +0 -226
  69. data/lib/google/cloud/vision/v1p3beta1/text_annotation_pb.rb +0 -94
  70. data/lib/google/cloud/vision/v1p3beta1/web_detection_pb.rb +0 -51
@@ -1,255 +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 Cloud
18
- module Vision
19
- module V1p3beta1
20
- # TextAnnotation contains a structured representation of OCR extracted text.
21
- # The hierarchy of an OCR extracted text structure is like this:
22
- # TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol
23
- # Each structural component, starting from Page, may further have their own
24
- # properties. Properties describe detected languages, breaks etc.. Please refer
25
- # to the
26
- # {Google::Cloud::Vision::V1p3beta1::TextAnnotation::TextProperty TextAnnotation::TextProperty}
27
- # message definition below for more detail.
28
- # @!attribute [rw] pages
29
- # @return [Array<Google::Cloud::Vision::V1p3beta1::Page>]
30
- # List of pages detected by OCR.
31
- # @!attribute [rw] text
32
- # @return [String]
33
- # UTF-8 text detected on the pages.
34
- class TextAnnotation
35
- # Detected language for a structural component.
36
- # @!attribute [rw] language_code
37
- # @return [String]
38
- # The BCP-47 language code, such as "en-US" or "sr-Latn". For more
39
- # information, see
40
- # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
41
- # @!attribute [rw] confidence
42
- # @return [Float]
43
- # Confidence of detected language. Range [0, 1].
44
- class DetectedLanguage; end
45
-
46
- # Detected start or end of a structural component.
47
- # @!attribute [rw] type
48
- # @return [Google::Cloud::Vision::V1p3beta1::TextAnnotation::DetectedBreak::BreakType]
49
- # Detected break type.
50
- # @!attribute [rw] is_prefix
51
- # @return [true, false]
52
- # True if break prepends the element.
53
- class DetectedBreak
54
- # Enum to denote the type of break found. New line, space etc.
55
- module BreakType
56
- # Unknown break label type.
57
- UNKNOWN = 0
58
-
59
- # Regular space.
60
- SPACE = 1
61
-
62
- # Sure space (very wide).
63
- SURE_SPACE = 2
64
-
65
- # Line-wrapping break.
66
- EOL_SURE_SPACE = 3
67
-
68
- # End-line hyphen that is not present in text; does not co-occur with
69
- # `SPACE`, `LEADER_SPACE`, or `LINE_BREAK`.
70
- HYPHEN = 4
71
-
72
- # Line break that ends a paragraph.
73
- LINE_BREAK = 5
74
- end
75
- end
76
-
77
- # Additional information detected on the structural component.
78
- # @!attribute [rw] detected_languages
79
- # @return [Array<Google::Cloud::Vision::V1p3beta1::TextAnnotation::DetectedLanguage>]
80
- # A list of detected languages together with confidence.
81
- # @!attribute [rw] detected_break
82
- # @return [Google::Cloud::Vision::V1p3beta1::TextAnnotation::DetectedBreak]
83
- # Detected start or end of a text segment.
84
- class TextProperty; end
85
- end
86
-
87
- # Detected page from OCR.
88
- # @!attribute [rw] property
89
- # @return [Google::Cloud::Vision::V1p3beta1::TextAnnotation::TextProperty]
90
- # Additional information detected on the page.
91
- # @!attribute [rw] width
92
- # @return [Integer]
93
- # Page width. For PDFs the unit is points. For images (including
94
- # TIFFs) the unit is pixels.
95
- # @!attribute [rw] height
96
- # @return [Integer]
97
- # Page height. For PDFs the unit is points. For images (including
98
- # TIFFs) the unit is pixels.
99
- # @!attribute [rw] blocks
100
- # @return [Array<Google::Cloud::Vision::V1p3beta1::Block>]
101
- # List of blocks of text, images etc on this page.
102
- # @!attribute [rw] confidence
103
- # @return [Float]
104
- # Confidence of the OCR results on the page. Range [0, 1].
105
- class Page; end
106
-
107
- # Logical element on the page.
108
- # @!attribute [rw] property
109
- # @return [Google::Cloud::Vision::V1p3beta1::TextAnnotation::TextProperty]
110
- # Additional information detected for the block.
111
- # @!attribute [rw] bounding_box
112
- # @return [Google::Cloud::Vision::V1p3beta1::BoundingPoly]
113
- # The bounding box for the block.
114
- # The vertices are in the order of top-left, top-right, bottom-right,
115
- # bottom-left. When a rotation of the bounding box is detected the rotation
116
- # is represented as around the top-left corner as defined when the text is
117
- # read in the 'natural' orientation.
118
- # For example:
119
- #
120
- # * when the text is horizontal it might look like:
121
- #
122
- # 0----1
123
- # | |
124
- # 3----2
125
- #
126
- # * when it's rotated 180 degrees around the top-left corner it becomes:
127
- #
128
- # 2----3
129
- # | |
130
- # 1----0
131
- #
132
- # and the vertice order will still be (0, 1, 2, 3).
133
- # @!attribute [rw] paragraphs
134
- # @return [Array<Google::Cloud::Vision::V1p3beta1::Paragraph>]
135
- # List of paragraphs in this block (if this blocks is of type text).
136
- # @!attribute [rw] block_type
137
- # @return [Google::Cloud::Vision::V1p3beta1::Block::BlockType]
138
- # Detected block type (text, image etc) for this block.
139
- # @!attribute [rw] confidence
140
- # @return [Float]
141
- # Confidence of the OCR results on the block. Range [0, 1].
142
- class Block
143
- # Type of a block (text, image etc) as identified by OCR.
144
- module BlockType
145
- # Unknown block type.
146
- UNKNOWN = 0
147
-
148
- # Regular text block.
149
- TEXT = 1
150
-
151
- # Table block.
152
- TABLE = 2
153
-
154
- # Image block.
155
- PICTURE = 3
156
-
157
- # Horizontal/vertical line box.
158
- RULER = 4
159
-
160
- # Barcode block.
161
- BARCODE = 5
162
- end
163
- end
164
-
165
- # Structural unit of text representing a number of words in certain order.
166
- # @!attribute [rw] property
167
- # @return [Google::Cloud::Vision::V1p3beta1::TextAnnotation::TextProperty]
168
- # Additional information detected for the paragraph.
169
- # @!attribute [rw] bounding_box
170
- # @return [Google::Cloud::Vision::V1p3beta1::BoundingPoly]
171
- # The bounding box for the paragraph.
172
- # The vertices are in the order of top-left, top-right, bottom-right,
173
- # bottom-left. When a rotation of the bounding box is detected the rotation
174
- # is represented as around the top-left corner as defined when the text is
175
- # read in the 'natural' orientation.
176
- # For example:
177
- # * when the text is horizontal it might look like:
178
- # 0----1
179
- # | |
180
- # 3----2
181
- # * when it's rotated 180 degrees around the top-left corner it becomes:
182
- # 2----3
183
- # | |
184
- # 1----0
185
- # and the vertice order will still be (0, 1, 2, 3).
186
- # @!attribute [rw] words
187
- # @return [Array<Google::Cloud::Vision::V1p3beta1::Word>]
188
- # List of words in this paragraph.
189
- # @!attribute [rw] confidence
190
- # @return [Float]
191
- # Confidence of the OCR results for the paragraph. Range [0, 1].
192
- class Paragraph; end
193
-
194
- # A word representation.
195
- # @!attribute [rw] property
196
- # @return [Google::Cloud::Vision::V1p3beta1::TextAnnotation::TextProperty]
197
- # Additional information detected for the word.
198
- # @!attribute [rw] bounding_box
199
- # @return [Google::Cloud::Vision::V1p3beta1::BoundingPoly]
200
- # The bounding box for the word.
201
- # The vertices are in the order of top-left, top-right, bottom-right,
202
- # bottom-left. When a rotation of the bounding box is detected the rotation
203
- # is represented as around the top-left corner as defined when the text is
204
- # read in the 'natural' orientation.
205
- # For example:
206
- # * when the text is horizontal it might look like:
207
- # 0----1
208
- # | |
209
- # 3----2
210
- # * when it's rotated 180 degrees around the top-left corner it becomes:
211
- # 2----3
212
- # | |
213
- # 1----0
214
- # and the vertice order will still be (0, 1, 2, 3).
215
- # @!attribute [rw] symbols
216
- # @return [Array<Google::Cloud::Vision::V1p3beta1::Symbol>]
217
- # List of symbols in the word.
218
- # The order of the symbols follows the natural reading order.
219
- # @!attribute [rw] confidence
220
- # @return [Float]
221
- # Confidence of the OCR results for the word. Range [0, 1].
222
- class Word; end
223
-
224
- # A single symbol representation.
225
- # @!attribute [rw] property
226
- # @return [Google::Cloud::Vision::V1p3beta1::TextAnnotation::TextProperty]
227
- # Additional information detected for the symbol.
228
- # @!attribute [rw] bounding_box
229
- # @return [Google::Cloud::Vision::V1p3beta1::BoundingPoly]
230
- # The bounding box for the symbol.
231
- # The vertices are in the order of top-left, top-right, bottom-right,
232
- # bottom-left. When a rotation of the bounding box is detected the rotation
233
- # is represented as around the top-left corner as defined when the text is
234
- # read in the 'natural' orientation.
235
- # For example:
236
- # * when the text is horizontal it might look like:
237
- # 0----1
238
- # | |
239
- # 3----2
240
- # * when it's rotated 180 degrees around the top-left corner it becomes:
241
- # 2----3
242
- # | |
243
- # 1----0
244
- # and the vertice order will still be (0, 1, 2, 3).
245
- # @!attribute [rw] text
246
- # @return [String]
247
- # The actual UTF-8 representation of the symbol.
248
- # @!attribute [rw] confidence
249
- # @return [Float]
250
- # Confidence of the OCR results for the symbol. Range [0, 1].
251
- class Symbol; end
252
- end
253
- end
254
- end
255
- end
@@ -1,101 +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 Cloud
18
- module Vision
19
- module V1p3beta1
20
- # Relevant information for the image from the Internet.
21
- # @!attribute [rw] web_entities
22
- # @return [Array<Google::Cloud::Vision::V1p3beta1::WebDetection::WebEntity>]
23
- # Deduced entities from similar images on the Internet.
24
- # @!attribute [rw] full_matching_images
25
- # @return [Array<Google::Cloud::Vision::V1p3beta1::WebDetection::WebImage>]
26
- # Fully matching images from the Internet.
27
- # Can include resized copies of the query image.
28
- # @!attribute [rw] partial_matching_images
29
- # @return [Array<Google::Cloud::Vision::V1p3beta1::WebDetection::WebImage>]
30
- # Partial matching images from the Internet.
31
- # Those images are similar enough to share some key-point features. For
32
- # example an original image will likely have partial matching for its crops.
33
- # @!attribute [rw] pages_with_matching_images
34
- # @return [Array<Google::Cloud::Vision::V1p3beta1::WebDetection::WebPage>]
35
- # Web pages containing the matching images from the Internet.
36
- # @!attribute [rw] visually_similar_images
37
- # @return [Array<Google::Cloud::Vision::V1p3beta1::WebDetection::WebImage>]
38
- # The visually similar image results.
39
- # @!attribute [rw] best_guess_labels
40
- # @return [Array<Google::Cloud::Vision::V1p3beta1::WebDetection::WebLabel>]
41
- # Best guess text labels for the request image.
42
- class WebDetection
43
- # Entity deduced from similar images on the Internet.
44
- # @!attribute [rw] entity_id
45
- # @return [String]
46
- # Opaque entity ID.
47
- # @!attribute [rw] score
48
- # @return [Float]
49
- # Overall relevancy score for the entity.
50
- # Not normalized and not comparable across different image queries.
51
- # @!attribute [rw] description
52
- # @return [String]
53
- # Canonical description of the entity, in English.
54
- class WebEntity; end
55
-
56
- # Metadata for online images.
57
- # @!attribute [rw] url
58
- # @return [String]
59
- # The result image URL.
60
- # @!attribute [rw] score
61
- # @return [Float]
62
- # (Deprecated) Overall relevancy score for the image.
63
- class WebImage; end
64
-
65
- # Metadata for web pages.
66
- # @!attribute [rw] url
67
- # @return [String]
68
- # The result web page URL.
69
- # @!attribute [rw] score
70
- # @return [Float]
71
- # (Deprecated) Overall relevancy score for the web page.
72
- # @!attribute [rw] page_title
73
- # @return [String]
74
- # Title for the web page, may contain HTML markups.
75
- # @!attribute [rw] full_matching_images
76
- # @return [Array<Google::Cloud::Vision::V1p3beta1::WebDetection::WebImage>]
77
- # Fully matching images on the page.
78
- # Can include resized copies of the query image.
79
- # @!attribute [rw] partial_matching_images
80
- # @return [Array<Google::Cloud::Vision::V1p3beta1::WebDetection::WebImage>]
81
- # Partial matching images on the page.
82
- # Those images are similar enough to share some key-point features. For
83
- # example an original image will likely have partial matching for its
84
- # crops.
85
- class WebPage; end
86
-
87
- # Label to provide extra metadata for the web detection.
88
- # @!attribute [rw] label
89
- # @return [String]
90
- # Label for extra metadata.
91
- # @!attribute [rw] language_code
92
- # @return [String]
93
- # The BCP-47 language code for `label`, such as "en-US" or "sr-Latn".
94
- # For more information, see
95
- # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
96
- class WebLabel; end
97
- end
98
- end
99
- end
100
- end
101
- end
@@ -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