コード例 #1
0
def update_answer_record(project_id, answer_record_id, is_clicked):
    """Update the answer record.

    Args:
        project_id: The GCP project linked with the conversation profile.
        answer_record_id: The answer record id returned along with the
        suggestion.
        is_clicked: whether the answer record is clicked."""

    client = dialogflow.AnswerRecordsClient()
    answer_record_path = client.answer_record_path(project_id,
                                                   answer_record_id)

    response = client.update_answer_record(
        answer_record={
            "name": answer_record_path,
            "answer_feedback": {
                "clicked": is_clicked
            },
        },
        update_mask={"paths": ["answer_feedback"]},
    )
    print("AnswerRecord Name: {}".format(response.name))
    print("Clicked: {}".format(response.answer_feedback.clicked))
    return response
コード例 #2
0
def sample_update_answer_record():
    # Create a client
    client = dialogflow_v2beta1.AnswerRecordsClient()

    # Initialize request argument(s)
    request = dialogflow_v2beta1.UpdateAnswerRecordRequest()

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

    # Handle the response
    print(response)
コード例 #3
0
def sample_list_answer_records():
    # Create a client
    client = dialogflow_v2beta1.AnswerRecordsClient()

    # Initialize request argument(s)
    request = dialogflow_v2beta1.ListAnswerRecordsRequest()

    # Make the request
    page_result = client.list_answer_records(request=request)

    # Handle the response
    for response in page_result:
        print(response)
コード例 #4
0
def update_answer_record(project_id, answer_record_id, is_clicked):
    """Update the answer record.

    Args:
        project_id: The GCP project linked with the conversation profile.
        answer_record_id: The answer record id returned along with the
        suggestion.
        is_clicked: whether the answer record is clicked."""

    client = dialogflow.AnswerRecordsClient()
    answer_record_path = client.answer_record_path(project_id,
                                                   answer_record_id)

    response = client.update_answer_record(
        answer_record={
            'name': answer_record_path,
            'answer_feedback': {
                'clicked': is_clicked
            }
        },
        update_mask={'paths': ['answer_feedback']})
    print('AnswerRecord Name: {}'.format(response.name))
    print('Clicked: {}'.format(response.answer_feedback.clicked))
    return response