Skip to content
This repository was archived by the owner on Dec 17, 2023. It is now read-only.

Commit 713846b

Browse files
authored
feat(dialogflow): add MediaContent, BrowseCarouselCard, ColumnPropertiesin v2; add SpeechContext, SpeechWordInfoin v2; add enable_word_info, speech_contexts,model to InputAudioConfig in v2; add subtitles to Intent.Message.ListSelect in v2beta1; add language_code to ListKnowledgeBase in v2beta1; add webhook_headers to QueryParameters in v2beta1 (#175)
1 parent 94e0252 commit 713846b

File tree

73 files changed

+3113
-740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+3113
-740
lines changed

dialogflow_v2/__init__.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -16,6 +16,8 @@
1616

1717

1818
from __future__ import absolute_import
19+
import sys
20+
import warnings
1921

2022
from dialogflow_v2 import types
2123
from dialogflow_v2.gapic import agents_client
@@ -27,6 +29,15 @@
2729
from dialogflow_v2.gapic import sessions_client
2830

2931

32+
if sys.version_info[:2] == (2, 7):
33+
message = (
34+
"A future version of this library will drop support for Python 2.7."
35+
"More details about Python 2 support for Google Cloud Client Libraries"
36+
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
37+
)
38+
warnings.warn(message, DeprecationWarning)
39+
40+
3041
class AgentsClient(agents_client.AgentsClient):
3142
__doc__ = agents_client.AgentsClient.__doc__
3243
enums = enums

dialogflow_v2/gapic/agents_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

dialogflow_v2/gapic/contexts_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

dialogflow_v2/gapic/entity_types_client.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -68,12 +68,12 @@ class EntityTypesClient(object):
6868
common data types such as date, time, currency, and so on. A system
6969
entity is represented by the ``EntityType`` type.
7070
71-
- **Developer** - entities that are defined by you that represent
71+
- **Custom** - entities that are defined by you that represent
7272
actionable data that is meaningful to your application. For example,
7373
you could define a ``pizza.sauce`` entity for red or white pizza
7474
sauce, a ``pizza.cheese`` entity for the different types of cheese on
7575
a pizza, a ``pizza.topping`` entity for different toppings, and so
76-
on. A developer entity is represented by the ``EntityType`` type.
76+
on. A custom entity is represented by the ``EntityType`` type.
7777
7878
- **User** - entities that are built for an individual user such as
7979
favorites, preferences, playlists, and so on. A user entity is
@@ -1138,7 +1138,7 @@ def batch_delete_entities(
11381138
Args:
11391139
parent (str): Required. The name of the entity type to delete entries for. Format:
11401140
``projects/<Project ID>/agent/entityTypes/<Entity Type ID>``.
1141-
entity_values (list[str]): Required. The canonical ``values`` of the entities to delete. Note that
1141+
entity_values (list[str]): Required. The reference ``values`` of the entities to delete. Note that
11421142
these are not fully-qualified names, i.e. they don't start with
11431143
``projects/<Project ID>``.
11441144
language_code (str): Optional. The language of entity synonyms defined in ``entities``. If

dialogflow_v2/gapic/enums.py

+86-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -103,7 +103,7 @@ class OutputAudioEncoding(enum.IntEnum):
103103
OUTPUT_AUDIO_ENCODING_UNSPECIFIED (int): Not specified.
104104
OUTPUT_AUDIO_ENCODING_LINEAR_16 (int): Uncompressed 16-bit signed little-endian samples (Linear PCM).
105105
Audio content returned as LINEAR16 also contains a WAV header.
106-
OUTPUT_AUDIO_ENCODING_MP3 (int): MP3 audio.
106+
OUTPUT_AUDIO_ENCODING_MP3 (int): MP3 audio at 32kbps.
107107
OUTPUT_AUDIO_ENCODING_OGG_OPUS (int): Opus encoded audio wrapped in an ogg container. The result will be a
108108
file which can be played natively on Android, and in browsers (at least
109109
Chrome and Firefox). The quality of the encoding is considerably higher
@@ -206,7 +206,7 @@ class MatchMode(enum.IntEnum):
206206
MATCH_MODE_HYBRID (int): Best for agents with a small number of examples in intents and/or wide
207207
use of templates syntax and composite entities.
208208
MATCH_MODE_ML_ONLY (int): Can be used for agents with a large number of examples in intents,
209-
especially the ones using @sys.any or very large developer entities.
209+
especially the ones using @sys.any or very large custom entities.
210210
"""
211211

212212
MATCH_MODE_UNSPECIFIED = 0
@@ -252,9 +252,9 @@ class Kind(enum.IntEnum):
252252
253253
Attributes:
254254
KIND_UNSPECIFIED (int): Not specified. This value should be never used.
255-
KIND_MAP (int): Map entity types allow mapping of a group of synonyms to a canonical
255+
KIND_MAP (int): Map entity types allow mapping of a group of synonyms to a reference
256256
value.
257-
KIND_LIST (int): List entity types contain a set of entries that do not map to canonical
257+
KIND_LIST (int): List entity types contain a set of entries that do not map to reference
258258
values. However, list entity types can contain references to other entity
259259
types (with or without aliases).
260260
KIND_REGEXP (int): Regexp entity types allow to specify regular expressions in entries
@@ -393,6 +393,83 @@ class Platform(enum.IntEnum):
393393
ACTIONS_ON_GOOGLE = 8
394394
GOOGLE_HANGOUTS = 11
395395

396+
class MediaContent(object):
397+
class ResponseMediaType(enum.IntEnum):
398+
"""
399+
Format of response media type.
400+
401+
Attributes:
402+
RESPONSE_MEDIA_TYPE_UNSPECIFIED (int): Unspecified.
403+
AUDIO (int): Response media type is audio.
404+
"""
405+
406+
RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0
407+
AUDIO = 1
408+
409+
class BrowseCarouselCard(object):
410+
class ImageDisplayOptions(enum.IntEnum):
411+
"""
412+
Image display options for Actions on Google. This should be used for
413+
when the image's aspect ratio does not match the image container's
414+
aspect ratio.
415+
416+
Attributes:
417+
IMAGE_DISPLAY_OPTIONS_UNSPECIFIED (int): Fill the gaps between the image and the image container with gray
418+
bars.
419+
GRAY (int): Fill the gaps between the image and the image container with gray
420+
bars.
421+
WHITE (int): Fill the gaps between the image and the image container with white
422+
bars.
423+
CROPPED (int): Image is scaled such that the image width and height match or exceed
424+
the container dimensions. This may crop the top and bottom of the
425+
image if the scaled image height is greater than the container
426+
height, or crop the left and right of the image if the scaled image
427+
width is greater than the container width. This is similar to "Zoom
428+
Mode" on a widescreen TV when playing a 4:3 video.
429+
BLURRED_BACKGROUND (int): Pad the gaps between image and image frame with a blurred copy of the
430+
same image.
431+
"""
432+
433+
IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0
434+
GRAY = 1
435+
WHITE = 2
436+
CROPPED = 3
437+
BLURRED_BACKGROUND = 4
438+
439+
class BrowseCarouselCardItem(object):
440+
class OpenUrlAction(object):
441+
class UrlTypeHint(enum.IntEnum):
442+
"""
443+
Type of the URI.
444+
445+
Attributes:
446+
URL_TYPE_HINT_UNSPECIFIED (int): Unspecified
447+
AMP_ACTION (int): Url would be an amp action
448+
AMP_CONTENT (int): URL that points directly to AMP content, or to a canonical URL
449+
which refers to AMP content via <link rel="amphtml">.
450+
"""
451+
452+
URL_TYPE_HINT_UNSPECIFIED = 0
453+
AMP_ACTION = 1
454+
AMP_CONTENT = 2
455+
456+
class ColumnProperties(object):
457+
class HorizontalAlignment(enum.IntEnum):
458+
"""
459+
Text alignments within a cell.
460+
461+
Attributes:
462+
HORIZONTAL_ALIGNMENT_UNSPECIFIED (int): Text is aligned to the leading edge of the column.
463+
LEADING (int): Text is aligned to the leading edge of the column.
464+
CENTER (int): Text is centered in the column.
465+
TRAILING (int): Text is aligned to the trailing edge of the column.
466+
"""
467+
468+
HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0
469+
LEADING = 1
470+
CENTER = 2
471+
TRAILING = 3
472+
396473

397474
class SessionEntityType(object):
398475
class EntityOverrideMode(enum.IntEnum):
@@ -402,16 +479,16 @@ class EntityOverrideMode(enum.IntEnum):
402479
Attributes:
403480
ENTITY_OVERRIDE_MODE_UNSPECIFIED (int): Not specified. This value should be never used.
404481
ENTITY_OVERRIDE_MODE_OVERRIDE (int): The collection of session entities overrides the collection of entities
405-
in the corresponding developer entity type.
482+
in the corresponding custom entity type.
406483
ENTITY_OVERRIDE_MODE_SUPPLEMENT (int): The collection of session entities extends the collection of entities in
407-
the corresponding developer entity type.
484+
the corresponding custom entity type.
408485
409486
Note: Even in this override mode calls to ``ListSessionEntityTypes``,
410487
``GetSessionEntityType``, ``CreateSessionEntityType`` and
411488
``UpdateSessionEntityType`` only return the additional entities added in
412489
this session entity type. If you want to get the supplemented list,
413-
please call ``EntityTypes.GetEntityType`` on the developer entity type
414-
and merge.
490+
please call ``EntityTypes.GetEntityType`` on the custom entity type and
491+
merge.
415492
"""
416493

417494
ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0

dialogflow_v2/gapic/intents_client.py

+12-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -541,7 +541,7 @@ def create_intent(
541541
def update_intent(
542542
self,
543543
intent,
544-
language_code,
544+
language_code=None,
545545
update_mask=None,
546546
intent_view=None,
547547
retry=google.api_core.gapic_v1.method.DEFAULT,
@@ -559,10 +559,7 @@ def update_intent(
559559
>>> # TODO: Initialize `intent`:
560560
>>> intent = {}
561561
>>>
562-
>>> # TODO: Initialize `language_code`:
563-
>>> language_code = ''
564-
>>>
565-
>>> response = client.update_intent(intent, language_code)
562+
>>> response = client.update_intent(intent)
566563
567564
Args:
568565
intent (Union[dict, ~google.cloud.dialogflow_v2.types.Intent]): Required. The intent to update.
@@ -704,9 +701,9 @@ def delete_intent(
704701
def batch_update_intents(
705702
self,
706703
parent,
707-
language_code,
708704
intent_batch_uri=None,
709705
intent_batch_inline=None,
706+
language_code=None,
710707
update_mask=None,
711708
intent_view=None,
712709
retry=google.api_core.gapic_v1.method.DEFAULT,
@@ -725,10 +722,7 @@ def batch_update_intents(
725722
>>>
726723
>>> parent = client.project_agent_path('[PROJECT]')
727724
>>>
728-
>>> # TODO: Initialize `language_code`:
729-
>>> language_code = ''
730-
>>>
731-
>>> response = client.batch_update_intents(parent, language_code)
725+
>>> response = client.batch_update_intents(parent)
732726
>>>
733727
>>> def callback(operation_future):
734728
... # Handle result.
@@ -742,19 +736,19 @@ def batch_update_intents(
742736
Args:
743737
parent (str): Required. The name of the agent to update or create intents in. Format:
744738
``projects/<Project ID>/agent``.
745-
language_code (str): Optional. The language of training phrases, parameters and rich messages
746-
defined in ``intents``. If not specified, the agent's default language
747-
is used. `Many
748-
languages <https://cloud.google.com/dialogflow/docs/reference/language>`__
749-
are supported. Note: languages must be enabled in the agent before they
750-
can be used.
751739
intent_batch_uri (str): The URI to a Google Cloud Storage file containing intents to update or
752740
create. The file format can either be a serialized proto (of IntentBatch
753741
type) or JSON object. Note: The URI must start with "gs://".
754742
intent_batch_inline (Union[dict, ~google.cloud.dialogflow_v2.types.IntentBatch]): The collection of intents to update or create.
755743
756744
If a dict is provided, it must be of the same form as the protobuf
757745
message :class:`~google.cloud.dialogflow_v2.types.IntentBatch`
746+
language_code (str): Optional. The language of training phrases, parameters and rich messages
747+
defined in ``intents``. If not specified, the agent's default language
748+
is used. `Many
749+
languages <https://cloud.google.com/dialogflow/docs/reference/language>`__
750+
are supported. Note: languages must be enabled in the agent before they
751+
can be used.
758752
update_mask (Union[dict, ~google.cloud.dialogflow_v2.types.FieldMask]): Optional. The mask to control which fields get updated.
759753
760754
If a dict is provided, it must be of the same form as the protobuf
@@ -798,9 +792,9 @@ def batch_update_intents(
798792

799793
request = intent_pb2.BatchUpdateIntentsRequest(
800794
parent=parent,
801-
language_code=language_code,
802795
intent_batch_uri=intent_batch_uri,
803796
intent_batch_inline=intent_batch_inline,
797+
language_code=language_code,
804798
update_mask=update_mask,
805799
intent_view=intent_view,
806800
)

dialogflow_v2/gapic/session_entity_types_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

dialogflow_v2/gapic/sessions_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

dialogflow_v2/gapic/transports/agents_grpc_transport.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

dialogflow_v2/gapic/transports/contexts_grpc_transport.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

dialogflow_v2/gapic/transports/entity_types_grpc_transport.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

dialogflow_v2/gapic/transports/intents_grpc_transport.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

dialogflow_v2/gapic/transports/session_entity_types_grpc_transport.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

dialogflow_v2/gapic/transports/sessions_grpc_transport.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)