line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenAPI::Client::Pinecone; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
68854
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
104
|
|
7
|
1
|
|
|
1
|
|
604
|
use File::ShareDir ':ALL'; |
|
1
|
|
|
|
|
29873
|
|
|
1
|
|
|
|
|
176
|
|
8
|
1
|
|
|
1
|
|
471
|
use File::Spec::Functions qw(catfile); |
|
1
|
|
|
|
|
938
|
|
|
1
|
|
|
|
|
77
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
536
|
use Mojo::Base 'OpenAPI::Client'; |
|
1
|
|
|
|
|
197654
|
|
|
1
|
|
|
|
|
22
|
|
11
|
1
|
|
|
1
|
|
307515
|
use Mojo::URL; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
7
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
0
|
|
|
0
|
1
|
|
my ( $class, $specification ) = ( shift, shift ); |
17
|
0
|
0
|
|
|
|
|
my $attrs = @_ == 1 ? shift : {@_}; |
18
|
|
|
|
|
|
|
|
19
|
0
|
0
|
|
|
|
|
if ( !$ENV{PINECONE_API_KEY} ) { |
20
|
0
|
|
|
|
|
|
Carp::croak('PINECONE_API_KEY environment variable must be set'); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
0
|
|
|
|
if ( !$ENV{PINECONE_API_KEY} && !$attrs->{base_url} ) { |
24
|
0
|
|
|
|
|
|
Carp::croak('PINECONE_API_KEY environment variable must be set'); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
if ( !$specification ) { |
28
|
|
|
|
|
|
|
eval { |
29
|
0
|
|
|
|
|
|
$specification = dist_file( 'OpenAPI-Client-Pinecone', 'pinecone.yaml' ); |
30
|
0
|
|
|
|
|
|
1; |
31
|
0
|
0
|
|
|
|
|
} or do { |
32
|
|
|
|
|
|
|
# Fallback to local share directory during development |
33
|
0
|
|
|
|
|
|
warn $@; |
34
|
0
|
|
|
|
|
|
$specification = catfile( 'share', 'pinecone.yaml' ); |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new( $specification, %{$attrs} ); |
|
0
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$self->ua->on( |
41
|
|
|
|
|
|
|
start => sub { |
42
|
0
|
|
|
0
|
|
|
my ( $ua, $tx ) = @_; |
43
|
0
|
|
|
|
|
|
$tx->req->headers->header( 'Api-Key' => $ENV{PINECONE_API_KEY} ); |
44
|
|
|
|
|
|
|
} |
45
|
0
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
if ( !$attrs->{base_url} ) { |
48
|
0
|
|
|
|
|
|
$self->base_url( Mojo::URL->new("https://controller.$ENV{PINECONE_ENVIRONMENT}.pinecone.io") ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
return $self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# install snake case aliases |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
{ |
57
|
|
|
|
|
|
|
my %snake_case_alias = ( |
58
|
|
|
|
|
|
|
DescribeIndexStats => 'describe_index_stats', |
59
|
|
|
|
|
|
|
Query => 'query', |
60
|
|
|
|
|
|
|
Delete => 'delete_vector', |
61
|
|
|
|
|
|
|
Fetch => 'fetch_vector', |
62
|
|
|
|
|
|
|
Update => 'update_vector', |
63
|
|
|
|
|
|
|
Upsert => 'upsert_vector', |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
for my $camel_case_method ( keys %snake_case_alias ) { |
67
|
1
|
|
|
1
|
|
392
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
151
|
|
68
|
|
|
|
|
|
|
*{"$snake_case_alias{$camel_case_method}"} = sub { |
69
|
0
|
|
|
0
|
|
|
my $self = shift; |
70
|
0
|
|
|
|
|
|
$self->$camel_case_method(@_); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |