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

docs: add generated snippets #121

Merged
merged 7 commits into from
Feb 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,26 @@ async def suggest_queries(
r"""Gets a list of suggestions based on a prefix string.
AutoSuggestion tolerance should be less than 1 second.


.. code-block:: python

from google.cloud import dataqna_v1alpha

def sample_suggest_queries():
# Create a client
client = dataqna_v1alpha.AutoSuggestionServiceClient()

# Initialize request argument(s)
request = dataqna_v1alpha.SuggestQueriesRequest(
parent="parent_value",
)

# Make the request
response = client.suggest_queries(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.dataqna_v1alpha.types.SuggestQueriesRequest, dict]):
The request object. Request for query suggestions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,26 @@ def suggest_queries(
r"""Gets a list of suggestions based on a prefix string.
AutoSuggestion tolerance should be less than 1 second.


.. code-block:: python

from google.cloud import dataqna_v1alpha

def sample_suggest_queries():
# Create a client
client = dataqna_v1alpha.AutoSuggestionServiceClient()

# Initialize request argument(s)
request = dataqna_v1alpha.SuggestQueriesRequest(
parent="parent_value",
)

# Make the request
response = client.suggest_queries(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.dataqna_v1alpha.types.SuggestQueriesRequest, dict]):
The request object. Request for query suggestions.
Expand Down
105 changes: 105 additions & 0 deletions google/cloud/dataqna_v1alpha/services/question_service/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,25 @@ async def get_question(
) -> question.Question:
r"""Gets a previously created question.

.. code-block:: python

from google.cloud import dataqna_v1alpha

def sample_get_question():
# Create a client
client = dataqna_v1alpha.QuestionServiceClient()

# Initialize request argument(s)
request = dataqna_v1alpha.GetQuestionRequest(
name="name_value",
)

# Make the request
response = client.get_question(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.dataqna_v1alpha.types.GetQuestionRequest, dict]):
The request object. A request to get a previously
Expand Down Expand Up @@ -315,6 +334,30 @@ async def create_question(
) -> gcd_question.Question:
r"""Creates a question.

.. code-block:: python

from google.cloud import dataqna_v1alpha

def sample_create_question():
# Create a client
client = dataqna_v1alpha.QuestionServiceClient()

# Initialize request argument(s)
question = dataqna_v1alpha.Question()
question.scopes = ['scopes_value_1', 'scopes_value_2']
question.query = "query_value"

request = dataqna_v1alpha.CreateQuestionRequest(
parent="parent_value",
question=question,
)

# Make the request
response = client.create_question(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.dataqna_v1alpha.types.CreateQuestionRequest, dict]):
The request object. Request to create a question
Expand Down Expand Up @@ -398,6 +441,26 @@ async def execute_question(
) -> question.Question:
r"""Executes an interpretation.

.. code-block:: python

from google.cloud import dataqna_v1alpha

def sample_execute_question():
# Create a client
client = dataqna_v1alpha.QuestionServiceClient()

# Initialize request argument(s)
request = dataqna_v1alpha.ExecuteQuestionRequest(
name="name_value",
interpretation_index=2159,
)

# Make the request
response = client.execute_question(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.dataqna_v1alpha.types.ExecuteQuestionRequest, dict]):
The request object. Request to execute an
Expand Down Expand Up @@ -481,6 +544,25 @@ async def get_user_feedback(
) -> user_feedback.UserFeedback:
r"""Gets previously created user feedback.

.. code-block:: python

from google.cloud import dataqna_v1alpha

def sample_get_user_feedback():
# Create a client
client = dataqna_v1alpha.QuestionServiceClient()

# Initialize request argument(s)
request = dataqna_v1alpha.GetUserFeedbackRequest(
name="name_value",
)

