google-maps-fleet_engine-delivery-v1 0.a → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +144 -8
  5. data/lib/google/maps/fleet_engine/delivery/v1/delivery_service/client.rb +1621 -0
  6. data/lib/google/maps/fleet_engine/delivery/v1/delivery_service/credentials.rb +49 -0
  7. data/lib/google/maps/fleet_engine/delivery/v1/delivery_service/paths.rb +100 -0
  8. data/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/client.rb +1505 -0
  9. data/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest/service_stub.rb +725 -0
  10. data/lib/google/maps/fleet_engine/delivery/v1/delivery_service/rest.rb +54 -0
  11. data/lib/google/maps/fleet_engine/delivery/v1/delivery_service.rb +57 -0
  12. data/lib/google/maps/fleet_engine/delivery/v1/rest.rb +39 -0
  13. data/lib/google/maps/fleet_engine/delivery/v1/version.rb +8 -3
  14. data/lib/google/maps/fleet_engine/delivery/v1.rb +47 -0
  15. data/lib/google/maps/fleetengine/delivery/v1/common_pb.rb +57 -0
  16. data/lib/google/maps/fleetengine/delivery/v1/delivery_api_pb.rb +75 -0
  17. data/lib/google/maps/fleetengine/delivery/v1/delivery_api_services_pb.rb +73 -0
  18. data/lib/google/maps/fleetengine/delivery/v1/delivery_vehicles_pb.rb +61 -0
  19. data/lib/google/maps/fleetengine/delivery/v1/header_pb.rb +48 -0
  20. data/lib/google/maps/fleetengine/delivery/v1/task_tracking_info_pb.rb +58 -0
  21. data/lib/google/maps/fleetengine/delivery/v1/tasks_pb.rb +62 -0
  22. data/lib/google-maps-fleet_engine-delivery-v1.rb +21 -0
  23. data/proto_docs/README.md +4 -0
  24. data/proto_docs/google/api/client.rb +399 -0
  25. data/proto_docs/google/api/field_behavior.rb +85 -0
  26. data/proto_docs/google/api/launch_stage.rb +71 -0
  27. data/proto_docs/google/api/resource.rb +222 -0
  28. data/proto_docs/google/api/routing.rb +459 -0
  29. data/proto_docs/google/geo/type/viewport.rb +70 -0
  30. data/proto_docs/google/maps/fleetengine/delivery/v1/common.rb +251 -0
  31. data/proto_docs/google/maps/fleetengine/delivery/v1/delivery_api.rb +416 -0
  32. data/proto_docs/google/maps/fleetengine/delivery/v1/delivery_vehicles.rb +271 -0
  33. data/proto_docs/google/maps/fleetengine/delivery/v1/header.rb +113 -0
  34. data/proto_docs/google/maps/fleetengine/delivery/v1/task_tracking_info.rb +91 -0
  35. data/proto_docs/google/maps/fleetengine/delivery/v1/tasks.rb +281 -0
  36. data/proto_docs/google/protobuf/duration.rb +98 -0
  37. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  38. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  39. data/proto_docs/google/protobuf/wrappers.rb +121 -0
  40. data/proto_docs/google/type/latlng.rb +38 -0
  41. metadata +109 -13
