google-cloud-dialogflow-v2 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/AUTHENTICATION.md +4 -4
  4. data/LICENSE.md +190 -188
  5. data/README.md +2 -2
  6. data/lib/google/cloud/dialogflow/v2/agents/client.rb +32 -2
  7. data/lib/google/cloud/dialogflow/v2/agents/credentials.rb +0 -1
  8. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +0 -1
  9. data/lib/google/cloud/dialogflow/v2/agents/paths.rb +2 -0
  10. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +47 -7
  11. data/lib/google/cloud/dialogflow/v2/contexts/credentials.rb +0 -1
  12. data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +2 -0
  13. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +32 -2
  14. data/lib/google/cloud/dialogflow/v2/entity_types/credentials.rb +0 -1
  15. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +0 -1
  16. data/lib/google/cloud/dialogflow/v2/entity_types/paths.rb +2 -0
  17. data/lib/google/cloud/dialogflow/v2/intents/client.rb +36 -2
  18. data/lib/google/cloud/dialogflow/v2/intents/credentials.rb +0 -1
  19. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +0 -1
  20. data/lib/google/cloud/dialogflow/v2/intents/paths.rb +2 -0
  21. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +42 -9
  22. data/lib/google/cloud/dialogflow/v2/session_entity_types/credentials.rb +0 -1
  23. data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +2 -0
  24. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +16 -6
  25. data/lib/google/cloud/dialogflow/v2/sessions/credentials.rb +0 -1
  26. data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +2 -0
  27. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  28. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +6 -6
  29. data/proto_docs/google/cloud/dialogflow/v2/context.rb +32 -7
  30. data/proto_docs/google/cloud/dialogflow/v2/intent.rb +1 -0
  31. data/proto_docs/google/cloud/dialogflow/v2/session.rb +16 -8
  32. data/proto_docs/google/cloud/dialogflow/v2/session_entity_type.rb +26 -8
  33. metadata +8 -5
@@ -18,7 +18,6 @@
18
18
 
19
19
  require "googleauth"
20
20
 
21
-
22
21
  module Google
23
22
  module Cloud
24
23
  module Dialogflow
@@ -23,7 +23,6 @@ require "google/cloud/dialogflow/v2/version"
23
23
  require "google/cloud/dialogflow/v2/agents/client"
24
24
  require "google/longrunning/operations_pb"
25
25
 
26
-
27
26
  module Google
28
27
  module Cloud
29
28
  module Dialogflow
@@ -51,6 +51,8 @@ module Google
51
51
  def project_path project:
52
52
  "projects/#{project}"
53
53
  end
54
+
55
+ extend self
54
56
  end
55
57
  end
56
58
  end
@@ -26,13 +26,33 @@ require "google/cloud/dialogflow/v2/context_pb"
26
26
  require "google/cloud/dialogflow/v2/contexts/credentials"
27
27
  require "google/cloud/dialogflow/v2/contexts/paths"
28
28
 
29
-
30
29
  module Google
31
30
  module Cloud
32
31
  module Dialogflow
33
32
  module V2
34
33
  module Contexts
35
- # Service that implements Contexts API.
34
+ ##
35
+ # Client for the Contexts service.
36
+ #
37
+ # A context represents additional information included with user input or with
38
+ # an intent returned by the Dialogflow API. Contexts are helpful for
39
+ # differentiating user input which may be vague or have a different meaning
40
+ # depending on additional details from your application such as user setting
41
+ # and preferences, previous user input, where the user is in your application,
42
+ # geographic location, and so on.
43
+ #
44
+ # You can include contexts as input parameters of a
45
+ # {Google::Cloud::Dialogflow::V2::Sessions::Client#detect_intent DetectIntent} (or
46
+ # {Google::Cloud::Dialogflow::V2::Sessions::Client#streaming_detect_intent StreamingDetectIntent}) request,
47
+ # or as output contexts included in the returned intent.
48
+ # Contexts expire when an intent is matched, after the number of `DetectIntent`
49
+ # requests specified by the `lifespan_count` parameter, or after 20 minutes
50
+ # if no intents are matched for a `DetectIntent` request.
51
+ #
52
+ # For more information about contexts, see the
53
+ # [Dialogflow
54
+ # documentation](https://cloud.google.com/dialogflow/docs/contexts-overview).
55
+ #
36
56
  class Client
