google-cloud-vision 0.38.0 → 1.0.0

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