@@ -0,0 +1,1621 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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
+ require "google/cloud/errors"
20
+ require "google/maps/fleetengine/delivery/v1/delivery_api_pb"
21
+
22
+ module Google
23
+ module Maps
24
+ module FleetEngine
25
+ module Delivery
26
+ module V1
27
+ module DeliveryService
28
+ ##
29
+ # Client for the DeliveryService service.
30
+ #
31
+ # The Last Mile Delivery service.
32
+ #
33
+ class Client
34
+ # @private
35
+ DEFAULT_ENDPOINT_TEMPLATE = "fleetengine.$UNIVERSE_DOMAIN$"
36
+
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :delivery_service_stub
41
+
42
+ ##
43
+ # Configure the DeliveryService Client class.
44
+ #
45
+ # See {::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all DeliveryService clients
51
+ # ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Maps", "FleetEngine", "Delivery", "V1"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.rpcs.create_delivery_vehicle.timeout = 60.0
72
+ default_config.rpcs.create_delivery_vehicle.retry_policy = {
73
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
74
+ }
75
+
76
+ default_config.rpcs.get_delivery_vehicle.timeout = 60.0
77
+ default_config.rpcs.get_delivery_vehicle.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config.rpcs.update_delivery_vehicle.timeout = 60.0
82
+ default_config.rpcs.update_delivery_vehicle.retry_policy = {
83
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
84
+ }
85
+
86
+ default_config.rpcs.batch_create_tasks.timeout = 60.0
87
+ default_config.rpcs.batch_create_tasks.retry_policy = {
88
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
89
+ }
90
+
91
+ default_config.rpcs.create_task.timeout = 60.0
92
+ default_config.rpcs.create_task.retry_policy = {
93
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
94
+ }
95
+
96
+ default_config.rpcs.get_task.timeout = 60.0
97
+ default_config.rpcs.get_task.retry_policy = {
98
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
99
+ }
100
+
101
+ default_config.rpcs.search_tasks.timeout = 60.0
102
+ default_config.rpcs.search_tasks.retry_policy = {
103
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
104
+ }
105
+
106
+ default_config.rpcs.update_task.timeout = 60.0
107
+ default_config.rpcs.update_task.retry_policy = {
108
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
109
+ }
110
+
111
+ default_config.rpcs.list_tasks.timeout = 60.0
112
+ default_config.rpcs.list_tasks.retry_policy = {
113
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
114
+ }
115
+
116
+ default_config.rpcs.get_task_tracking_info.timeout = 60.0
117
+ default_config.rpcs.get_task_tracking_info.retry_policy = {
118
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
119
+ }
120
+
121
+ default_config.rpcs.list_delivery_vehicles.timeout = 60.0
122
+ default_config.rpcs.list_delivery_vehicles.retry_policy = {
123
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
124
+ }
125
+
126
+ default_config
127
+ end
128
+ yield @configure if block_given?
129
+ @configure
130
+ end
131
+
132
+ ##
133
+ # Configure the DeliveryService Client instance.
134
+ #
135
+ # The configuration is set to the derived mode, meaning that values can be changed,
136
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
137
+ # should be made on {Client.configure}.
138
+ #
139
+ # See {::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client::Configuration}
140
+ # for a description of the configuration fields.
141
+ #
142
+ # @yield [config] Configure the Client client.
143
+ # @yieldparam config [Client::Configuration]
144
+ #
145
+ # @return [Client::Configuration]
146
+ #
147
+ def configure
148
+ yield @config if block_given?
149
+ @config
150
+ end
151
+
152
+ ##
153
+ # The effective universe domain
154
+ #
155
+ # @return [String]
156
+ #
157
+ def universe_domain
158
+ @delivery_service_stub.universe_domain
159
+ end
160
+
161
+ ##
162
+ # Create a new DeliveryService client object.
163
+ #
164
+ # @example
165
+ #
166
+ # # Create a client using the default configuration
167
+ # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
168
+ #
169
+ # # Create a client using a custom configuration
170
+ # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config|
171
+ # config.timeout = 10.0
172
+ # end
173
+ #
174
+ # @yield [config] Configure the DeliveryService client.
175
+ # @yieldparam config [Client::Configuration]
176
+ #
177
+ def initialize
178
+ # These require statements are intentionally placed here to initialize
179
+ # the gRPC module only when it's required.
180
+ # See https://github.com/googleapis/toolkit/issues/446
181
+ require "gapic/grpc"
182
+ require "google/maps/fleetengine/delivery/v1/delivery_api_services_pb"
183
+
184
+ # Create the configuration object
185
+ @config = Configuration.new Client.configure
186
+
187
+ # Yield the configuration if needed
188
+ yield @config if block_given?
189
+
190
+ # Create credentials
191
+ credentials = @config.credentials
192
+ # Use self-signed JWT if the endpoint is unchanged from default,
193
+ # but only if the default endpoint does not have a region prefix.
194
+ enable_self_signed_jwt = @config.endpoint.nil? ||
195
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
196
+ !@config.endpoint.split(".").first.include?("-"))
197
+ credentials ||= Credentials.default scope: @config.scope,
198
+ enable_self_signed_jwt: enable_self_signed_jwt
199
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
200
+ credentials = Credentials.new credentials, scope: @config.scope
201
+ end
202
+ @quota_project_id = @config.quota_project
203
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
204
+
205
+ @delivery_service_stub = ::Gapic::ServiceStub.new(
206
+ ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Stub,
207
+ credentials: credentials,
208
+ endpoint: @config.endpoint,
209
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
210
+ universe_domain: @config.universe_domain,
211
+ channel_args: @config.channel_args,
212
+ interceptors: @config.interceptors,
213
+ channel_pool_config: @config.channel_pool
214
+ )
215
+ end
216
+
217
+ # Service calls
218
+
219
+ ##
220
+ # Creates and returns a new `DeliveryVehicle`.
221
+ #
222
+ # @overload create_delivery_vehicle(request, options = nil)
223
+ # Pass arguments to `create_delivery_vehicle` via a request object, either of type
224
+ # {::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest} or an equivalent Hash.
225
+ #
226
+ # @param request [::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest, ::Hash]
227
+ # A request object representing the call parameters. Required. To specify no
228
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
229
+ # @param options [::Gapic::CallOptions, ::Hash]
230
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
231
+ #
232
+ # @overload create_delivery_vehicle(header: nil, parent: nil, delivery_vehicle_id: nil, delivery_vehicle: nil)
233
+ # Pass arguments to `create_delivery_vehicle` via keyword arguments. Note that at
234
+ # least one keyword argument is required. To specify no parameters, or to keep all
235
+ # the default parameter values, pass an empty Hash as a request object (see above).
236
+ #
237
+ # @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
238
+ # Optional. The standard Delivery API request header.
239
+ # @param parent [::String]
240
+ # Required. Must be in the format `providers/{provider}`. The provider must
241
+ # be the Google Cloud Project ID. For example, `sample-cloud-project`.
242
+ # @param delivery_vehicle_id [::String]
243
+ # Required. The Delivery Vehicle ID must be unique and subject to the
244
+ # following restrictions:
245
+ #
246
+ # * Must be a valid Unicode string.
247
+ # * Limited to a maximum length of 64 characters.
248
+ # * Normalized according to [Unicode Normalization Form C]
249
+ # (http://www.unicode.org/reports/tr15/).
250
+ # * May not contain any of the following ASCII characters: '/', ':', '?',
251
+ # ',', or '#'.
252
+ # @param delivery_vehicle [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle, ::Hash]
253
+ # Required. The `DeliveryVehicle` entity to create. When creating a new
254
+ # delivery vehicle, you may set the following optional fields:
255
+ #
256
+ # * last_location
257
+ # * attributes
258
+ #
259
+ # Note: The DeliveryVehicle's `name` field is ignored. All other
260
+ # DeliveryVehicle fields must not be set; otherwise, an error is returned.
261
+ #
262
+ # @yield [response, operation] Access the result along with the RPC operation
263
+ # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle]
264
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
265
+ #
266
+ # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle]
267
+ #
268
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
269
+ #
270
+ # @example Basic example
271
+ # require "google/maps/fleet_engine/delivery/v1"
272
+ #
273
+ # # Create a client object. The client can be reused for multiple calls.
274
+ # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
275
+ #
276
+ # # Create a request. To set request fields, pass in keyword arguments.
277
+ # request = Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest.new
278
+ #
279
+ # # Call the create_delivery_vehicle method.
280
+ # result = client.create_delivery_vehicle request
281
+ #
282
+ # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.
283
+ # p result
284
+ #
285
+ def create_delivery_vehicle request, options = nil
286
+ raise ::ArgumentError, "request must be provided" if request.nil?
287
+
288
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::CreateDeliveryVehicleRequest
289
+
290
+ # Converts hash and nil to an options object
291
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
292
+
293
+ # Customize the options with defaults
294
+ metadata = @config.rpcs.create_delivery_vehicle.metadata.to_h
295
+
296
+ # Set x-goog-api-client and x-goog-user-project headers
297
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
298
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
299
+ gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
300
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
301
+
302
+ header_params = {}
303
+ if request.parent &&
304
+ %r{^providers/[^/]+/?$}.match?(request.parent)
305
+ header_params["provider_id"] = request.parent
306
+ end
307
+
308
+ request_params_header = URI.encode_www_form header_params
309
+ metadata[:"x-goog-request-params"] ||= request_params_header
310
+
311
+ options.apply_defaults timeout: @config.rpcs.create_delivery_vehicle.timeout,
312
+ metadata: metadata,
313
+ retry_policy: @config.rpcs.create_delivery_vehicle.retry_policy
314
+
315
+ options.apply_defaults timeout: @config.timeout,
316
+ metadata: @config.metadata,
317
+ retry_policy: @config.retry_policy
318
+
319
+ @delivery_service_stub.call_rpc :create_delivery_vehicle, request, options: options do |response, operation|
320
+ yield response, operation if block_given?
321
+ return response
322
+ end
323
+ rescue ::GRPC::BadStatus => e
324
+ raise ::Google::Cloud::Error.from_error(e)
325
+ end
326
+
327
+ ##
328
+ # Returns the specified `DeliveryVehicle` instance.
329
+ #
330
+ # @overload get_delivery_vehicle(request, options = nil)
331
+ # Pass arguments to `get_delivery_vehicle` via a request object, either of type
332
+ # {::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest} or an equivalent Hash.
333
+ #
334
+ # @param request [::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest, ::Hash]
335
+ # A request object representing the call parameters. Required. To specify no
336
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
337
+ # @param options [::Gapic::CallOptions, ::Hash]
338
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
339
+ #
340
+ # @overload get_delivery_vehicle(header: nil, name: nil)
341
+ # Pass arguments to `get_delivery_vehicle` via keyword arguments. Note that at
342
+ # least one keyword argument is required. To specify no parameters, or to keep all
343
+ # the default parameter values, pass an empty Hash as a request object (see above).
344
+ #
345
+ # @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
346
+ # Optional. The standard Delivery API request header.
347
+ # @param name [::String]
348
+ # Required. Must be in the format
349
+ # `providers/{provider}/deliveryVehicles/{delivery_vehicle}`.
350
+ # The `provider` must be the Google Cloud Project ID. For example,
351
+ # `sample-cloud-project`.
352
+ #
353
+ # @yield [response, operation] Access the result along with the RPC operation
354
+ # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle]
355
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
356
+ #
357
+ # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle]
358
+ #
359
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
360
+ #
361
+ # @example Basic example
362
+ # require "google/maps/fleet_engine/delivery/v1"
363
+ #
364
+ # # Create a client object. The client can be reused for multiple calls.
365
+ # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
366
+ #
367
+ # # Create a request. To set request fields, pass in keyword arguments.
368
+ # request = Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest.new
369
+ #
370
+ # # Call the get_delivery_vehicle method.
371
+ # result = client.get_delivery_vehicle request
372
+ #
373
+ # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.
374
+ # p result
375
+ #
376
+ def get_delivery_vehicle request, options = nil
377
+ raise ::ArgumentError, "request must be provided" if request.nil?
378
+
379
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::GetDeliveryVehicleRequest
380
+
381
+ # Converts hash and nil to an options object
382
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
383
+
384
+ # Customize the options with defaults
385
+ metadata = @config.rpcs.get_delivery_vehicle.metadata.to_h
386
+
387
+ # Set x-goog-api-client and x-goog-user-project headers
388
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
389
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
390
+ gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
391
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
392
+
393
+ header_params = {}
394
+ if request.name &&
395
+ %r{^providers/[^/]+/?$}.match?(request.name)
396
+ header_params["provider_id"] = request.name
397
+ end
398
+
399
+ request_params_header = URI.encode_www_form header_params
400
+ metadata[:"x-goog-request-params"] ||= request_params_header
401
+
402
+ options.apply_defaults timeout: @config.rpcs.get_delivery_vehicle.timeout,
403
+ metadata: metadata,
404
+ retry_policy: @config.rpcs.get_delivery_vehicle.retry_policy
405
+
406
+ options.apply_defaults timeout: @config.timeout,
407
+ metadata: @config.metadata,
408
+ retry_policy: @config.retry_policy
409
+
410
+ @delivery_service_stub.call_rpc :get_delivery_vehicle, request, options: options do |response, operation|
411
+ yield response, operation if block_given?
412
+ return response
413
+ end
414
+ rescue ::GRPC::BadStatus => e
415
+ raise ::Google::Cloud::Error.from_error(e)
416
+ end
417
+
418
+ ##
419
+ # Writes updated `DeliveryVehicle` data to Fleet Engine, and assigns
420
+ # `Tasks` to the `DeliveryVehicle`. You cannot update the name of the
421
+ # `DeliveryVehicle`. You *can* update `remaining_vehicle_journey_segments`
422
+ # though, but it must contain all of the `VehicleJourneySegment`s currently
423
+ # on the `DeliveryVehicle`. The `task_id`s are retrieved from
424
+ # `remaining_vehicle_journey_segments`, and their corresponding `Tasks` are
425
+ # assigned to the `DeliveryVehicle` if they have not yet been assigned.
426
+ #
427
+ # @overload update_delivery_vehicle(request, options = nil)
428
+ # Pass arguments to `update_delivery_vehicle` via a request object, either of type
429
+ # {::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest} or an equivalent Hash.
430
+ #
431
+ # @param request [::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest, ::Hash]
432
+ # A request object representing the call parameters. Required. To specify no
433
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
434
+ # @param options [::Gapic::CallOptions, ::Hash]
435
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
436
+ #
437
+ # @overload update_delivery_vehicle(header: nil, delivery_vehicle: nil, update_mask: nil)
438
+ # Pass arguments to `update_delivery_vehicle` via keyword arguments. Note that at
439
+ # least one keyword argument is required. To specify no parameters, or to keep all
440
+ # the default parameter values, pass an empty Hash as a request object (see above).
441
+ #
442
+ # @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
443
+ # Optional. The standard Delivery API request header.
444
+ # @param delivery_vehicle [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle, ::Hash]
445
+ # Required. The `DeliveryVehicle` entity update to apply.
446
+ # Note: You cannot update the name of the `DeliveryVehicle`.
447
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
448
+ # Required. A field mask that indicates which `DeliveryVehicle` fields to
449
+ # update. Note that the update_mask must contain at least one field.
450
+ #
451
+ # This is a comma-separated list of fully qualified names of fields. Example:
452
+ # `"remaining_vehicle_journey_segments"`.
453
+ #
454
+ # @yield [response, operation] Access the result along with the RPC operation
455
+ # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle]
456
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
457
+ #
458
+ # @return [::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle]
459
+ #
460
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
461
+ #
462
+ # @example Basic example
463
+ # require "google/maps/fleet_engine/delivery/v1"
464
+ #
465
+ # # Create a client object. The client can be reused for multiple calls.
466
+ # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
467
+ #
468
+ # # Create a request. To set request fields, pass in keyword arguments.
469
+ # request = Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest.new
470
+ #
471
+ # # Call the update_delivery_vehicle method.
472
+ # result = client.update_delivery_vehicle request
473
+ #
474
+ # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.
475
+ # p result
476
+ #
477
+ def update_delivery_vehicle request, options = nil
478
+ raise ::ArgumentError, "request must be provided" if request.nil?
479
+
480
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::UpdateDeliveryVehicleRequest
481
+
482
+ # Converts hash and nil to an options object
483
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
484
+
485
+ # Customize the options with defaults
486
+ metadata = @config.rpcs.update_delivery_vehicle.metadata.to_h
487
+
488
+ # Set x-goog-api-client and x-goog-user-project headers
489
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
490
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
491
+ gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
492
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
493
+
494
+ header_params = {}
495
+ if request.delivery_vehicle&.name &&
496
+ %r{^providers/[^/]+/?$}.match?(request.delivery_vehicle.name)
497
+ header_params["provider_id"] = request.delivery_vehicle.name
498
+ end
499
+
500
+ request_params_header = URI.encode_www_form header_params
501
+ metadata[:"x-goog-request-params"] ||= request_params_header
502
+
503
+ options.apply_defaults timeout: @config.rpcs.update_delivery_vehicle.timeout,
504
+ metadata: metadata,
505
+ retry_policy: @config.rpcs.update_delivery_vehicle.retry_policy
506
+
507
+ options.apply_defaults timeout: @config.timeout,
508
+ metadata: @config.metadata,
509
+ retry_policy: @config.retry_policy
510
+
511
+ @delivery_service_stub.call_rpc :update_delivery_vehicle, request, options: options do |response, operation|
512
+ yield response, operation if block_given?
513
+ return response
514
+ end
515
+ rescue ::GRPC::BadStatus => e
516
+ raise ::Google::Cloud::Error.from_error(e)
517
+ end
518
+
519
+ ##
520
+ # Creates and returns a batch of new `Task` objects.
521
+ #
522
+ # @overload batch_create_tasks(request, options = nil)
523
+ # Pass arguments to `batch_create_tasks` via a request object, either of type
524
+ # {::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest} or an equivalent Hash.
525
+ #
526
+ # @param request [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest, ::Hash]
527
+ # A request object representing the call parameters. Required. To specify no
528
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
529
+ # @param options [::Gapic::CallOptions, ::Hash]
530
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
531
+ #
532
+ # @overload batch_create_tasks(header: nil, parent: nil, requests: nil)
533
+ # Pass arguments to `batch_create_tasks` via keyword arguments. Note that at
534
+ # least one keyword argument is required. To specify no parameters, or to keep all
535
+ # the default parameter values, pass an empty Hash as a request object (see above).
536
+ #
537
+ # @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
538
+ # Optional. The standard Delivery API request header.
539
+ # Note: If you set this field, then the header field in the
540
+ # `CreateTaskRequest` messages must either be empty, or it must match this
541
+ # field.
542
+ # @param parent [::String]
543
+ # Required. The parent resource shared by all tasks. This value must be in
544
+ # the format `providers/{provider}`. The `provider` must be the Google Cloud
545
+ # Project ID. For example, `sample-cloud-project`. The parent field in the
546
+ # `CreateTaskRequest` messages must either be empty, or it must match this
547
+ # field.
548
+ # @param requests [::Array<::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest, ::Hash>]
549
+ # Required. The request message that specifies the resources to create.
550
+ # Note: You can create a maximum of 500 tasks in a batch.
551
+ #
552
+ # @yield [response, operation] Access the result along with the RPC operation
553
+ # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse]
554
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
555
+ #
556
+ # @return [::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse]
557
+ #
558
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
559
+ #
560
+ # @example Basic example
561
+ # require "google/maps/fleet_engine/delivery/v1"
562
+ #
563
+ # # Create a client object. The client can be reused for multiple calls.
564
+ # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
565
+ #
566
+ # # Create a request. To set request fields, pass in keyword arguments.
567
+ # request = Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest.new
568
+ #
569
+ # # Call the batch_create_tasks method.
570
+ # result = client.batch_create_tasks request
571
+ #
572
+ # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksResponse.
573
+ # p result
574
+ #
575
+ def batch_create_tasks request, options = nil
576
+ raise ::ArgumentError, "request must be provided" if request.nil?
577
+
578
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::BatchCreateTasksRequest
579
+
580
+ # Converts hash and nil to an options object
581
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
582
+
583
+ # Customize the options with defaults
584
+ metadata = @config.rpcs.batch_create_tasks.metadata.to_h
585
+
586
+ # Set x-goog-api-client and x-goog-user-project headers
587
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
588
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
589
+ gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
590
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
591
+
592
+ header_params = {}
593
+ if request.parent &&
594
+ %r{^providers/[^/]+/?$}.match?(request.parent)
595
+ header_params["provider_id"] = request.parent
596
+ end
597
+
598
+ request_params_header = URI.encode_www_form header_params
599
+ metadata[:"x-goog-request-params"] ||= request_params_header
600
+
601
+ options.apply_defaults timeout: @config.rpcs.batch_create_tasks.timeout,
602
+ metadata: metadata,
603
+ retry_policy: @config.rpcs.batch_create_tasks.retry_policy
604
+
605
+ options.apply_defaults timeout: @config.timeout,
606
+ metadata: @config.metadata,
607
+ retry_policy: @config.retry_policy
608
+
609
+ @delivery_service_stub.call_rpc :batch_create_tasks, request, options: options do |response, operation|
610
+ yield response, operation if block_given?
611
+ return response
612
+ end
613
+ rescue ::GRPC::BadStatus => e
614
+ raise ::Google::Cloud::Error.from_error(e)
615
+ end
616
+
617
+ ##
618
+ # Creates and returns a new `Task` object.
619
+ #
620
+ # @overload create_task(request, options = nil)
621
+ # Pass arguments to `create_task` via a request object, either of type
622
+ # {::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest} or an equivalent Hash.
623
+ #
624
+ # @param request [::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest, ::Hash]
625
+ # A request object representing the call parameters. Required. To specify no
626
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
627
+ # @param options [::Gapic::CallOptions, ::Hash]
628
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
629
+ #
630
+ # @overload create_task(header: nil, parent: nil, task_id: nil, task: nil)
631
+ # Pass arguments to `create_task` via keyword arguments. Note that at
632
+ # least one keyword argument is required. To specify no parameters, or to keep all
633
+ # the default parameter values, pass an empty Hash as a request object (see above).
634
+ #
635
+ # @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
636
+ # Optional. The standard Delivery API request header.
637
+ # @param parent [::String]
638
+ # Required. Must be in the format `providers/{provider}`. The `provider` must
639
+ # be the Google Cloud Project ID. For example, `sample-cloud-project`.
640
+ # @param task_id [::String]
641
+ # Required. The Task ID must be unique, but it should be not a shipment
642
+ # tracking ID. To store a shipment tracking ID, use the `tracking_id` field.
643
+ # Note that multiple tasks can have the same `tracking_id`. Task IDs are
644
+ # subject to the following restrictions:
645
+ #
646
+ # * Must be a valid Unicode string.
647
+ # * Limited to a maximum length of 64 characters.
648
+ # * Normalized according to [Unicode Normalization Form C]
649
+ # (http://www.unicode.org/reports/tr15/).
650
+ # * May not contain any of the following ASCII characters: '/', ':', '?',
651
+ # ',', or '#'.
652
+ # @param task [::Google::Maps::FleetEngine::Delivery::V1::Task, ::Hash]
653
+ # Required. The Task entity to create.
654
+ # When creating a Task, the following fields are required:
655
+ #
656
+ # * `type`
657
+ # * `state` (must be set to `OPEN`)
658
+ # * `tracking_id` (must not be set for `UNAVAILABLE` or `SCHEDULED_STOP`
659
+ # tasks, but required for all other task types)
660
+ # * `planned_location` (optional for `UNAVAILABLE` tasks)
661
+ # * `task_duration`
662
+ #
663
+ # Note: The Task's `name` field is ignored. All other Task fields must not be
664
+ # set; otherwise, an error is returned.
665
+ #
666
+ # @yield [response, operation] Access the result along with the RPC operation
667
+ # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::Task]
668
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
669
+ #
670
+ # @return [::Google::Maps::FleetEngine::Delivery::V1::Task]
671
+ #
672
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
673
+ #
674
+ # @example Basic example
675
+ # require "google/maps/fleet_engine/delivery/v1"
676
+ #
677
+ # # Create a client object. The client can be reused for multiple calls.
678
+ # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
679
+ #
680
+ # # Create a request. To set request fields, pass in keyword arguments.
681
+ # request = Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest.new
682
+ #
683
+ # # Call the create_task method.
684
+ # result = client.create_task request
685
+ #
686
+ # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task.
687
+ # p result
688
+ #
689
+ def create_task request, options = nil
690
+ raise ::ArgumentError, "request must be provided" if request.nil?
691
+
692
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::CreateTaskRequest
693
+
694
+ # Converts hash and nil to an options object
695
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
696
+
697
+ # Customize the options with defaults
698
+ metadata = @config.rpcs.create_task.metadata.to_h
699
+
700
+ # Set x-goog-api-client and x-goog-user-project headers
701
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
702
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
703
+ gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
704
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
705
+
706
+ header_params = {}
707
+ if request.parent &&
708
+ %r{^providers/[^/]+/?$}.match?(request.parent)
709
+ header_params["provider_id"] = request.parent
710
+ end
711
+
712
+ request_params_header = URI.encode_www_form header_params
713
+ metadata[:"x-goog-request-params"] ||= request_params_header
714
+
715
+ options.apply_defaults timeout: @config.rpcs.create_task.timeout,
716
+ metadata: metadata,
717
+ retry_policy: @config.rpcs.create_task.retry_policy
718
+
719
+ options.apply_defaults timeout: @config.timeout,
720
+ metadata: @config.metadata,
721
+ retry_policy: @config.retry_policy
722
+
723
+ @delivery_service_stub.call_rpc :create_task, request, options: options do |response, operation|
724
+ yield response, operation if block_given?
725
+ return response
726
+ end
727
+ rescue ::GRPC::BadStatus => e
728
+ raise ::Google::Cloud::Error.from_error(e)
729
+ end
730
+
731
+ ##
732
+ # Gets information about a `Task`.
733
+ #
734
+ # @overload get_task(request, options = nil)
735
+ # Pass arguments to `get_task` via a request object, either of type
736
+ # {::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest} or an equivalent Hash.
737
+ #
738
+ # @param request [::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest, ::Hash]
739
+ # A request object representing the call parameters. Required. To specify no
740
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
741
+ # @param options [::Gapic::CallOptions, ::Hash]
742
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
743
+ #
744
+ # @overload get_task(header: nil, name: nil)
745
+ # Pass arguments to `get_task` via keyword arguments. Note that at
746
+ # least one keyword argument is required. To specify no parameters, or to keep all
747
+ # the default parameter values, pass an empty Hash as a request object (see above).
748
+ #
749
+ # @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
750
+ # Optional. The standard Delivery API request header.
751
+ # @param name [::String]
752
+ # Required. Must be in the format `providers/{provider}/tasks/{task}`. The
753
+ # `provider` must be the Google Cloud Project ID. For example,
754
+ # `sample-cloud-project`.
755
+ #
756
+ # @yield [response, operation] Access the result along with the RPC operation
757
+ # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::Task]
758
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
759
+ #
760
+ # @return [::Google::Maps::FleetEngine::Delivery::V1::Task]
761
+ #
762
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
763
+ #
764
+ # @example Basic example
765
+ # require "google/maps/fleet_engine/delivery/v1"
766
+ #
767
+ # # Create a client object. The client can be reused for multiple calls.
768
+ # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
769
+ #
770
+ # # Create a request. To set request fields, pass in keyword arguments.
771
+ # request = Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest.new
772
+ #
773
+ # # Call the get_task method.
774
+ # result = client.get_task request
775
+ #
776
+ # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task.
777
+ # p result
778
+ #
779
+ def get_task request, options = nil
780
+ raise ::ArgumentError, "request must be provided" if request.nil?
781
+
782
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::GetTaskRequest
783
+
784
+ # Converts hash and nil to an options object
785
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
786
+
787
+ # Customize the options with defaults
788
+ metadata = @config.rpcs.get_task.metadata.to_h
789
+
790
+ # Set x-goog-api-client and x-goog-user-project headers
791
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
792
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
793
+ gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
794
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
795
+
796
+ header_params = {}
797
+ if request.name &&
798
+ %r{^providers/[^/]+/?$}.match?(request.name)
799
+ header_params["provider_id"] = request.name
800
+ end
801
+
802
+ request_params_header = URI.encode_www_form header_params
803
+ metadata[:"x-goog-request-params"] ||= request_params_header
804
+
805
+ options.apply_defaults timeout: @config.rpcs.get_task.timeout,
806
+ metadata: metadata,
807
+ retry_policy: @config.rpcs.get_task.retry_policy
808
+
809
+ options.apply_defaults timeout: @config.timeout,
810
+ metadata: @config.metadata,
811
+ retry_policy: @config.retry_policy
812
+
813
+ @delivery_service_stub.call_rpc :get_task, request, options: options do |response, operation|
814
+ yield response, operation if block_given?
815
+ return response
816
+ end
817
+ rescue ::GRPC::BadStatus => e
818
+ raise ::Google::Cloud::Error.from_error(e)
819
+ end
820
+
821
+ ##
822
+ # Deprecated: Use `GetTaskTrackingInfo` instead.
823
+ #
824
+ # @deprecated This method is deprecated and may be removed in the next major version update.
825
+ #
826
+ # @overload search_tasks(request, options = nil)
827
+ # Pass arguments to `search_tasks` via a request object, either of type
828
+ # {::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest} or an equivalent Hash.
829
+ #
830
+ # @param request [::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest, ::Hash]
831
+ # A request object representing the call parameters. Required. To specify no
832
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
833
+ # @param options [::Gapic::CallOptions, ::Hash]
834
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
835
+ #
836
+ # @overload search_tasks(header: nil, parent: nil, tracking_id: nil, page_size: nil, page_token: nil)
837
+ # Pass arguments to `search_tasks` via keyword arguments. Note that at
838
+ # least one keyword argument is required. To specify no parameters, or to keep all
839
+ # the default parameter values, pass an empty Hash as a request object (see above).
840
+ #
841
+ # @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
842
+ # Optional. The standard Delivery API request header.
843
+ # @param parent [::String]
844
+ # Required. Must be in the format `providers/{provider}`.
845
+ # The provider must be the Google Cloud Project ID. For example,
846
+ # `sample-cloud-project`.
847
+ # @param tracking_id [::String]
848
+ # Required. The identifier of the set of related Tasks being requested.
849
+ # Tracking IDs are subject to the following restrictions:
850
+ #
851
+ # * Must be a valid Unicode string.
852
+ # * Limited to a maximum length of 64 characters.
853
+ # * Normalized according to [Unicode Normalization Form C]
854
+ # (http://www.unicode.org/reports/tr15/).
855
+ # * May not contain any of the following ASCII characters: '/', ':', '?',
856
+ # ',', or '#'.
857
+ # @param page_size [::Integer]
858
+ # Optional. The maximum number of Tasks to return. The service may return
859
+ # fewer than this value. If you don't specify this value, then the server
860
+ # determines the number of results to return.
861
+ # @param page_token [::String]
862
+ # Optional. A page token, received from a previous `SearchTasks` call. You
863
+ # must provide this value to retrieve the subsequent page.
864
+ #
865
+ # When paginating, all other parameters provided to `SearchTasks` must match
866
+ # the call that provided the page token.
867
+ #
868
+ # @yield [response, operation] Access the result along with the RPC operation
869
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>]
870
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
871
+ #
872
+ # @return [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>]
873
+ #
874
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
875
+ #
876
+ # @example Basic example
877
+ # require "google/maps/fleet_engine/delivery/v1"
878
+ #
879
+ # # Create a client object. The client can be reused for multiple calls.
880
+ # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
881
+ #
882
+ # # Create a request. To set request fields, pass in keyword arguments.
883
+ # request = Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest.new
884
+ #
885
+ # # Call the search_tasks method.
886
+ # result = client.search_tasks request
887
+ #
888
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
889
+ # # over elements, and API calls will be issued to fetch pages as needed.
890
+ # result.each do |item|
891
+ # # Each element is of type ::Google::Maps::FleetEngine::Delivery::V1::Task.
892
+ # p item
893
+ # end
894
+ #
895
+ def search_tasks request, options = nil
896
+ raise ::ArgumentError, "request must be provided" if request.nil?
897
+
898
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::SearchTasksRequest
899
+
900
+ # Converts hash and nil to an options object
901
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
902
+
903
+ # Customize the options with defaults
904
+ metadata = @config.rpcs.search_tasks.metadata.to_h
905
+
906
+ # Set x-goog-api-client and x-goog-user-project headers
907
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
908
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
909
+ gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
910
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
911
+
912
+ header_params = {}
913
+ if request.parent &&
914
+ %r{^providers/[^/]+/?$}.match?(request.parent)
915
+ header_params["provider_id"] = request.parent
916
+ end
917
+
918
+ request_params_header = URI.encode_www_form header_params
919
+ metadata[:"x-goog-request-params"] ||= request_params_header
920
+
921
+ options.apply_defaults timeout: @config.rpcs.search_tasks.timeout,
922
+ metadata: metadata,
923
+ retry_policy: @config.rpcs.search_tasks.retry_policy
924
+
925
+ options.apply_defaults timeout: @config.timeout,
926
+ metadata: @config.metadata,
927
+ retry_policy: @config.retry_policy
928
+
929
+ @delivery_service_stub.call_rpc :search_tasks, request, options: options do |response, operation|
930
+ response = ::Gapic::PagedEnumerable.new @delivery_service_stub, :search_tasks, request, response, operation, options
931
+ yield response, operation if block_given?
932
+ return response
933
+ end
934
+ rescue ::GRPC::BadStatus => e
935
+ raise ::Google::Cloud::Error.from_error(e)
936
+ end
937
+
938
+ ##
939
+ # Updates `Task` data.
940
+ #
941
+ # @overload update_task(request, options = nil)
942
+ # Pass arguments to `update_task` via a request object, either of type
943
+ # {::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest} or an equivalent Hash.
944
+ #
945
+ # @param request [::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest, ::Hash]
946
+ # A request object representing the call parameters. Required. To specify no
947
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
948
+ # @param options [::Gapic::CallOptions, ::Hash]
949
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
950
+ #
951
+ # @overload update_task(header: nil, task: nil, update_mask: nil)
952
+ # Pass arguments to `update_task` via keyword arguments. Note that at
953
+ # least one keyword argument is required. To specify no parameters, or to keep all
954
+ # the default parameter values, pass an empty Hash as a request object (see above).
955
+ #
956
+ # @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
957
+ # Optional. The standard Delivery API request header.
958
+ # @param task [::Google::Maps::FleetEngine::Delivery::V1::Task, ::Hash]
959
+ # Required. The Task associated with the update.
960
+ # The following fields are maintained by Fleet Engine. Do not update
961
+ # them using `Task.update`.
962
+ #
963
+ # * `last_location`.
964
+ # * `last_location_snappable`.
965
+ # * `name`.
966
+ # * `remaining_vehicle_journey_segments`.
967
+ # * `task_outcome_location_source`.
968
+ #
969
+ # Note: You cannot change the value of `task_outcome` once you set it.
970
+ #
971
+ # If the Task has been assigned to a delivery vehicle, then don't set the
972
+ # Task state to CLOSED using `Task.update`. Instead, remove the `VehicleStop`
973
+ # that contains the Task from the delivery vehicle, which automatically sets
974
+ # the Task state to CLOSED.
975
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
976
+ # Required. The field mask that indicates which Task fields to update.
977
+ # Note: The `update_mask` must contain at least one field.
978
+ #
979
+ # This is a comma-separated list of fully qualified names of fields. Example:
980
+ # `"task_outcome,task_outcome_time,task_outcome_location"`.
981
+ #
982
+ # @yield [response, operation] Access the result along with the RPC operation
983
+ # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::Task]
984
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
985
+ #
986
+ # @return [::Google::Maps::FleetEngine::Delivery::V1::Task]
987
+ #
988
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
989
+ #
990
+ # @example Basic example
991
+ # require "google/maps/fleet_engine/delivery/v1"
992
+ #
993
+ # # Create a client object. The client can be reused for multiple calls.
994
+ # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
995
+ #
996
+ # # Create a request. To set request fields, pass in keyword arguments.
997
+ # request = Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest.new
998
+ #
999
+ # # Call the update_task method.
1000
+ # result = client.update_task request
1001
+ #
1002
+ # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::Task.
1003
+ # p result
1004
+ #
1005
+ def update_task request, options = nil
1006
+ raise ::ArgumentError, "request must be provided" if request.nil?
1007
+
1008
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::UpdateTaskRequest
1009
+
1010
+ # Converts hash and nil to an options object
1011
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1012
+
1013
+ # Customize the options with defaults
1014
+ metadata = @config.rpcs.update_task.metadata.to_h
1015
+
1016
+ # Set x-goog-api-client and x-goog-user-project headers
1017
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1018
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1019
+ gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
1020
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1021
+
1022
+ header_params = {}
1023
+ if request.task&.name &&
1024
+ %r{^providers/[^/]+/?$}.match?(request.task.name)
1025
+ header_params["provider_id"] = request.task.name
1026
+ end
1027
+
1028
+ request_params_header = URI.encode_www_form header_params
1029
+ metadata[:"x-goog-request-params"] ||= request_params_header
1030
+
1031
+ options.apply_defaults timeout: @config.rpcs.update_task.timeout,
1032
+ metadata: metadata,
1033
+ retry_policy: @config.rpcs.update_task.retry_policy
1034
+
1035
+ options.apply_defaults timeout: @config.timeout,
1036
+ metadata: @config.metadata,
1037
+ retry_policy: @config.retry_policy
1038
+
1039
+ @delivery_service_stub.call_rpc :update_task, request, options: options do |response, operation|
1040
+ yield response, operation if block_given?
1041
+ return response
1042
+ end
1043
+ rescue ::GRPC::BadStatus => e
1044
+ raise ::Google::Cloud::Error.from_error(e)
1045
+ end
1046
+
1047
+ ##
1048
+ # Gets all `Task`s that meet the specified filtering criteria.
1049
+ #
1050
+ # @overload list_tasks(request, options = nil)
1051
+ # Pass arguments to `list_tasks` via a request object, either of type
1052
+ # {::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest} or an equivalent Hash.
1053
+ #
1054
+ # @param request [::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest, ::Hash]
1055
+ # A request object representing the call parameters. Required. To specify no
1056
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1057
+ # @param options [::Gapic::CallOptions, ::Hash]
1058
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1059
+ #
1060
+ # @overload list_tasks(header: nil, parent: nil, page_size: nil, page_token: nil, filter: nil)
1061
+ # Pass arguments to `list_tasks` via keyword arguments. Note that at
1062
+ # least one keyword argument is required. To specify no parameters, or to keep all
1063
+ # the default parameter values, pass an empty Hash as a request object (see above).
1064
+ #
1065
+ # @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
1066
+ # Optional. The standard Delivery API request header.
1067
+ # @param parent [::String]
1068
+ # Required. Must be in the format `providers/{provider}`.
1069
+ # The `provider` must be the Google Cloud Project ID. For example,
1070
+ # `sample-cloud-project`.
1071
+ # @param page_size [::Integer]
1072
+ # Optional. The maximum number of Tasks to return. The service may return
1073
+ # fewer than this value. If you don't specify this value, then the server
1074
+ # determines the number of results to return.
1075
+ # @param page_token [::String]
1076
+ # Optional. A page token received from a previous `ListTasks` call.
1077
+ # You can provide this to retrieve the subsequent page.
1078
+ #
1079
+ # When paginating, all other parameters provided to `ListTasks` must match
1080
+ # the call that provided the page token.
1081
+ # @param filter [::String]
1082
+ # Optional. A filter query to apply when listing Tasks. See
1083
+ # http://aip.dev/160 for examples of filter syntax. If you don't specify a
1084
+ # value, or if you filter on an empty string, then all Tasks are returned.
1085
+ # For information about the Task properties that you can filter on, see [List
1086
+ # tasks](https://developers.google.com/maps/documentation/transportation-logistics/last-mile-fleet-solution/fleet-performance/fleet-engine/deliveries_api#list-tasks).
1087
+ #
1088
+ # @yield [response, operation] Access the result along with the RPC operation
1089
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>]
1090
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1091
+ #
1092
+ # @return [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::Task>]
1093
+ #
1094
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1095
+ #
1096
+ # @example Basic example
1097
+ # require "google/maps/fleet_engine/delivery/v1"
1098
+ #
1099
+ # # Create a client object. The client can be reused for multiple calls.
1100
+ # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
1101
+ #
1102
+ # # Create a request. To set request fields, pass in keyword arguments.
1103
+ # request = Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest.new
1104
+ #
1105
+ # # Call the list_tasks method.
1106
+ # result = client.list_tasks request
1107
+ #
1108
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1109
+ # # over elements, and API calls will be issued to fetch pages as needed.
1110
+ # result.each do |item|
1111
+ # # Each element is of type ::Google::Maps::FleetEngine::Delivery::V1::Task.
1112
+ # p item
1113
+ # end
1114
+ #
1115
+ def list_tasks request, options = nil
1116
+ raise ::ArgumentError, "request must be provided" if request.nil?
1117
+
1118
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::ListTasksRequest
1119
+
1120
+ # Converts hash and nil to an options object
1121
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1122
+
1123
+ # Customize the options with defaults
1124
+ metadata = @config.rpcs.list_tasks.metadata.to_h
1125
+
1126
+ # Set x-goog-api-client and x-goog-user-project headers
1127
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1128
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1129
+ gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
1130
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1131
+
1132
+ header_params = {}
1133
+ if request.parent &&
1134
+ %r{^providers/[^/]+/?$}.match?(request.parent)
1135
+ header_params["provider_id"] = request.parent
1136
+ end
1137
+
1138
+ request_params_header = URI.encode_www_form header_params
1139
+ metadata[:"x-goog-request-params"] ||= request_params_header
1140
+
1141
+ options.apply_defaults timeout: @config.rpcs.list_tasks.timeout,
1142
+ metadata: metadata,
1143
+ retry_policy: @config.rpcs.list_tasks.retry_policy
1144
+
1145
+ options.apply_defaults timeout: @config.timeout,
1146
+ metadata: @config.metadata,
1147
+ retry_policy: @config.retry_policy
1148
+
1149
+ @delivery_service_stub.call_rpc :list_tasks, request, options: options do |response, operation|
1150
+ response = ::Gapic::PagedEnumerable.new @delivery_service_stub, :list_tasks, request, response, operation, options
1151
+ yield response, operation if block_given?
1152
+ return response
1153
+ end
1154
+ rescue ::GRPC::BadStatus => e
1155
+ raise ::Google::Cloud::Error.from_error(e)
1156
+ end
1157
+
1158
+ ##
1159
+ # Returns the specified `TaskTrackingInfo` instance.
1160
+ #
1161
+ # @overload get_task_tracking_info(request, options = nil)
1162
+ # Pass arguments to `get_task_tracking_info` via a request object, either of type
1163
+ # {::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest} or an equivalent Hash.
1164
+ #
1165
+ # @param request [::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest, ::Hash]
1166
+ # A request object representing the call parameters. Required. To specify no
1167
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1168
+ # @param options [::Gapic::CallOptions, ::Hash]
1169
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1170
+ #
1171
+ # @overload get_task_tracking_info(header: nil, name: nil)
1172
+ # Pass arguments to `get_task_tracking_info` via keyword arguments. Note that at
1173
+ # least one keyword argument is required. To specify no parameters, or to keep all
1174
+ # the default parameter values, pass an empty Hash as a request object (see above).
1175
+ #
1176
+ # @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
1177
+ # Optional. The standard Delivery API request header.
1178
+ # @param name [::String]
1179
+ # Required. Must be in the format
1180
+ # `providers/{provider}/taskTrackingInfo/{tracking_id}`. The `provider`
1181
+ # must be the Google Cloud Project ID, and the `tracking_id` must be the
1182
+ # tracking ID associated with the task. An example name can be
1183
+ # `providers/sample-cloud-project/taskTrackingInfo/sample-tracking-id`.
1184
+ #
1185
+ # @yield [response, operation] Access the result along with the RPC operation
1186
+ # @yieldparam response [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo]
1187
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1188
+ #
1189
+ # @return [::Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo]
1190
+ #
1191
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1192
+ #
1193
+ # @example Basic example
1194
+ # require "google/maps/fleet_engine/delivery/v1"
1195
+ #
1196
+ # # Create a client object. The client can be reused for multiple calls.
1197
+ # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
1198
+ #
1199
+ # # Create a request. To set request fields, pass in keyword arguments.
1200
+ # request = Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest.new
1201
+ #
1202
+ # # Call the get_task_tracking_info method.
1203
+ # result = client.get_task_tracking_info request
1204
+ #
1205
+ # # The returned object is of type Google::Maps::FleetEngine::Delivery::V1::TaskTrackingInfo.
1206
+ # p result
1207
+ #
1208
+ def get_task_tracking_info request, options = nil
1209
+ raise ::ArgumentError, "request must be provided" if request.nil?
1210
+
1211
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::GetTaskTrackingInfoRequest
1212
+
1213
+ # Converts hash and nil to an options object
1214
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1215
+
1216
+ # Customize the options with defaults
1217
+ metadata = @config.rpcs.get_task_tracking_info.metadata.to_h
1218
+
1219
+ # Set x-goog-api-client and x-goog-user-project headers
1220
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1221
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1222
+ gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
1223
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1224
+
1225
+ header_params = {}
1226
+ if request.name &&
1227
+ %r{^providers/[^/]+/?$}.match?(request.name)
1228
+ header_params["provider_id"] = request.name
1229
+ end
1230
+
1231
+ request_params_header = URI.encode_www_form header_params
1232
+ metadata[:"x-goog-request-params"] ||= request_params_header
1233
+
1234
+ options.apply_defaults timeout: @config.rpcs.get_task_tracking_info.timeout,
1235
+ metadata: metadata,
1236
+ retry_policy: @config.rpcs.get_task_tracking_info.retry_policy
1237
+
1238
+ options.apply_defaults timeout: @config.timeout,
1239
+ metadata: @config.metadata,
1240
+ retry_policy: @config.retry_policy
1241
+
1242
+ @delivery_service_stub.call_rpc :get_task_tracking_info, request, options: options do |response, operation|
1243
+ yield response, operation if block_given?
1244
+ return response
1245
+ end
1246
+ rescue ::GRPC::BadStatus => e
1247
+ raise ::Google::Cloud::Error.from_error(e)
1248
+ end
1249
+
1250
+ ##
1251
+ # Gets all `DeliveryVehicle`s that meet the specified filtering criteria.
1252
+ #
1253
+ # @overload list_delivery_vehicles(request, options = nil)
1254
+ # Pass arguments to `list_delivery_vehicles` via a request object, either of type
1255
+ # {::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest} or an equivalent Hash.
1256
+ #
1257
+ # @param request [::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest, ::Hash]
1258
+ # A request object representing the call parameters. Required. To specify no
1259
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1260
+ # @param options [::Gapic::CallOptions, ::Hash]
1261
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1262
+ #
1263
+ # @overload list_delivery_vehicles(header: nil, parent: nil, page_size: nil, page_token: nil, filter: nil, viewport: nil)
1264
+ # Pass arguments to `list_delivery_vehicles` via keyword arguments. Note that at
1265
+ # least one keyword argument is required. To specify no parameters, or to keep all
1266
+ # the default parameter values, pass an empty Hash as a request object (see above).
1267
+ #
1268
+ # @param header [::Google::Maps::FleetEngine::Delivery::V1::DeliveryRequestHeader, ::Hash]
1269
+ # Optional. The standard Delivery API request header.
1270
+ # @param parent [::String]
1271
+ # Required. Must be in the format `providers/{provider}`.
1272
+ # The `provider` must be the Google Cloud Project ID.
1273
+ # For example, `sample-cloud-project`.
1274
+ # @param page_size [::Integer]
1275
+ # Optional. The maximum number of vehicles to return. The service may return
1276
+ # fewer than this number. If you don't specify this number, then the server
1277
+ # determines the number of results to return.
1278
+ # @param page_token [::String]
1279
+ # Optional. A page token, received from a previous `ListDeliveryVehicles`
1280
+ # call. You must provide this in order to retrieve the subsequent page.
1281
+ #
1282
+ # When paginating, all other parameters provided to `ListDeliveryVehicles`
1283
+ # must match the call that provided the page token.
1284
+ # @param filter [::String]
1285
+ # Optional. A filter query to apply when listing delivery vehicles. See
1286
+ # http://aip.dev/160 for examples of the filter syntax. If you don't specify
1287
+ # a value, or if you specify an empty string for the filter, then all
1288
+ # delivery vehicles are returned.
1289
+ #
1290
+ # Note that the only queries supported for `ListDeliveryVehicles` are
1291
+ # on vehicle attributes (for example, `attributes.<key> = <value>` or
1292
+ # `attributes.<key1> = <value1> AND attributes.<key2> = <value2>`). Also, all
1293
+ # attributes are stored as strings, so the only supported comparisons against
1294
+ # attributes are string comparisons. In order to compare against number or
1295
+ # boolean values, the values must be explicitly quoted to be treated as
1296
+ # strings (for example, `attributes.<key> = "10"` or
1297
+ # `attributes.<key> = "true"`).
1298
+ #
1299
+ # The maximum number of restrictions allowed in a filter query is 50. A
1300
+ # restriction is a part of the query of the form
1301
+ # `attribute.<KEY> <COMPARATOR> <VALUE>`, for example `attributes.foo = bar`
1302
+ # is 1 restriction.
1303
+ # @param viewport [::Google::Geo::Type::Viewport, ::Hash]
1304
+ # Optional. A filter that limits the vehicles returned to those whose last
1305
+ # known location was in the rectangular area defined by the viewport.
1306
+ #
1307
+ # @yield [response, operation] Access the result along with the RPC operation
1308
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle>]
1309
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1310
+ #
1311
+ # @return [::Gapic::PagedEnumerable<::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle>]
1312
+ #
1313
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1314
+ #
1315
+ # @example Basic example
1316
+ # require "google/maps/fleet_engine/delivery/v1"
1317
+ #
1318
+ # # Create a client object. The client can be reused for multiple calls.
1319
+ # client = Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new
1320
+ #
1321
+ # # Create a request. To set request fields, pass in keyword arguments.
1322
+ # request = Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest.new
1323
+ #
1324
+ # # Call the list_delivery_vehicles method.
1325
+ # result = client.list_delivery_vehicles request
1326
+ #
1327
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1328
+ # # over elements, and API calls will be issued to fetch pages as needed.
1329
+ # result.each do |item|
1330
+ # # Each element is of type ::Google::Maps::FleetEngine::Delivery::V1::DeliveryVehicle.
1331
+ # p item
1332
+ # end
1333
+ #
1334
+ def list_delivery_vehicles request, options = nil
1335
+ raise ::ArgumentError, "request must be provided" if request.nil?
1336
+
1337
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::Delivery::V1::ListDeliveryVehiclesRequest
1338
+
1339
+ # Converts hash and nil to an options object
1340
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1341
+
1342
+ # Customize the options with defaults
1343
+ metadata = @config.rpcs.list_delivery_vehicles.metadata.to_h
1344
+
1345
+ # Set x-goog-api-client and x-goog-user-project headers
1346
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1347
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1348
+ gapic_version: ::Google::Maps::FleetEngine::Delivery::V1::VERSION
1349
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1350
+
1351
+ header_params = {}
1352
+ if request.parent &&
1353
+ %r{^providers/[^/]+/?$}.match?(request.parent)
1354
+ header_params["provider_id"] = request.parent
1355
+ end
1356
+
1357
+ request_params_header = URI.encode_www_form header_params
1358
+ metadata[:"x-goog-request-params"] ||= request_params_header
1359
+
1360
+ options.apply_defaults timeout: @config.rpcs.list_delivery_vehicles.timeout,
1361
+ metadata: metadata,
1362
+ retry_policy: @config.rpcs.list_delivery_vehicles.retry_policy
1363
+
1364
+ options.apply_defaults timeout: @config.timeout,
1365
+ metadata: @config.metadata,
1366
+ retry_policy: @config.retry_policy
1367
+
1368
+ @delivery_service_stub.call_rpc :list_delivery_vehicles, request, options: options do |response, operation|
1369
+ response = ::Gapic::PagedEnumerable.new @delivery_service_stub, :list_delivery_vehicles, request, response, operation, options
1370
+ yield response, operation if block_given?
1371
+ return response
1372
+ end
1373
+ rescue ::GRPC::BadStatus => e
1374
+ raise ::Google::Cloud::Error.from_error(e)
1375
+ end
1376
+
1377
+ ##
1378
+ # Configuration class for the DeliveryService API.
1379
+ #
1380
+ # This class represents the configuration for DeliveryService,
1381
+ # providing control over timeouts, retry behavior, logging, transport
1382
+ # parameters, and other low-level controls. Certain parameters can also be
1383
+ # applied individually to specific RPCs. See
1384
+ # {::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client::Configuration::Rpcs}
1385
+ # for a list of RPCs that can be configured independently.
1386
+ #
1387
+ # Configuration can be applied globally to all clients, or to a single client
1388
+ # on construction.
1389
+ #
1390
+ # @example
1391
+ #
1392
+ # # Modify the global config, setting the timeout for
1393
+ # # create_delivery_vehicle to 20 seconds,
1394
+ # # and all remaining timeouts to 10 seconds.
1395
+ # ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.configure do |config|
1396
+ # config.timeout = 10.0
1397
+ # config.rpcs.create_delivery_vehicle.timeout = 20.0
1398
+ # end
1399
+ #
1400
+ # # Apply the above configuration only to a new client.
1401
+ # client = ::Google::Maps::FleetEngine::Delivery::V1::DeliveryService::Client.new do |config|
1402
+ # config.timeout = 10.0
1403
+ # config.rpcs.create_delivery_vehicle.timeout = 20.0
1404
+ # end
1405
+ #
1406
+ # @!attribute [rw] endpoint
1407
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1408
+ # nil, indicating to use the default endpoint in the current universe domain.
1409
+ # @return [::String,nil]
1410
+ # @!attribute [rw] credentials
1411
+ # Credentials to send with calls. You may provide any of the following types:
1412
+ # * (`String`) The path to a service account key file in JSON format
1413
+ # * (`Hash`) A service account key as a Hash
1414
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1415
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1416
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1417
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1418
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1419
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1420
+ # * (`nil`) indicating no credentials
1421
+ # @return [::Object]
1422
+ # @!attribute [rw] scope
1423
+ # The OAuth scopes
1424
+ # @return [::Array<::String>]
1425
+ # @!attribute [rw] lib_name
1426
+ # The library name as recorded in instrumentation and logging
1427
+ # @return [::String]
1428
+ # @!attribute [rw] lib_version
1429
+ # The library version as recorded in instrumentation and logging
1430
+ # @return [::String]
1431
+ # @!attribute [rw] channel_args
1432
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1433
+ # `GRPC::Core::Channel` object is provided as the credential.
1434
+ # @return [::Hash]
1435
+ # @!attribute [rw] interceptors
1436
+ # An array of interceptors that are run before calls are executed.
1437
+ # @return [::Array<::GRPC::ClientInterceptor>]
1438
+ # @!attribute [rw] timeout
1439
+ # The call timeout in seconds.
1440
+ # @return [::Numeric]
1441
+ # @!attribute [rw] metadata
1442
+ # Additional gRPC headers to be sent with the call.
1443
+ # @return [::Hash{::Symbol=>::String}]
1444
+ # @!attribute [rw] retry_policy
1445
+ # The retry policy. The value is a hash with the following keys:
1446
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1447
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1448
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1449
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1450
+ # trigger a retry.
1451
+ # @return [::Hash]
1452
+ # @!attribute [rw] quota_project
1453
+ # A separate project against which to charge quota.
1454
+ # @return [::String]
1455
+ # @!attribute [rw] universe_domain
1456
+ # The universe domain within which to make requests. This determines the
1457
+ # default endpoint URL. The default value of nil uses the environment
1458
+ # universe (usually the default "googleapis.com" universe).
1459
+ # @return [::String,nil]
1460
+ #
1461
+ class Configuration
1462
+ extend ::Gapic::Config
1463
+
1464
+ # @private
1465
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1466
+ DEFAULT_ENDPOINT = "fleetengine.googleapis.com"
1467
+
1468
+ config_attr :endpoint, nil, ::String, nil
1469
+ config_attr :credentials, nil do |value|
1470
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1471
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1472
+ allowed.any? { |klass| klass === value }
1473
+ end
1474
+ config_attr :scope, nil, ::String, ::Array, nil
1475
+ config_attr :lib_name, nil, ::String, nil
1476
+ config_attr :lib_version, nil, ::String, nil
1477
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1478
+ config_attr :interceptors, nil, ::Array, nil
1479
+ config_attr :timeout, nil, ::Numeric, nil
1480
+ config_attr :metadata, nil, ::Hash, nil
1481
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1482
+ config_attr :quota_project, nil, ::String, nil
1483
+ config_attr :universe_domain, nil, ::String, nil
1484
+
1485
+ # @private
1486
+ def initialize parent_config = nil
1487
+ @parent_config = parent_config unless parent_config.nil?
1488
+
1489
+ yield self if block_given?
1490
+ end
1491
+
1492
+ ##
1493
+ # Configurations for individual RPCs
1494
+ # @return [Rpcs]
1495
+ #
1496
+ def rpcs
1497
+ @rpcs ||= begin
1498
+ parent_rpcs = nil
1499
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1500
+ Rpcs.new parent_rpcs
1501
+ end
1502
+ end
1503
+
1504
+ ##
1505
+ # Configuration for the channel pool
1506
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
1507
+ #
1508
+ def channel_pool
1509
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
1510
+ end
1511
+
1512
+ ##
1513
+ # Configuration RPC class for the DeliveryService API.
1514
+ #
1515
+ # Includes fields providing the configuration for each RPC in this service.
1516
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1517
+ # the following configuration fields:
1518
+ #
1519
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1520
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1521
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1522
+ # include the following keys:
1523
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1524
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1525
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1526
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1527
+ # trigger a retry.
1528
+ #
1529
+ class Rpcs
1530
+ ##
1531
+ # RPC-specific configuration for `create_delivery_vehicle`
1532
+ # @return [::Gapic::Config::Method]
1533
+ #
1534
+ attr_reader :create_delivery_vehicle
1535
+ ##
1536
+ # RPC-specific configuration for `get_delivery_vehicle`
1537
+ # @return [::Gapic::Config::Method]
1538
+ #
1539
+ attr_reader :get_delivery_vehicle
1540
+ ##
1541
+ # RPC-specific configuration for `update_delivery_vehicle`
1542
+ # @return [::Gapic::Config::Method]
1543
+ #
1544
+ attr_reader :update_delivery_vehicle
1545
+ ##
1546
+ # RPC-specific configuration for `batch_create_tasks`
1547
+ # @return [::Gapic::Config::Method]
1548
+ #
1549
+ attr_reader :batch_create_tasks
1550
+ ##
1551
+ # RPC-specific configuration for `create_task`
1552
+ # @return [::Gapic::Config::Method]
1553
+ #
1554
+ attr_reader :create_task
1555
+ ##
1556
+ # RPC-specific configuration for `get_task`
1557
+ # @return [::Gapic::Config::Method]
1558
+ #
1559
+ attr_reader :get_task
1560
+ ##
1561
+ # RPC-specific configuration for `search_tasks`
1562
+ # @return [::Gapic::Config::Method]
1563
+ #
1564
+ attr_reader :search_tasks
1565
+ ##
1566
+ # RPC-specific configuration for `update_task`
1567
+ # @return [::Gapic::Config::Method]
1568
+ #
1569
+ attr_reader :update_task
1570
+ ##
1571
+ # RPC-specific configuration for `list_tasks`
1572
+ # @return [::Gapic::Config::Method]
1573
+ #
1574
+ attr_reader :list_tasks
1575
+ ##
1576
+ # RPC-specific configuration for `get_task_tracking_info`
1577
+ # @return [::Gapic::Config::Method]
1578
+ #
1579
+ attr_reader :get_task_tracking_info
1580
+ ##
1581
+ # RPC-specific configuration for `list_delivery_vehicles`
1582
+ # @return [::Gapic::Config::Method]
1583
+ #
1584
+ attr_reader :list_delivery_vehicles
1585
+
1586
+ # @private
1587
+ def initialize parent_rpcs = nil
1588
+ create_delivery_vehicle_config = parent_rpcs.create_delivery_vehicle if parent_rpcs.respond_to? :create_delivery_vehicle
1589
+ @create_delivery_vehicle = ::Gapic::Config::Method.new create_delivery_vehicle_config
1590
+ get_delivery_vehicle_config = parent_rpcs.get_delivery_vehicle if parent_rpcs.respond_to? :get_delivery_vehicle
1591
+ @get_delivery_vehicle = ::Gapic::Config::Method.new get_delivery_vehicle_config
1592
+ update_delivery_vehicle_config = parent_rpcs.update_delivery_vehicle if parent_rpcs.respond_to? :update_delivery_vehicle
1593
+ @update_delivery_vehicle = ::Gapic::Config::Method.new update_delivery_vehicle_config
1594
+ batch_create_tasks_config = parent_rpcs.batch_create_tasks if parent_rpcs.respond_to? :batch_create_tasks
1595
+ @batch_create_tasks = ::Gapic::Config::Method.new batch_create_tasks_config
1596
+ create_task_config = parent_rpcs.create_task if parent_rpcs.respond_to? :create_task
1597
+ @create_task = ::Gapic::Config::Method.new create_task_config
1598
+ get_task_config = parent_rpcs.get_task if parent_rpcs.respond_to? :get_task
1599
+ @get_task = ::Gapic::Config::Method.new get_task_config
1600
+ search_tasks_config = parent_rpcs.search_tasks if parent_rpcs.respond_to? :search_tasks
1601
+ @search_tasks = ::Gapic::Config::Method.new search_tasks_config
1602
+ update_task_config = parent_rpcs.update_task if parent_rpcs.respond_to? :update_task
1603
+ @update_task = ::Gapic::Config::Method.new update_task_config
1604
+ list_tasks_config = parent_rpcs.list_tasks if parent_rpcs.respond_to? :list_tasks
1605
+ @list_tasks = ::Gapic::Config::Method.new list_tasks_config
1606
+ get_task_tracking_info_config = parent_rpcs.get_task_tracking_info if parent_rpcs.respond_to? :get_task_tracking_info
1607
+ @get_task_tracking_info = ::Gapic::Config::Method.new get_task_tracking_info_config
1608
+ list_delivery_vehicles_config = parent_rpcs.list_delivery_vehicles if parent_rpcs.respond_to? :list_delivery_vehicles
1609
+ @list_delivery_vehicles = ::Gapic::Config::Method.new list_delivery_vehicles_config
1610
+
1611
+ yield self if block_given?
1612
+ end
1613
+ end
1614
+ end
1615
+ end
1616
+ end
1617
+ end
1618
+ end
1619
+ end
1620
+ end
1621
+ end