37
57
  include Paths
38
58
 
@@ -195,7 +215,11 @@ module Google
195
215
  # @overload list_contexts(parent: nil, page_size: nil, page_token: nil)
196
216
  # @param parent [String]
197
217
  # Required. The session to list all contexts from.
198
- # Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
218
+ # Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
219
+ # `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
220
+ # ID>/sessions/<Session ID>`.
221
+ # If `Environment ID` is not specified, we assume default 'draft'
222
+ # environment. If `User ID` is not specified, we assume default '-' user.
199
223
  # @param page_size [Integer]
200
224
  # Optional. The maximum number of items to return in a single page. By
201
225
  # default 100 and at most 1000.
@@ -261,7 +285,11 @@ module Google
261
285
  # @overload get_context(name: nil)
262
286
  # @param name [String]
263
287
  # Required. The name of the context. Format:
264
- # `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
288
+ # `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`
289
+ # or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
290
+ # ID>/sessions/<Session ID>/contexts/<Context ID>`.
291
+ # If `Environment ID` is not specified, we assume default 'draft'
292
+ # environment. If `User ID` is not specified, we assume default '-' user.
265
293
  #
266
294
  #
267
295
  # @yield [response, operation] Access the result along with the RPC operation
@@ -325,7 +353,11 @@ module Google
325
353
  # @overload create_context(parent: nil, context: nil)
326
354
  # @param parent [String]
327
355
  # Required. The session to create a context for.
328
- # Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
356
+ # Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
357
+ # `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
358
+ # ID>/sessions/<Session ID>`.
359
+ # If `Environment ID` is not specified, we assume default 'draft'
360
+ # environment. If `User ID` is not specified, we assume default '-' user.
329
361
  # @param context [Google::Cloud::Dialogflow::V2::Context | Hash]
330
362
  # Required. The context to create.
331
363
  #
@@ -448,7 +480,11 @@ module Google
448
480
  # @overload delete_context(name: nil)
449
481
  # @param name [String]
450
482
  # Required. The name of the context to delete. Format:
451
- # `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
483
+ # `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`
484
+ # or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
485
+ # ID>/sessions/<Session ID>/contexts/<Context ID>`.
486
+ # If `Environment ID` is not specified, we assume default 'draft'
487
+ # environment. If `User ID` is not specified, we assume default '-' user.
452
488
  #
453
489
  #
454
490
  # @yield [response, operation] Access the result along with the RPC operation
@@ -508,7 +544,11 @@ module Google
508
544
  # @overload delete_all_contexts(parent: nil)
509
545
  # @param parent [String]
510
546
  # Required. The name of the session to delete all contexts from. Format:
511
- # `projects/<Project ID>/agent/sessions/<Session ID>`.
547
+ # `projects/<Project ID>/agent/sessions/<Session ID>` or `projects/<Project
548
+ # ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session
549
+ # ID>`.
550
+ # If `Environment ID` is not specified we assume default 'draft' environment.
551
+ # If `User ID` is not specified, we assume default '-' user.
512
552
  #
513
553
  #
514
554
  # @yield [response, operation] Access the result along with the RPC operation
@@ -18,7 +18,6 @@
18
18
 
19
19
  require "googleauth"
20
20
 
21
-
22
21
  module Google
23
22
  module Cloud
24
23
  module Dialogflow
@@ -42,6 +42,8 @@ module Google
42
42
 
43
43
  "projects/#{project}/agent/sessions/#{session}/contexts/#{context}"
44
44
  end
45
+
46
+ extend self
45
47
  end
46
48
  end
47
49
  end
@@ -27,13 +27,43 @@ require "google/cloud/dialogflow/v2/entity_types/credentials"
27
27
  require "google/cloud/dialogflow/v2/entity_types/paths"
28
28
  require "google/cloud/dialogflow/v2/entity_types/operations"
29
29
 
30
-
31
30
  module Google
32
31
  module Cloud
33
32
  module Dialogflow
34
33
  module V2
35
34
  module EntityTypes
