line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenAPI::Client::Pinecone; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
69497
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
69
|
|
7
|
1
|
|
|
1
|
|
573
|
use File::ShareDir ':ALL'; |
|
1
|
|
|
|
|
30895
|
|
|
1
|
|
|
|
|
199
|
|
8
|
1
|
|
|
1
|
|
504
|
use File::Spec::Functions qw(catfile); |
|
1
|
|
|
|
|
850
|
|
|
1
|
|
|
|
|
76
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
506
|
use Mojo::Base 'OpenAPI::Client'; |
|
1
|
|
|
|
|
200212
|
|
|
1
|
|
|
|
|
23
|
|
11
|
1
|
|
|
1
|
|
314186
|
use Mojo::URL; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
8
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
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
|
|
417
|
no strict 'refs'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
156
|
|
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__ |