| 1 | package Google::Cloud::Discoveryengine::V1alpha::SampleQuerySetServiceClient; | ||
| 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::Discoveryengine::V1alpha::Completion; | ||
| 14 | use Google::Cloud::Discoveryengine::V1alpha::CustomTuningModel; | ||
| 15 | use Google::Cloud::Discoveryengine::V1alpha::SampleQuerySet; | ||
| 16 | use Google::Cloud::Discoveryengine::V1alpha::RankService; | ||
| 17 | use Google::Cloud::Discoveryengine::V1alpha::Grounding; | ||
| 18 | use Google::Cloud::Discoveryengine::V1alpha::DocumentProcessingConfig; | ||
| 19 | use Google::Cloud::Discoveryengine::V1alpha::Answer; | ||
| 20 | use Google::Cloud::Discoveryengine::V1alpha::Common; | ||
| 21 | use Google::Cloud::Discoveryengine::V1alpha::Project; | ||
| 22 | use Google::Cloud::Discoveryengine::V1alpha::Schema; | ||
| 23 | use Google::Cloud::Discoveryengine::V1alpha::SampleQuery; | ||
| 24 | use Google::Cloud::Discoveryengine::V1alpha::SiteSearchEngine; | ||
| 25 | use Google::Cloud::Discoveryengine::V1alpha::Chunk; | ||
| 26 | use Google::Cloud::Discoveryengine::V1alpha::SampleQuerySetService; | ||
| 27 | use Google::Cloud::Discoveryengine::V1alpha::GroundedGenerationService; | ||
| 28 | use Google::Cloud::Discoveryengine::V1alpha::Session; | ||
| 29 | use Google::Cloud::Discoveryengine::V1alpha::Document; | ||
| 30 | use Google::Cloud::Discoveryengine::V1alpha::AclConfig; | ||
| 31 | use Google::Cloud::Discoveryengine::V1alpha::Control; | ||
| 32 | use Google::Cloud::Discoveryengine::V1alpha::Engine; | ||
| 33 | use Google::Cloud::Discoveryengine::V1alpha::UserEvent; | ||
| 34 | use Google::Cloud::Discoveryengine::V1alpha::ProjectService; | ||
| 35 | use Google::Cloud::Discoveryengine::V1alpha::SchemaService; | ||
| 36 | use Google::Cloud::Discoveryengine::V1alpha::DataStore; | ||
| 37 | use Google::Cloud::Discoveryengine::V1alpha::SiteSearchEngineService; | ||
| 38 | use Google::Cloud::Discoveryengine::V1alpha::ChunkService; | ||
| 39 | use Google::Cloud::Discoveryengine::V1alpha::SearchService; | ||
| 40 | use Google::Cloud::Discoveryengine::V1alpha::AclConfigService; | ||
| 41 | use Google::Cloud::Discoveryengine::V1alpha::ControlService; | ||
| 42 | use Google::Cloud::Discoveryengine::V1alpha::EngineService; | ||
| 43 | use Google::Cloud::Discoveryengine::V1alpha::ImportConfig; | ||
| 44 | use Google::Cloud::Discoveryengine::V1alpha::RecommendationService; | ||
| 45 | use Google::Cloud::Discoveryengine::V1alpha::DataStoreService; | ||
| 46 | use Google::Cloud::Discoveryengine::V1alpha::ServingConfig; | ||
| 47 | use Google::Cloud::Discoveryengine::V1alpha::Evaluation; | ||
| 48 | use Google::Cloud::Discoveryengine::V1alpha::Conversation; | ||
| 49 | use Google::Cloud::Discoveryengine::V1alpha::PurgeConfig; | ||
| 50 | use Google::Cloud::Discoveryengine::V1alpha::SampleQueryService; | ||
| 51 | use Google::Cloud::Discoveryengine::V1alpha::EstimateBillingService; | ||
| 52 | use Google::Cloud::Discoveryengine::V1alpha::SearchTuningService; | ||
| 53 | use Google::Cloud::Discoveryengine::V1alpha::ServingConfigService; | ||
| 54 | use Google::Cloud::Discoveryengine::V1alpha::EvaluationService; | ||
| 55 | use Google::Cloud::Discoveryengine::V1alpha::ConversationalSearchService; | ||
| 56 | use Google::Cloud::Discoveryengine::V1alpha::CompletionService; | ||
| 57 | use Google::Cloud::Discoveryengine::V1alpha::DocumentService; | ||
| 58 | use Google::Cloud::Discoveryengine::V1alpha::UserEventService; | ||
| 59 | use Google::Cloud::Discoveryengine::V1alpha::SessionService; | ||
| 60 | |||
| 61 | our $VERSION = '0.06'; | ||
| 62 | |||
| 63 | has credentials => ( is => 'ro', required => 0 ); | ||
| 64 | has transport => ( is => 'rw' ); | ||
| 65 | |||
| 66 | sub BUILD { | ||
| 67 | my ($self) = @_; | ||
| 68 | |||
| 69 | my $auth = $self->credentials; | ||
| 70 | if (!defined $auth) { | ||
| 71 | $auth = Google::Auth->default(); | ||
| 72 | } elsif (!eval { $auth->can('get_token') }) { | ||
| 73 | croak 'Invalid credentials object: must implement get_token()'; | ||
| 74 | } | ||
| 75 | my $token = $auth->get_token(); | ||
| 76 | |||
| 77 | my $target = 'discoveryengine.googleapis.com:443'; | ||
| 78 | my $t = $self->transport || 'grpc'; | ||
| 79 | |||
| 80 | if (ref($t) && eval { $t->can('call') }) { | ||
| 81 | # Already a transport object | ||
| 82 | } elsif (lc($t) eq 'rest') { | ||
| 83 | my $client = Google::Cloud::REST::Client->new( | ||
| 84 | target => $target, | ||
| 85 | auth_token => $token, | ||
| 86 | ); | ||
| 87 | $self->transport($client); | ||
| 88 | } else { | ||
| 89 | my $client = Google::gRPC::Client->new( | ||
| 90 | target => $target, | ||
| 91 | auth_token => $token, | ||
| 92 | ); | ||
| 93 | $self->transport($client); | ||
| 94 | } | ||
| 95 | } | ||
| 96 | |||
| 97 | sub get_sample_query_set { | ||
| 98 | my ($self, %params) = @_; | ||
| 99 | |||
| 100 | my $request_class = 'Google::Cloud::Discoveryengine::V1alpha::SampleQuerySetService::GetSampleQuerySetRequest'; | ||
| 101 | my $request = eval { $request_class->new(\%params) }; | ||
| 102 | my $new_err = $@; | ||
| 103 | if (!$request) { | ||
| 104 | $request = eval { $request_class->new(%params) }; | ||
| 105 | $new_err ||= $@; | ||
| 106 | } | ||
| 107 | if (!$request) { | ||
| 108 | croak 'Failed to construct ' . $request_class . ': ' . ($new_err || 'unknown error'); | ||
| 109 | } | ||
| 110 | |||
| 111 | my $response_class = 'Google::Cloud::Discoveryengine::V1alpha::SampleQuerySet::SampleQuerySet'; | ||
| 112 | if (eval { $self->transport->isa('Google::Cloud::REST::Client') }) { | ||
| 113 | return $self->transport->call({ | ||
| 114 | http_method => 'POST', | ||
| 115 | path => '/google.cloud.discoveryengine.v1alpha.SampleQuerySetService/GetSampleQuerySet', | ||
| 116 | request => $request, | ||
| 117 | response_class => $response_class, | ||
| 118 | }); | ||
| 119 | } | ||
| 120 | |||
| 121 | my $response = $self->transport->call({ | ||
| 122 | service => 'google.cloud.discoveryengine.v1alpha.SampleQuerySetService', | ||
| 123 | method => 'GetSampleQuerySet', | ||
| 124 | request => $request, | ||
| 125 | response_class => $response_class, | ||
| 126 | }); | ||
| 127 | |||
| 128 | return $response; | ||
| 129 | } | ||
| 130 | 1; # End of Google::Cloud::Discoveryengine::V1alpha::SampleQuerySetServiceClient | ||
| 131 | |||
| 132 | __END__ | ||