google-apis-discovery_v1 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
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
+ # http://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
+ module Google
16
+ module Apis
17
+ module DiscoveryV1
18
+ # Version of the google-apis-discovery_v1 gem
19
+ GEM_VERSION = "0.0.1"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.1.0"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20190129"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,397 @@
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
+ # http://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
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module DiscoveryV1
24
+
25
+ class DirectoryList
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ class Item
29
+ class Representation < Google::Apis::Core::JsonRepresentation; end
30
+
31
+ class Icons
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ include Google::Apis::Core::JsonObjectSupport
38
+ end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class JsonSchema
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ class Annotations
47
+ class Representation < Google::Apis::Core::JsonRepresentation; end
48
+
49
+ include Google::Apis::Core::JsonObjectSupport
50
+ end
51
+
52
+ class Variant
53
+ class Representation < Google::Apis::Core::JsonRepresentation; end
54
+
55
+ class Map
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ include Google::Apis::Core::JsonObjectSupport
62
+ end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class RestDescription
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ class Auth
71
+ class Representation < Google::Apis::Core::JsonRepresentation; end
72
+
73
+ class Oauth2
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ class Scope
77
+ class Representation < Google::Apis::Core::JsonRepresentation; end
78
+
79
+ include Google::Apis::Core::JsonObjectSupport
80
+ end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ include Google::Apis::Core::JsonObjectSupport
86
+ end
87
+
88
+ class Icons
89
+ class Representation < Google::Apis::Core::JsonRepresentation; end
90
+
91
+ include Google::Apis::Core::JsonObjectSupport
92
+ end
93
+
94
+ include Google::Apis::Core::JsonObjectSupport
95
+ end
96
+
97
+ class RestMethod
98
+ class Representation < Google::Apis::Core::JsonRepresentation; end
99
+
100
+ class MediaUpload
101
+ class Representation < Google::Apis::Core::JsonRepresentation; end
102
+
103
+ class Protocols
104
+ class Representation < Google::Apis::Core::JsonRepresentation; end
105
+
106
+ class Resumable
107
+ class Representation < Google::Apis::Core::JsonRepresentation; end
108
+
109
+ include Google::Apis::Core::JsonObjectSupport
110
+ end
111
+
112
+ class Simple
113
+ class Representation < Google::Apis::Core::JsonRepresentation; end
114
+
115
+ include Google::Apis::Core::JsonObjectSupport
116
+ end
117
+
118
+ include Google::Apis::Core::JsonObjectSupport
119
+ end
120
+
121
+ include Google::Apis::Core::JsonObjectSupport
122
+ end
123
+
124
+ class Request
125
+ class Representation < Google::Apis::Core::JsonRepresentation; end
126
+
127
+ include Google::Apis::Core::JsonObjectSupport
128
+ end
129
+
130
+ class Response
131
+ class Representation < Google::Apis::Core::JsonRepresentation; end
132
+
133
+ include Google::Apis::Core::JsonObjectSupport
134
+ end
135
+
136
+ include Google::Apis::Core::JsonObjectSupport
137
+ end
138
+
139
+ class RestResource
140
+ class Representation < Google::Apis::Core::JsonRepresentation; end
141
+
142
+ include Google::Apis::Core::JsonObjectSupport
143
+ end
144
+
145
+ class DirectoryList
146
+ # @private
147
+ class Representation < Google::Apis::Core::JsonRepresentation
148
+ property :discovery_version, as: 'discoveryVersion'
149
+ collection :items, as: 'items', class: Google::Apis::DiscoveryV1::DirectoryList::Item, decorator: Google::Apis::DiscoveryV1::DirectoryList::Item::Representation
150
+
151
+ property :kind, as: 'kind'
152
+ end
153
+
154
+ class Item
155
+ # @private
156
+ class Representation < Google::Apis::Core::JsonRepresentation
157
+ property :description, as: 'description'
158
+ property :discovery_link, as: 'discoveryLink'
159
+ property :discovery_rest_url, as: 'discoveryRestUrl'
160
+ property :documentation_link, as: 'documentationLink'
161
+ property :icons, as: 'icons', class: Google::Apis::DiscoveryV1::DirectoryList::Item::Icons, decorator: Google::Apis::DiscoveryV1::DirectoryList::Item::Icons::Representation
162
+
163
+ property :id, as: 'id'
164
+ property :kind, as: 'kind'
165
+ collection :labels, as: 'labels'
166
+ property :name, as: 'name'
167
+ property :preferred, as: 'preferred'
168
+ property :title, as: 'title'
169
+ property :version, as: 'version'
170
+ end
171
+
172
+ class Icons
173
+ # @private
174
+ class Representation < Google::Apis::Core::JsonRepresentation
175
+ property :x16, as: 'x16'
176
+ property :x32, as: 'x32'
177
+ end
178
+ end
179
+ end
180
+ end
181
+
182
+ class JsonSchema
183
+ # @private
184
+ class Representation < Google::Apis::Core::JsonRepresentation
185
+ property :_ref, as: '$ref'
186
+ property :additional_properties, as: 'additionalProperties', class: Google::Apis::DiscoveryV1::JsonSchema, decorator: Google::Apis::DiscoveryV1::JsonSchema::Representation
187
+
188
+ property :annotations, as: 'annotations', class: Google::Apis::DiscoveryV1::JsonSchema::Annotations, decorator: Google::Apis::DiscoveryV1::JsonSchema::Annotations::Representation
189
+
190
+ property :default, as: 'default'
191
+ property :description, as: 'description'
192
+ collection :enum, as: 'enum'
193
+ collection :enum_descriptions, as: 'enumDescriptions'
194
+ property :format, as: 'format'
195
+ property :id, as: 'id'
196
+ property :items, as: 'items', class: Google::Apis::DiscoveryV1::JsonSchema, decorator: Google::Apis::DiscoveryV1::JsonSchema::Representation
197
+
198
+ property :location, as: 'location'
199
+ property :maximum, as: 'maximum'
200
+ property :minimum, as: 'minimum'
201
+ property :pattern, as: 'pattern'
202
+ hash :properties, as: 'properties', class: Google::Apis::DiscoveryV1::JsonSchema, decorator: Google::Apis::DiscoveryV1::JsonSchema::Representation
203
+
204
+ property :read_only, as: 'readOnly'
205
+ property :repeated, as: 'repeated'
206
+ property :required, as: 'required'
207
+ property :type, as: 'type'
208
+ property :variant, as: 'variant', class: Google::Apis::DiscoveryV1::JsonSchema::Variant, decorator: Google::Apis::DiscoveryV1::JsonSchema::Variant::Representation
209
+
210
+ end
211
+
212
+ class Annotations
213
+ # @private
214
+ class Representation < Google::Apis::Core::JsonRepresentation
215
+ collection :required, as: 'required'
216
+ end
217
+ end
218
+
219
+ class Variant
220
+ # @private
221
+ class Representation < Google::Apis::Core::JsonRepresentation
222
+ property :discriminant, as: 'discriminant'
223
+ collection :map, as: 'map', class: Google::Apis::DiscoveryV1::JsonSchema::Variant::Map, decorator: Google::Apis::DiscoveryV1::JsonSchema::Variant::Map::Representation
224
+
225
+ end
226
+
227
+ class Map
228
+ # @private
229
+ class Representation < Google::Apis::Core::JsonRepresentation
230
+ property :_ref, as: '$ref'
231
+ property :type_value, as: 'type_value'
232
+ end
233
+ end
234
+ end
235
+ end
236
+
237
+ class RestDescription
238
+ # @private
239
+ class Representation < Google::Apis::Core::JsonRepresentation
240
+ property :auth, as: 'auth', class: Google::Apis::DiscoveryV1::RestDescription::Auth, decorator: Google::Apis::DiscoveryV1::RestDescription::Auth::Representation
241
+
242
+ property :base_path, as: 'basePath'
243
+ property :base_url, as: 'baseUrl'
244
+ property :batch_path, as: 'batchPath'
245
+ property :canonical_name, as: 'canonicalName'
246
+ property :description, as: 'description'
247
+ property :discovery_version, as: 'discoveryVersion'
248
+ property :documentation_link, as: 'documentationLink'
249
+ property :etag, as: 'etag'
250
+ property :exponential_backoff_default, as: 'exponentialBackoffDefault'
251
+ collection :features, as: 'features'
252
+ property :icons, as: 'icons', class: Google::Apis::DiscoveryV1::RestDescription::Icons, decorator: Google::Apis::DiscoveryV1::RestDescription::Icons::Representation
253
+
254
+ property :id, as: 'id'
255
+ property :kind, as: 'kind'
256
+ collection :labels, as: 'labels'
257
+ hash :api_methods, as: 'methods', class: Google::Apis::DiscoveryV1::RestMethod, decorator: Google::Apis::DiscoveryV1::RestMethod::Representation
258
+
259
+ property :name, as: 'name'
260
+ property :owner_domain, as: 'ownerDomain'
261
+ property :owner_name, as: 'ownerName'
262
+ property :package_path, as: 'packagePath'
263
+ hash :parameters, as: 'parameters', class: Google::Apis::DiscoveryV1::JsonSchema, decorator: Google::Apis::DiscoveryV1::JsonSchema::Representation
264
+
265
+ property :protocol, as: 'protocol'
266
+ hash :resources, as: 'resources', class: Google::Apis::DiscoveryV1::RestResource, decorator: Google::Apis::DiscoveryV1::RestResource::Representation
267
+
268
+ property :revision, as: 'revision'
269
+ property :root_url, as: 'rootUrl'
270
+ hash :schemas, as: 'schemas', class: Google::Apis::DiscoveryV1::JsonSchema, decorator: Google::Apis::DiscoveryV1::JsonSchema::Representation
271
+
272
+ property :service_path, as: 'servicePath'
273
+ property :title, as: 'title'
274
+ property :version, as: 'version'
275
+ property :version_module, as: 'version_module'
276
+ end
277
+
278
+ class Auth
279
+ # @private
280
+ class Representation < Google::Apis::Core::JsonRepresentation
281
+ property :oauth2, as: 'oauth2', class: Google::Apis::DiscoveryV1::RestDescription::Auth::Oauth2, decorator: Google::Apis::DiscoveryV1::RestDescription::Auth::Oauth2::Representation
282
+
283
+ end
284
+
285
+ class Oauth2
286
+ # @private
287
+ class Representation < Google::Apis::Core::JsonRepresentation
288
+ hash :scopes, as: 'scopes', class: Google::Apis::DiscoveryV1::RestDescription::Auth::Oauth2::Scope, decorator: Google::Apis::DiscoveryV1::RestDescription::Auth::Oauth2::Scope::Representation
289
+
290
+ end
291
+
292
+ class Scope
293
+ # @private
294
+ class Representation < Google::Apis::Core::JsonRepresentation
295
+ property :description, as: 'description'
296
+ end
297
+ end
298
+ end
299
+ end
300
+
301
+ class Icons
302
+ # @private
303
+ class Representation < Google::Apis::Core::JsonRepresentation
304
+ property :x16, as: 'x16'
305
+ property :x32, as: 'x32'
306
+ end
307
+ end
308
+ end
309
+
310
+ class RestMethod
311
+ # @private
312
+ class Representation < Google::Apis::Core::JsonRepresentation
313
+ property :description, as: 'description'
314
+ property :etag_required, as: 'etagRequired'
315
+ property :http_method, as: 'httpMethod'
316
+ property :id, as: 'id'
317
+ property :media_upload, as: 'mediaUpload', class: Google::Apis::DiscoveryV1::RestMethod::MediaUpload, decorator: Google::Apis::DiscoveryV1::RestMethod::MediaUpload::Representation
318
+
319
+ collection :parameter_order, as: 'parameterOrder'
320
+ hash :parameters, as: 'parameters', class: Google::Apis::DiscoveryV1::JsonSchema, decorator: Google::Apis::DiscoveryV1::JsonSchema::Representation
321
+
322
+ property :path, as: 'path'
323
+ property :request, as: 'request', class: Google::Apis::DiscoveryV1::RestMethod::Request, decorator: Google::Apis::DiscoveryV1::RestMethod::Request::Representation
324
+
325
+ property :response, as: 'response', class: Google::Apis::DiscoveryV1::RestMethod::Response, decorator: Google::Apis::DiscoveryV1::RestMethod::Response::Representation
326
+
327
+ collection :scopes, as: 'scopes'
328
+ property :supports_media_download, as: 'supportsMediaDownload'
329
+ property :supports_media_upload, as: 'supportsMediaUpload'
330
+ property :supports_subscription, as: 'supportsSubscription'
331
+ property :use_media_download_service, as: 'useMediaDownloadService'
332
+ end
333
+
334
+ class MediaUpload
335
+ # @private
336
+ class Representation < Google::Apis::Core::JsonRepresentation
337
+ collection :accept, as: 'accept'
338
+ property :max_size, as: 'maxSize'
339
+ property :protocols, as: 'protocols', class: Google::Apis::DiscoveryV1::RestMethod::MediaUpload::Protocols, decorator: Google::Apis::DiscoveryV1::RestMethod::MediaUpload::Protocols::Representation
340
+
341
+ end
342
+
343
+ class Protocols
344
+ # @private
345
+ class Representation < Google::Apis::Core::JsonRepresentation
346
+ property :resumable, as: 'resumable', class: Google::Apis::DiscoveryV1::RestMethod::MediaUpload::Protocols::Resumable, decorator: Google::Apis::DiscoveryV1::RestMethod::MediaUpload::Protocols::Resumable::Representation
347
+
348
+ property :simple, as: 'simple', class: Google::Apis::DiscoveryV1::RestMethod::MediaUpload::Protocols::Simple, decorator: Google::Apis::DiscoveryV1::RestMethod::MediaUpload::Protocols::Simple::Representation
349
+
350
+ end
351
+
352
+ class Resumable
353
+ # @private
354
+ class Representation < Google::Apis::Core::JsonRepresentation
355
+ property :multipart, as: 'multipart'
356
+ property :path, as: 'path'
357
+ end
358
+ end
359
+
360
+ class Simple
361
+ # @private
362
+ class Representation < Google::Apis::Core::JsonRepresentation
363
+ property :multipart, as: 'multipart'
364
+ property :path, as: 'path'
365
+ end
366
+ end
367
+ end
368
+ end
369
+
370
+ class Request
371
+ # @private
372
+ class Representation < Google::Apis::Core::JsonRepresentation
373
+ property :_ref, as: '$ref'
374
+ property :parameter_name, as: 'parameterName'
375
+ end
376
+ end
377
+
378
+ class Response
379
+ # @private
380
+ class Representation < Google::Apis::Core::JsonRepresentation
381
+ property :_ref, as: '$ref'
382
+ end
383
+ end
384
+ end
385
+
386
+ class RestResource
387
+ # @private
388
+ class Representation < Google::Apis::Core::JsonRepresentation
389
+ hash :api_methods, as: 'methods', class: Google::Apis::DiscoveryV1::RestMethod, decorator: Google::Apis::DiscoveryV1::RestMethod::Representation
390
+
391
+ hash :resources, as: 'resources', class: Google::Apis::DiscoveryV1::RestResource, decorator: Google::Apis::DiscoveryV1::RestResource::Representation
392
+
393
+ end
394
+ end
395
+ end
396
+ end
397
+ end
@@ -0,0 +1,139 @@
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
+ # http://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
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module DiscoveryV1
23
+ # API Discovery Service
24
+ #
25
+ # Provides information about other Google APIs, such as what APIs are available,
26
+ # the resource, and method details for each API.
27
+ #
28
+ # @example
29
+ # require 'google/apis/discovery_v1'
30
+ #
31
+ # Discovery = Google::Apis::DiscoveryV1 # Alias the module
32
+ # service = Discovery::DiscoveryService.new
33
+ #
34
+ # @see https://developers.google.com/discovery/
35
+ class DiscoveryService < Google::Apis::Core::BaseService
36
+ # @return [String]
37
+ # API key. Your API key identifies your project and provides you with API access,
38
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
39
+ attr_accessor :key
40
+
41
+ # @return [String]
42
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
43
+ # characters.
44
+ attr_accessor :quota_user
45
+
46
+ # @return [String]
47
+ # Deprecated. Please use quotaUser instead.
48
+ attr_accessor :user_ip
49
+
50
+ def initialize
51
+ super('https://www.googleapis.com/', 'discovery/v1/',
52
+ client_name: 'google-apis-discovery_v1',
53
+ client_version: Google::Apis::DiscoveryV1::GEM_VERSION)
54
+ @batch_path = 'batch/discovery/v1'
55
+ end
56
+
57
+ # Retrieve the description of a particular version of an api.
58
+ # @param [String] api
59
+ # The name of the API.
60
+ # @param [String] version
61
+ # The version of the API.
62
+ # @param [String] fields
63
+ # Selector specifying which fields to include in a partial response.
64
+ # @param [String] quota_user
65
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
66
+ # characters.
67
+ # @param [String] user_ip
68
+ # Deprecated. Please use quotaUser instead.
69
+ # @param [Google::Apis::RequestOptions] options
70
+ # Request-specific options
71
+ #
72
+ # @yield [result, err] Result & error if block supplied
73
+ # @yieldparam result [Google::Apis::DiscoveryV1::RestDescription] parsed result object
74
+ # @yieldparam err [StandardError] error object if request failed
75
+ #
76
+ # @return [Google::Apis::DiscoveryV1::RestDescription]
77
+ #
78
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
79
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
80
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
81
+ def get_rest_api(api, version, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
82
+ command = make_simple_command(:get, 'apis/{api}/{version}/rest', options)
83
+ command.response_representation = Google::Apis::DiscoveryV1::RestDescription::Representation
84
+ command.response_class = Google::Apis::DiscoveryV1::RestDescription
85
+ command.params['api'] = api unless api.nil?
86
+ command.params['version'] = version unless version.nil?
87
+ command.query['fields'] = fields unless fields.nil?
88
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
89
+ command.query['userIp'] = user_ip unless user_ip.nil?
90
+ execute_or_queue_command(command, &block)
91
+ end
92
+
93
+ # Retrieve the list of APIs supported at this endpoint.
94
+ # @param [String] name
95
+ # Only include APIs with the given name.
96
+ # @param [Boolean] preferred
97
+ # Return only the preferred version of an API.
98
+ # @param [String] fields
99
+ # Selector specifying which fields to include in a partial response.
100
+ # @param [String] quota_user
101
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
102
+ # characters.
103
+ # @param [String] user_ip
104
+ # Deprecated. Please use quotaUser instead.
105
+ # @param [Google::Apis::RequestOptions] options
106
+ # Request-specific options
107
+ #
108
+ # @yield [result, err] Result & error if block supplied
109
+ # @yieldparam result [Google::Apis::DiscoveryV1::DirectoryList] parsed result object
110
+ # @yieldparam err [StandardError] error object if request failed
111
+ #
112
+ # @return [Google::Apis::DiscoveryV1::DirectoryList]
113
+ #
114
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
115
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
116
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
117
+ def list_apis(name: nil, preferred: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
118
+ command = make_simple_command(:get, 'apis', options)
119
+ command.response_representation = Google::Apis::DiscoveryV1::DirectoryList::Representation
120
+ command.response_class = Google::Apis::DiscoveryV1::DirectoryList
121
+ command.query['name'] = name unless name.nil?
122
+ command.query['preferred'] = preferred unless preferred.nil?
123
+ command.query['fields'] = fields unless fields.nil?
124
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
125
+ command.query['userIp'] = user_ip unless user_ip.nil?
126
+ execute_or_queue_command(command, &block)
127
+ end
128
+
129
+ protected
130
+
131
+ def apply_command_defaults(command)
132
+ command.query['key'] = key unless key.nil?
133
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
134
+ command.query['userIp'] = user_ip unless user_ip.nil?
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end