36
- # Service that implements EntityTypes API.
35
+ ##
36
+ # Client for the EntityTypes service.
37
+ #
38
+ # Entities are extracted from user input and represent parameters that are
39
+ # meaningful to your application. For example, a date range, a proper name
40
+ # such as a geographic location or landmark, and so on. Entities represent
41
+ # actionable data for your application.
42
+ #
43
+ # When you define an entity, you can also include synonyms that all map to
44
+ # that entity. For example, "soft drink", "soda", "pop", and so on.
45
+ #
46
+ # There are three types of entities:
47
+ #
48
+ # * **System** - entities that are defined by the Dialogflow API for common
49
+ # data types such as date, time, currency, and so on. A system entity is
50
+ # represented by the `EntityType` type.
51
+ #
52
+ # * **Custom** - entities that are defined by you that represent
53
+ # actionable data that is meaningful to your application. For example,
54
+ # you could define a `pizza.sauce` entity for red or white pizza sauce,
55
+ # a `pizza.cheese` entity for the different types of cheese on a pizza,
56
+ # a `pizza.topping` entity for different toppings, and so on. A custom
57
+ # entity is represented by the `EntityType` type.
58
+ #
59
+ # * **User** - entities that are built for an individual user such as
60
+ # favorites, preferences, playlists, and so on. A user entity is
61
+ # represented by the {Google::Cloud::Dialogflow::V2::SessionEntityType SessionEntityType} type.
62
+ #
63
+ # For more information about entity types, see the
64
+ # [Dialogflow
65
+ # documentation](https://cloud.google.com/dialogflow/docs/entities-overview).
66
+ #
37
67
  class Client
38
68
  include Paths
39
69
 
@@ -18,7 +18,6 @@
18
18
 
19
19
  require "googleauth"
20
20
 
21
-
22
21
  module Google
23
22
  module Cloud
24
23
  module Dialogflow
@@ -23,7 +23,6 @@ require "google/cloud/dialogflow/v2/version"
23
23
  require "google/cloud/dialogflow/v2/entity_types/client"
24
24
  require "google/longrunning/operations_pb"
25
25
 
26
-
27
26
  module Google
28
27
  module Cloud
29
28
  module Dialogflow
@@ -54,6 +54,8 @@ module Google
54
54
 
55
55
  "projects/#{project}/agent/entityTypes/#{entity_type}"
56
56
  end
57
+
58
+ extend self
57
59
  end
58
60
  end
59
61
  end
@@ -27,13 +27,47 @@ require "google/cloud/dialogflow/v2/intents/credentials"
27
27
  require "google/cloud/dialogflow/v2/intents/paths"
28
28
  require "google/cloud/dialogflow/v2/intents/operations"
29
29
 
30
-
31
30
  module Google
32
31
  module Cloud
33
32
  module Dialogflow
34
33
  module V2
35
34
  module Intents
36
- # Service that implements Intents API.
35
+ ##
36
+ # Client for the Intents service.
37
+ #
38
+ # An intent represents a mapping between input from a user and an action to
39
+ # be taken by your application. When you pass user input to the
40
+ # {Google::Cloud::Dialogflow::V2::Sessions::Client#detect_intent DetectIntent} (or
41
+ # {Google::Cloud::Dialogflow::V2::Sessions::Client#streaming_detect_intent StreamingDetectIntent}) method, the
42
+ # Dialogflow API analyzes the input and searches
43
+ # for a matching intent. If no match is found, the Dialogflow API returns a
44
+ # fallback intent (`is_fallback` = true).
45
+ #
46
+ # You can provide additional information for the Dialogflow API to use to
47
+ # match user input to an intent by adding the following to your intent.
48
+ #
49
+ # * **Contexts** - provide additional context for intent analysis. For
50
+ # example, if an intent is related to an object in your application that
51
+ # plays music, you can provide a context to determine when to match the
52
+ # intent if the user input is "turn it off". You can include a context
53
+ # that matches the intent when there is previous user input of
54
+ # "play music", and not when there is previous user input of
55
+ # "turn on the light".
56
+ #
57
+ # * **Events** - allow for matching an intent by using an event name
58
+ # instead of user input. Your application can provide an event name and
59
+ # related parameters to the Dialogflow API to match an intent. For
60
+ # example, when your application starts, you can send a welcome event
61
+ # with a user name parameter to the Dialogflow API to match an intent with
62
+ # a personalized welcome message for the user.
63
+ #
64
+ # * **Training phrases** - provide examples of user input to train the
65
+ # Dialogflow API agent to better match intents.
66
+ #
67
+ # For more information about intents, see the
68
+ # [Dialogflow
69
+ # documentation](https://cloud.google.com/dialogflow/docs/intents-overview).
70
+ #
37
71
  class Client
