Skip to content

Commit

Permalink
feat(dialogflow): add MediaContent, BrowseCarouselCard, `ColumnPr…
Browse files Browse the repository at this point in the history
…operties`in v2; add `SpeechContext`, `SpeechWordInfo`in 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)
  • Loading branch information
busunkim96 authored Feb 14, 2020
1 parent 6a1fa9d commit 81d9092
Show file tree
Hide file tree
Showing 73 changed files with 3,113 additions and 740 deletions.
13 changes: 12 additions & 1 deletion packages/google-cloud-dialogflow/dialogflow_v2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,8 @@


from __future__ import absolute_import
import sys
import warnings

from dialogflow_v2 import types
from dialogflow_v2.gapic import agents_client
Expand All @@ -27,6 +29,15 @@
from dialogflow_v2.gapic import sessions_client


if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7."
"More details about Python 2 support for Google Cloud Client Libraries"
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)


class AgentsClient(agents_client.AgentsClient):
__doc__ = agents_client.AgentsClient.__doc__
enums = enums
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -68,12 +68,12 @@ class EntityTypesClient(object):
common data types such as date, time, currency, and so on. A system
entity is represented by the ``EntityType`` type.
- **Developer** - entities that are defined by you that represent
- **Custom** - entities that are defined by you that represent
actionable data that is meaningful to your application. For example,
you could define a ``pizza.sauce`` entity for red or white pizza
sauce, a ``pizza.cheese`` entity for the different types of cheese on
a pizza, a ``pizza.topping`` entity for different toppings, and so
on. A developer entity is represented by the ``EntityType`` type.
on. A custom entity is represented by the ``EntityType`` type.
- **User** - entities that are built for an individual user such as
favorites, preferences, playlists, and so on. A user entity is
Expand Down Expand Up @@ -1138,7 +1138,7 @@ def batch_delete_entities(
Args:
parent (str): Required. The name of the entity type to delete entries for. Format:
``projects/<Project ID>/agent/entityTypes/<Entity Type ID>``.
entity_values (list[str]): Required. The canonical ``values`` of the entities to delete. Note that
entity_values (list[str]): Required. The reference ``values`` of the entities to delete. Note that
these are not fully-qualified names, i.e. they don't start with
``projects/<Project ID>``.
language_code (str): Optional. The language of entity synonyms defined in ``entities``. If
Expand Down
95 changes: 86 additions & 9 deletions packages/google-cloud-dialogflow/dialogflow_v2/gapic/enums.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -103,7 +103,7 @@ class OutputAudioEncoding(enum.IntEnum):
OUTPUT_AUDIO_ENCODING_UNSPECIFIED (int): Not specified.
OUTPUT_AUDIO_ENCODING_LINEAR_16 (int): Uncompressed 16-bit signed little-endian samples (Linear PCM).
Audio content returned as LINEAR16 also contains a WAV header.
OUTPUT_AUDIO_ENCODING_MP3 (int): MP3 audio.
OUTPUT_AUDIO_ENCODING_MP3 (int): MP3 audio at 32kbps.
OUTPUT_AUDIO_ENCODING_OGG_OPUS (int): Opus encoded audio wrapped in an ogg container. The result will be a
file which can be played natively on Android, and in browsers (at least
Chrome and Firefox). The quality of the encoding is considerably higher
Expand Down Expand Up @@ -206,7 +206,7 @@ class MatchMode(enum.IntEnum):
MATCH_MODE_HYBRID (int): Best for agents with a small number of examples in intents and/or wide
use of templates syntax and composite entities.
MATCH_MODE_ML_ONLY (int): Can be used for agents with a large number of examples in intents,
especially the ones using @sys.any or very large developer entities.
especially the ones using @sys.any or very large custom entities.
"""

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

class MediaContent(object):
class ResponseMediaType(enum.IntEnum):
"""
Format of response media type.
Attributes:
RESPONSE_MEDIA_TYPE_UNSPECIFIED (int): Unspecified.
AUDIO (int): Response media type is audio.
"""

RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0
AUDIO = 1

class BrowseCarouselCard(object):
class ImageDisplayOptions(enum.IntEnum):
"""
Image display options for Actions on Google. This should be used for
when the image's aspect ratio does not match the image container's
aspect ratio.
Attributes:
IMAGE_DISPLAY_OPTIONS_UNSPECIFIED (int): Fill the gaps between the image and the image container with gray
bars.
GRAY (int): Fill the gaps between the image and the image container with gray
bars.
WHITE (int): Fill the gaps between the image and the image container with white
bars.
CROPPED (int): Image is scaled such that the image width and height match or exceed
the container dimensions. This may crop the top and bottom of the
image if the scaled image height is greater than the container
height, or crop the left and right of the image if the scaled image
width is greater than the container width. This is similar to "Zoom
Mode" on a widescreen TV when playing a 4:3 video.
BLURRED_BACKGROUND (int): Pad the gaps between image and image frame with a blurred copy of the
same image.
"""

IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0
GRAY = 1
WHITE = 2
CROPPED = 3
BLURRED_BACKGROUND = 4

class BrowseCarouselCardItem(object):
class OpenUrlAction(object):
class UrlTypeHint(enum.IntEnum):
"""
Type of the URI.
Attributes:
URL_TYPE_HINT_UNSPECIFIED (int): Unspecified
AMP_ACTION (int): Url would be an amp action
AMP_CONTENT (int): URL that points directly to AMP content, or to a canonical URL
which refers to AMP content via <link rel="amphtml">.
"""

URL_TYPE_HINT_UNSPECIFIED = 0
AMP_ACTION = 1
AMP_CONTENT = 2

class ColumnProperties(object):
class HorizontalAlignment(enum.IntEnum):
"""
Text alignments within a cell.
Attributes:
HORIZONTAL_ALIGNMENT_UNSPECIFIED (int): Text is aligned to the leading edge of the column.
LEADING (int): Text is aligned to the leading edge of the column.
CENTER (int): Text is centered in the column.
TRAILING (int): Text is aligned to the trailing edge of the column.
"""

HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0
LEADING = 1
CENTER = 2
TRAILING = 3


class SessionEntityType(object):
class EntityOverrideMode(enum.IntEnum):
Expand All @@ -402,16 +479,16 @@ class EntityOverrideMode(enum.IntEnum):
Attributes:
ENTITY_OVERRIDE_MODE_UNSPECIFIED (int): Not specified. This value should be never used.
ENTITY_OVERRIDE_MODE_OVERRIDE (int): The collection of session entities overrides the collection of entities
in the corresponding developer entity type.
in the corresponding custom entity type.
ENTITY_OVERRIDE_MODE_SUPPLEMENT (int): The collection of session entities extends the collection of entities in
the corresponding developer entity type.
the corresponding custom entity type.
Note: Even in this override mode calls to ``ListSessionEntityTypes``,
``GetSessionEntityType``, ``CreateSessionEntityType`` and
``UpdateSessionEntityType`` only return the additional entities added in
this session entity type. If you want to get the supplemented list,
please call ``EntityTypes.GetEntityType`` on the developer entity type
and merge.
please call ``EntityTypes.GetEntityType`` on the custom entity type and
merge.
"""

ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -541,7 +541,7 @@ def create_intent(
def update_intent(
self,
intent,
language_code,
language_code=None,
update_mask=None,
intent_view=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
Expand All @@ -559,10 +559,7 @@ def update_intent(
>>> # TODO: Initialize `intent`:
>>> intent = {}
>>>
>>> # TODO: Initialize `language_code`:
>>> language_code = ''
>>>
>>> response = client.update_intent(intent, language_code)
>>> response = client.update_intent(intent)
Args:
intent (Union[dict, ~google.cloud.dialogflow_v2.types.Intent]): Required. The intent to update.
Expand Down Expand Up @@ -704,9 +701,9 @@ def delete_intent(
def batch_update_intents(
self,
parent,
language_code,
intent_batch_uri=None,
intent_batch_inline=None,
language_code=None,
update_mask=None,
intent_view=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
Expand All @@ -725,10 +722,7 @@ def batch_update_intents(
>>>
>>> parent = client.project_agent_path('[PROJECT]')
>>>
>>> # TODO: Initialize `language_code`:
>>> language_code = ''
>>>
>>> response = client.batch_update_intents(parent, language_code)
>>> response = client.batch_update_intents(parent)
>>>
>>> def callback(operation_future):
... # Handle result.
Expand All @@ -742,19 +736,19 @@ def batch_update_intents(
Args:
parent (str): Required. The name of the agent to update or create intents in. Format:
``projects/<Project ID>/agent``.
language_code (str): Optional. The language of training phrases, parameters and rich messages
defined in ``intents``. If not specified, the agent's default language
is used. `Many
languages <https://cloud.google.com/dialogflow/docs/reference/language>`__
are supported. Note: languages must be enabled in the agent before they
can be used.
intent_batch_uri (str): The URI to a Google Cloud Storage file containing intents to update or
create. The file format can either be a serialized proto (of IntentBatch
type) or JSON object. Note: The URI must start with "gs://".
intent_batch_inline (Union[dict, ~google.cloud.dialogflow_v2.types.IntentBatch]): The collection of intents to update or create.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.dialogflow_v2.types.IntentBatch`
language_code (str): Optional. The language of training phrases, parameters and rich messages
defined in ``intents``. If not specified, the agent's default language
is used. `Many
languages <https://cloud.google.com/dialogflow/docs/reference/language>`__
are supported. Note: languages must be enabled in the agent before they
can be used.
update_mask (Union[dict, ~google.cloud.dialogflow_v2.types.FieldMask]): Optional. The mask to control which fields get updated.
If a dict is provided, it must be of the same form as the protobuf
Expand Down Expand Up @@ -798,9 +792,9 @@ def batch_update_intents(

request = intent_pb2.BatchUpdateIntentsRequest(
parent=parent,
language_code=language_code,
intent_batch_uri=intent_batch_uri,
intent_batch_inline=intent_batch_inline,
language_code=language_code,
update_mask=update_mask,
intent_view=intent_view,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 81d9092

Please sign in to comment.