# Make the request
response = client.get_user_feedback(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.dataqna_v1alpha.types.GetUserFeedbackRequest, dict]):
The request object. Request to get user feedback.
Expand Down Expand Up @@ -553,6 +635,29 @@ async def update_user_feedback(
r"""Updates user feedback. This creates user feedback if
there was none before (upsert).


.. code-block:: python

from google.cloud import dataqna_v1alpha

def sample_update_user_feedback():
# Create a client
client = dataqna_v1alpha.QuestionServiceClient()

# Initialize request argument(s)
user_feedback = dataqna_v1alpha.UserFeedback()
user_feedback.name = "name_value"

request = dataqna_v1alpha.UpdateUserFeedbackRequest(
user_feedback=user_feedback,
)

# Make the request
response = client.update_user_feedback(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.dataqna_v1alpha.types.UpdateUserFeedbackRequest, dict]):
The request object. Request to updates user feedback.
Expand Down
105 changes: 105 additions & 0 deletions google/cloud/dataqna_v1alpha/services/question_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,25 @@ def get_question(
) -> question.Question:
r"""Gets a previously created question.

.. code-block:: python

from google.cloud import dataqna_v1alpha

def sample_get_question():
# Create a client
client = dataqna_v1alpha.QuestionServiceClient()

# Initialize request argument(s)
request = dataqna_v1alpha.GetQuestionRequest(
name="name_value",
)

# Make the request
response = client.get_question(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.dataqna_v1alpha.types.GetQuestionRequest, dict]):
The request object. A request to get a previously
Expand Down Expand Up @@ -524,6 +543,30 @@ def create_question(
) -> gcd_question.Question:
r"""Creates a question.

.. code-block:: python

from google.cloud import dataqna_v1alpha

def sample_create_question():
# Create a client
client = dataqna_v1alpha.QuestionServiceClient()

# Initialize request argument(s)
question = dataqna_v1alpha.Question()
question.scopes = ['scopes_value_1', 'scopes_value_2']
question.query = "query_value"

request = dataqna_v1alpha.CreateQuestionRequest(
parent="parent_value",
question=question,
)

# Make the request
response = client.create_question(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.dataqna_v1alpha.types.CreateQuestionRequest, dict]):
The request object. Request to create a question
Expand Down Expand Up @@ -607,6 +650,26 @@ def execute_question(
) -> question.Question:
r"""Executes an interpretation.

.. code-block:: python

from google.cloud import dataqna_v1alpha

def sample_execute_question():
# Create a client
client = dataqna_v1alpha.QuestionServiceClient()

# Initialize request argument(s)
request = dataqna_v1alpha.ExecuteQuestionRequest(
name="name_value",
interpretation_index=2159,
)

# Make the request
response = client.execute_question(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.dataqna_v1alpha.types.ExecuteQuestionRequest, dict]):
The request object. Request to execute an
Expand Down Expand Up @@ -690,6 +753,25 @@ def get_user_feedback(
) -> user_feedback.UserFeedback:
r"""Gets previously created user feedback.

.. code-block:: python

from google.cloud import dataqna_v1alpha

def sample_get_user_feedback():
# Create a client
client = dataqna_v1alpha.QuestionServiceClient()

# Initialize request argument(s)
request = dataqna_v1alpha.GetUserFeedbackRequest(
name="name_value",
)

# Make the request
response = client.get_user_feedback(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.dataqna_v1alpha.types.GetUserFeedbackRequest, dict]):
The request object. Request to get user feedback.
Expand Down Expand Up @@ -762,6 +844,29 @@ def update_user_feedback(
r"""Updates user feedback. This creates user feedback if
there was none before (upsert).


.. code-block:: python

from google.cloud import dataqna_v1alpha

def sample_update_user_feedback():
# Create a client
client = dataqna_v1alpha.QuestionServiceClient()

# Initialize request argument(s)
user_feedback = dataqna_v1alpha.UserFeedback()
user_feedback.name = "name_value"

request = dataqna_v1alpha.UpdateUserFeedbackRequest(
user_feedback=user_feedback,
)

# Make the request
response = client.update_user_feedback(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.dataqna_v1alpha.types.UpdateUserFeedbackRequest, dict]):
The request object. Request to updates user feedback.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
# 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated code. DO NOT EDIT!
#
# Snippet for SuggestQueries
# NOTE: This snippet has been automatically generated for illustrative purposes only.
# It may require modifications to work in your environment.

# To install the latest published package dependency, execute the following:
# python3 -m pip install google-cloud-dataqna


# [START dataqna_generated_dataqna_v1alpha_AutoSuggestionService_SuggestQueries_async]
from google.cloud import dataqna_v1alpha


async def sample_suggest_queries():
# Create a client
client = dataqna_v1alpha.AutoSuggestionServiceAsyncClient()

# Initialize request argument(s)
request = dataqna_v1alpha.SuggestQueriesRequest(
parent="parent_value",
)

# Make the request
response = await client.suggest_queries(request=request)

# Handle the response
print(response)

# [END dataqna_generated_dataqna_v1alpha_AutoSuggestionService_SuggestQueries_async]
Loading