38
72
  include Paths
39
73
 
@@ -18,7 +18,6 @@
18
18
 
19
19
  require "googleauth"
20
20
 
21
-
22
21
  module Google
23
22
  module Cloud
24
23
  module Dialogflow
@@ -23,7 +23,6 @@ require "google/cloud/dialogflow/v2/version"
23
23
  require "google/cloud/dialogflow/v2/intents/client"
24
24
  require "google/longrunning/operations_pb"
25
25
 
26
-
27
26
  module Google
28
27
  module Cloud
29
28
  module Dialogflow
@@ -73,6 +73,8 @@ module Google
73
73
 
74
74
  "projects/#{project}/agent/intents/#{intent}"
75
75
  end
76
+
77
+ extend self
76
78
  end
77
79
  end
78
80
  end
@@ -26,13 +26,32 @@ require "google/cloud/dialogflow/v2/session_entity_type_pb"
26
26
  require "google/cloud/dialogflow/v2/session_entity_types/credentials"
27
27
  require "google/cloud/dialogflow/v2/session_entity_types/paths"
28
28
 
29
-
30
29
  module Google
31
30
  module Cloud
32
31
  module Dialogflow
33
32
  module V2
34
33
  module SessionEntityTypes
35
- # Service that implements SessionEntityTypes API.
34
+ ##
35
+ # Client for the SessionEntityTypes service.
36
+ #
37
+ # Entities are extracted from user input and represent parameters that are
38
+ # meaningful to your application. For example, a date range, a proper name
39
+ # such as a geographic location or landmark, and so on. Entities represent
40
+ # actionable data for your application.
41
+ #
42
+ # Session entity types are referred to as **User** entity types and are
43
+ # entities that are built for an individual user such as
44
+ # favorites, preferences, playlists, and so on. You can redefine a session
45
+ # entity type at the session level.
46
+ #
47
+ # Session entity methods do not work with Google Assistant integration.
48
+ # Contact Dialogflow support if you need to use session entities
49
+ # with Google Assistant integration.
50
+ #
51
+ # For more information about entity types, see the
52
+ # [Dialogflow
53
+ # documentation](https://cloud.google.com/dialogflow/docs/entities-overview).
54
+ #
36
55
  class Client
37
56
  include Paths
38
57
 
@@ -195,7 +214,11 @@ module Google
195
214
  # @overload list_session_entity_types(parent: nil, page_size: nil, page_token: nil)
196
215
  # @param parent [String]
197
216
  # Required. The session to list all session entity types from.
198
- # Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
217
+ # Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
218
+ # `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/
219
+ # sessions/<Session ID>`.
220
+ # If `Environment ID` is not specified, we assume default 'draft'
221
+ # environment. If `User ID` is not specified, we assume default '-' user.
199
222
  # @param page_size [Integer]
200
223
  # Optional. The maximum number of items to return in a single page. By
201
224
  # default 100 and at most 1000.
@@ -270,7 +293,11 @@ module Google
270
293
  # @param name [String]
271
294
  # Required. The name of the session entity type. Format:
272
295
  # `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
273
- # Display Name>`.
296
+ # Display Name>` or `projects/<Project ID>/agent/environments/<Environment
297
+ # ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display
298
+ # Name>`.
299
+ # If `Environment ID` is not specified, we assume default 'draft'
300
+ # environment. If `User ID` is not specified, we assume default '-' user.
274
301
  #
275
302
  #
276
303
  # @yield [response, operation] Access the result along with the RPC operation
@@ -344,7 +371,11 @@ module Google
344
371
  # @overload create_session_entity_type(parent: nil, session_entity_type: nil)
345
372
  # @param parent [String]
346
373
  # Required. The session to create a session entity type for.
