V2beta1/SessionEntityTypesClient.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« V2beta1/PhoneNumbersClient.pm ↑ Summary V2beta1/SessionsClient.pm »
1 package Google::Cloud::Dialogflow::V2beta1::SessionEntityTypesClient;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 0 ▶use Google::gRPC::Client;
Subroutine BEGIN: called CC=1 SCAR=2.6
7 use Google::Cloud::REST::Client;
8 use Google::Auth;
9 use Carp qw(croak);
10  
11 use Protobuf;
12 use Google::Api::Common;
13 use Google::Cloud::Dialogflow::V2beta1::ValidationResult;
14 use Google::Cloud::Dialogflow::V2beta1::AgentCoachingInstruction;
15 use Google::Cloud::Dialogflow::V2beta1::Grounding;
16 use Google::Cloud::Dialogflow::V2beta1::Gcs;
17 use Google::Cloud::Dialogflow::V2beta1::Operations;
18 use Google::Cloud::Dialogflow::V2beta1::ToolCall;
19 use Google::Cloud::Dialogflow::V2beta1::KnowledgeBase;
20 use Google::Cloud::Dialogflow::V2beta1::Agent;
21 use Google::Cloud::Dialogflow::V2beta1::Context;
22 use Google::Cloud::Dialogflow::V2beta1::Fulfillment;
23 use Google::Cloud::Dialogflow::V2beta1::Version;
24 use Google::Cloud::Dialogflow::V2beta1::PhoneNumber;
25 use Google::Cloud::Dialogflow::V2beta1::EncryptionSpec;
26 use Google::Cloud::Dialogflow::V2beta1::SipTrunk;
27 use Google::Cloud::Dialogflow::V2beta1::Tool;
28 use Google::Cloud::Dialogflow::V2beta1::AudioConfig;
29 use Google::Cloud::Dialogflow::V2beta1::EntityType;
30 use Google::Cloud::Dialogflow::V2beta1::Document;
31 use Google::Cloud::Dialogflow::V2beta1::Intent;
32 use Google::Cloud::Dialogflow::V2beta1::Toolset;
33 use Google::Cloud::Dialogflow::V2beta1::CesTool;
34 use Google::Cloud::Dialogflow::V2beta1::CesApp;
35 use Google::Cloud::Dialogflow::V2beta1::Environment;
36 use Google::Cloud::Dialogflow::V2beta1::SessionEntityType;
37 use Google::Cloud::Dialogflow::V2beta1::CompanionAgent;
38 use Google::Cloud::Dialogflow::V2beta1::Generator;
39 use Google::Cloud::Dialogflow::V2beta1::Session;
40 use Google::Cloud::Dialogflow::V2beta1::GeneratorEvaluation;
41 use Google::Cloud::Dialogflow::V2beta1::Participant;
42 use Google::Cloud::Dialogflow::V2beta1::Webhook;
43 use Google::Cloud::Dialogflow::V2beta1::ConversationEvent;
44 use Google::Cloud::Dialogflow::V2beta1::ConversationProfile;
45 use Google::Cloud::Dialogflow::V2beta1::HumanAgentAssistantEvent;
46 use Google::Cloud::Dialogflow::V2beta1::AnswerRecord;
47 use Google::Cloud::Dialogflow::V2beta1::Conversation;
48  
49 our $VERSION = '0.06';
50  
51 has credentials => ( is => 'ro', required => 0 );
52 has transport => ( is => 'rw' );
53  
54 sub BUILD {
55 my ($self) = @_;
56  
57 my $auth = $self->credentials;
58 if (!defined $auth) {
59 $auth = Google::Auth->default();
60 } elsif (!eval { $auth->can('get_token') }) {
61 croak 'Invalid credentials object: must implement get_token()';
62 }
63 my $token = $auth->get_token();
64  
65 my $target = 'dialogflow.googleapis.com:443';
66 my $t = $self->transport || 'grpc';
67  
68 if (ref($t) && eval { $t->can('call') }) {
69 # Already a transport object
70 } elsif (lc($t) eq 'rest') {
71 my $client = Google::Cloud::REST::Client->new(
72 target => $target,
73 auth_token => $token,
74 );
75 $self->transport($client);
76 } else {
77 my $client = Google::gRPC::Client->new(
78 target => $target,
79 auth_token => $token,
80 );
81 $self->transport($client);
82 }
83 }
84  
85 sub list_session_entity_types {
86 my ($self, %params) = @_;
87  
88 my $request_class = 'Google::Cloud::Dialogflow::V2beta1::SessionEntityType::ListSessionEntityTypesRequest';
89 my $request = eval { $request_class->new(\%params) };
90 my $new_err = $@;
91 if (!$request) {
92 $request = eval { $request_class->new(%params) };
93 $new_err ||= $@;
94 }
95 if (!$request) {
96 croak 'Failed to construct ' . $request_class . ': ' . ($new_err || 'unknown error');
97 }
98  
99 my $response_class = 'Google::Cloud::Dialogflow::V2beta1::SessionEntityType::ListSessionEntityTypesResponse';
100 if (eval { $self->transport->isa('Google::Cloud::REST::Client') }) {
101 return $self->transport->call({
102 http_method => 'POST',
103 path => '/google.cloud.dialogflow.v2beta1.SessionEntityTypes/ListSessionEntityTypes',
104 request => $request,
105 response_class => $response_class,
106 });
107 }
108  
109 my $response = $self->transport->call({
110 service => 'google.cloud.dialogflow.v2beta1.SessionEntityTypes',
111 method => 'ListSessionEntityTypes',
112 request => $request,
113 response_class => $response_class,
114 });
115  
116 return $response;
117 }
118 1; # End of Google::Cloud::Dialogflow::V2beta1::SessionEntityTypesClient
119  
120 __END__
« V2beta1/PhoneNumbersClient.pm ↑ Summary V2beta1/SessionsClient.pm »