347
- # Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
374
+ # Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
375
+ # `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/
376
+ # sessions/<Session ID>`.
377
+ # If `Environment ID` is not specified, we assume default 'draft'
378
+ # environment. If `User ID` is not specified, we assume default '-' user.
348
379
  # @param session_entity_type [Google::Cloud::Dialogflow::V2::SessionEntityType | Hash]
349
380
  # Required. The session entity type to create.
350
381
  #
@@ -413,9 +444,7 @@ module Google
413
444
  #
414
445
  # @overload update_session_entity_type(session_entity_type: nil, update_mask: nil)
415
446
  # @param session_entity_type [Google::Cloud::Dialogflow::V2::SessionEntityType | Hash]
416
- # Required. The entity type to update. Format:
417
- # `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
418
- # Display Name>`.
447
+ # Required. The session entity type to update.
419
448
  # @param update_mask [Google::Protobuf::FieldMask | Hash]
420
449
  # Optional. The mask to control which fields get updated.
421
450
  #
@@ -486,7 +515,11 @@ module Google
486
515
  # @param name [String]
487
516
  # Required. The name of the entity type to delete. Format:
488
517
  # `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
489
- # Display Name>`.
518
+ # Display Name>` or `projects/<Project ID>/agent/environments/<Environment
519
+ # ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display
520
+ # Name>`.
521
+ # If `Environment ID` is not specified, we assume default 'draft'
522
+ # environment. If `User ID` is not specified, we assume default '-' user.
490
523
  #
491
524
  #
492
525
  # @yield [response, operation] Access the result along with the RPC operation
@@ -18,7 +18,6 @@
18
18
 
19
19
  require "googleauth"
20
20
 
21
-
22
21
  module Google
23
22
  module Cloud
24
23
  module Dialogflow
@@ -61,6 +61,8 @@ module Google
61
61
 
62
62
  "projects/#{project}/agent/sessions/#{session}/entityTypes/#{entity_type}"
63
63
  end
64
+
65
+ extend self
64
66
  end
65
67
  end
66
68
  end
@@ -26,13 +26,19 @@ require "google/cloud/dialogflow/v2/session_pb"
26
26
  require "google/cloud/dialogflow/v2/sessions/credentials"
27
27
  require "google/cloud/dialogflow/v2/sessions/paths"
28
28
 
29
-
30
29
  module Google
31
30
  module Cloud
32
31
  module Dialogflow
33
32
  module V2
34
33
  module Sessions
35
- # Service that implements Sessions API.
34
+ ##
35
+ # Client for the Sessions service.
36
+ #
37
+ # A session represents an interaction with a user. You retrieve user input
38
+ # and pass it to the {Google::Cloud::Dialogflow::V2::Sessions::Client#detect_intent DetectIntent} (or
39
+ # {Google::Cloud::Dialogflow::V2::Sessions::Client#streaming_detect_intent StreamingDetectIntent}) method to determine
40
+ # user intent and respond.
41
+ #
36
42
  class Client
37
43
  include Paths
38
44
 
@@ -169,10 +175,14 @@ module Google
169
175
  # @overload detect_intent(session: nil, query_params: nil, query_input: nil, output_audio_config: nil, output_audio_config_mask: nil, input_audio: nil)
170
176
  # @param session [String]
171
177
  # Required. The name of the session this query is sent to. Format:
172
- # `projects/<Project ID>/agent/sessions/<Session ID>`. It's up to the API
173
- # caller to choose an appropriate session ID. It can be a random number or
174
- # some type of user identifier (preferably hashed). The length of the session
175
- # ID must not exceed 36 bytes.
178
+ # `projects/<Project ID>/agent/sessions/<Session ID>`, or
179
+ # `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
180
+ # ID>/sessions/<Session ID>`. If `Environment ID` is not specified, we assume
181
+ # default 'draft' environment. If `User ID` is not specified, we are using
182
+ # "-". It's up to the API caller to choose an appropriate `Session ID` and
183
+ # `User Id`. They can be a random number or some type of user and session
184
+ # identifiers (preferably hashed). The length of the `Session ID` and
185
+ # `User ID` must not exceed 36 characters.
176
186
  # @param query_params [Google::Cloud::Dialogflow::V2::QueryParameters | Hash]
177
187
  # The parameters of this query.
178
188
  # @param query_input [Google::Cloud::Dialogflow::V2::QueryInput | Hash]