view release on metacpan or search on metacpan
lib/Artifactory/Client.pm view on Meta::CPAN
my $resp = $client->deploy_artifact( path => $path, properties => $properties, file => $file );
# Custom requests can also be made via usual get / post / put / delete requests.
my $resp = $client->get( 'http://artifactory.server.com/path/to/resource' );
# Repository override for calls that have a repository in the endpoint. The passed-in repository will not persist.
my $resp = $client->calculate_yum_repository_metadata( repository => 'different_repo', async => 1 );
=cut
=head1 Dev Env Setup / Running Tests
lib/Artifactory/Client.pm view on Meta::CPAN
sub system_info {
my $self = shift;
return $self->_handle_system();
}
=head2 verify_connection( endpoint => 'http://server/foobar', username => 'admin', password => 'password' )
Verifies a two-way connection between Artifactory and another product
=cut
lib/Artifactory/Client.pm view on Meta::CPAN
return $self->_handle_system_settings( 'export', %args );
}
=head2 ignore_xray_alert( $path )
Sets an alert to be ignored until next time the repository hosting the artifact about which the alert was issued, is scanned. Note that this endpoint does not
affect artifacts that are blocked because they have not been scanned at all.
=cut
sub ignore_xray_alert {
lib/Artifactory/Client.pm view on Meta::CPAN
return $self->post($url);
}
=head2 allow_download_when_xray_is_unavailable( 'true'|'false' )
You may configure Artifactory to block downloads of artifacts when the connected Xray instance is unavailable. This endpoint lets you override that
configuration (and allow download of artifacts).
=cut
sub allow_download_when_xray_is_unavailable {
lib/Artifactory/Client.pm view on Meta::CPAN
my $url = $self->_api_url() . "/gpg/key/$type";
return $self->$method( $url, %args );
}
sub _handle_repository_reindex {
my ( $self, $endpoint, %args ) = @_;
my $url =
(%args)
? $self->_api_url() . $endpoint . "?"
: $self->_api_url() . $endpoint;
$url .= $self->_stringify_hash( '&', %args ) if (%args);
return $self->post($url);
}
sub _handle_multi_push_replication {
lib/Artifactory/Client.pm view on Meta::CPAN
content => $self->_json->encode( \%args )
);
}
sub _handle_revoke_api_key {
my ( $self, $endpoint ) = @_;
my $resp = $self->get_api_key();
my $content = $self->_json->decode( $resp->content );
my %header;
$header{'X-Api-Key'} = $content->{apiKey};
my $url = $self->_api_url() . $endpoint;
return $self->delete( $url, %header );
}
sub _handle_block_system_replication {
my ( $self, $ep, %args ) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeBarCodeCloud/ApiClient.pm view on Meta::CPAN
}
$self->{http_timeout} = $seconds;
}
# make the HTTP request
# @param string $resourcePath path to method endpoint
# @param string $method method to call
# @param array $queryParams parameters to be place in query URL
# @param array $postData parameters to be placed in POST body
# @param array $headerParams parameters to be place in request header
# @return mixed
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeCellsCloud/ApiClient.pm view on Meta::CPAN
my $access_token = $self->o_auth_post('grant_type' => "client_credentials", 'client_id' => $self->{config}->{client_id}, 'client_secret' =>$self->{config}->{client_secret})->access_token;
$self->{config}->{access_token} = $access_token;
}
# make the HTTP request
# @param string $resourcePath path to method endpoint
# @param string $method method to call
# @param array $queryParams parameters to be place in query URL
# @param array $postData parameters to be placed in POST body
# @param array $headerParams parameters to be place in request header
# @return mixed
lib/AsposeCellsCloud/ApiClient.pm view on Meta::CPAN
return;
}
return $self->_global_auth_setup($header_params, $query_params)
unless $auth_settings && @$auth_settings;
# one endpoint can have more than 1 auth settings
foreach my $auth (@$auth_settings) {
# determine which one to use
if (!defined($auth)) {
# TODO show warning about auth setting not defined
}
lib/AsposeCellsCloud/ApiClient.pm view on Meta::CPAN
# TODO show warning about security definition not found
}
}
}
# The endpoint API class has not found any settings for auth. This may be deliberate,
# in which case update_params_for_auth() will be a no-op. But it may also be that the
# OpenAPI Spec does not describe the intended authorization. So we check in the config for any
# auth tokens and if we find any, we use them for all endpoints;
sub _global_auth_setup {
my ($self, $header_params, $query_params) = @_;
my $tokens = $self->{config}->get_tokens;
return unless keys %$tokens;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeDiagramCloud/ApiClient.pm view on Meta::CPAN
$self->{get_access_token_time} = time();
return $_response_object;
}
# make the HTTP request
# @param string $resourcePath path to method endpoint
# @param string $method method to call
# @param array $queryParams parameters to be place in query URL
# @param array $postData parameters to be placed in POST body
# @param array $headerParams parameters to be place in request header
# @return mixed
lib/AsposeDiagramCloud/ApiClient.pm view on Meta::CPAN
my ($self, $header_params, $query_params, $auth_settings) = @_;
return $self->_global_auth_setup($header_params, $query_params)
unless $auth_settings && @$auth_settings;
# one endpoint can have more than 1 auth settings
foreach my $auth (@$auth_settings) {
# determine which one to use
if (!defined($auth)) {
# TODO show warning about auth setting not defined
}
lib/AsposeDiagramCloud/ApiClient.pm view on Meta::CPAN
# TODO show warning about security definition not found
}
}
}
# The endpoint API class has not found any settings for auth. This may be deliberate,
# in which case update_params_for_auth() will be a no-op. But it may also be that the
# OpenAPI Spec does not describe the intended authorization. So we check in the config for any
# auth tokens and if we find any, we use them for all endpoints;
sub _global_auth_setup {
my ($self, $header_params, $query_params) = @_;
my $tokens = $self->{config}->get_tokens;
return unless keys %$tokens;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeEmailCloud/ApiClient.pm view on Meta::CPAN
}
$self->{http_timeout} = $seconds;
}
# make the HTTP request
# @param string $resourcePath path to method endpoint
# @param string $method method to call
# @param array $queryParams parameters to be place in query URL
# @param array $postData parameters to be placed in POST body
# @param array $headerParams parameters to be place in request header
# @return mixed
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeImagingCloud/ApiClient.pm view on Meta::CPAN
}
$self->{http_timeout} = $seconds;
}
# make the HTTP request
# @param string $resourcePath path to method endpoint
# @param string $method method to call
# @param array $queryParams parameters to be place in query URL
# @param array $postData parameters to be placed in POST body
# @param array $headerParams parameters to be place in request header
# @return mixed
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeOcrCloud/ApiClient.pm view on Meta::CPAN
}
$self->{http_timeout} = $seconds;
}
# make the HTTP request
# @param string $resourcePath path to method endpoint
# @param string $method method to call
# @param array $queryParams parameters to be place in query URL
# @param array $postData parameters to be placed in POST body
# @param array $headerParams parameters to be place in request header
# @return mixed
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposePdfCloud/ApiClient.pm view on Meta::CPAN
}
$self->{http_timeout} = $seconds;
}
# make the HTTP request
# @param string $resourcePath path to method endpoint
# @param string $method method to call
# @param array $queryParams parameters to be place in query URL
# @param array $postData parameters to be placed in POST body
# @param array $headerParams parameters to be place in request header
# @return mixed
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeSlidesCloud/ApiClient.pm view on Meta::CPAN
return bless \%args, $class;
}
# make the HTTP request
# @param string $resourcePath path to method endpoint
# @param string $method method to call
# @param array $queryParams parameters to be place in query URL
# @param array $postParams parameters to be placed in POST body
# @param array $headerParams parameters to be place in request header
# @param array $body_data data to be place in request body
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeStorageCloud/ApiClient.pm view on Meta::CPAN
}
$self->{http_timeout} = $seconds;
}
# make the HTTP request
# @param string $resourcePath path to method endpoint
# @param string $method method to call
# @param array $queryParams parameters to be place in query URL
# @param array $postData parameters to be placed in POST body
# @param array $headerParams parameters to be place in request header
# @return mixed
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeTasksCloud/ApiClient.pm view on Meta::CPAN
}
$self->{http_timeout} = $seconds;
}
# make the HTTP request
# @param string $resourcePath path to method endpoint
# @param string $method method to call
# @param array $queryParams parameters to be place in query URL
# @param array $postData parameters to be placed in POST body
# @param array $headerParams parameters to be place in request header
# @return mixed
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeThreeDCloud/ApiClient.pm view on Meta::CPAN
$self->{get_access_token_time} = time();
return $_response_object;
}
# make the HTTP request
# @param string $resourcePath path to method endpoint
# @param string $method method to call
# @param array $queryParams parameters to be place in query URL
# @param array $postData parameters to be placed in POST body
# @param array $headerParams parameters to be place in request header
# @return mixed
lib/AsposeThreeDCloud/ApiClient.pm view on Meta::CPAN
my ($self, $header_params, $query_params, $auth_settings) = @_;
return $self->_global_auth_setup($header_params, $query_params)
unless $auth_settings && @$auth_settings;
# one endpoint can have more than 1 auth settings
foreach my $auth (@$auth_settings) {
# determine which one to use
if (!defined($auth)) {
# TODO show warning about auth setting not defined
}
lib/AsposeThreeDCloud/ApiClient.pm view on Meta::CPAN
# TODO show warning about security definition not found
}
}
}
# The endpoint API class has not found any settings for auth. This may be deliberate,
# in which case update_params_for_auth() will be a no-op. But it may also be that the
# OpenAPI Spec does not describe the intended authorization. So we check in the config for any
# auth tokens and if we find any, we use them for all endpoints;
sub _global_auth_setup {
my ($self, $header_params, $query_params) = @_;
my $tokens = $self->{config}->get_tokens;
return unless keys %$tokens;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeWordsCloud/ApiClient.pm view on Meta::CPAN
}
$self->{http_timeout} = $seconds;
}
# make the HTTP request
# @param string $resourcePath path to method endpoint
# @param string $method method to call
# @param array $queryParams parameters to be place in query URL
# @param array $postData parameters to be placed in POST body
# @param array $headerParams parameters to be place in request header
# @return mixed
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Astro/ADS/Metrics.pm view on Meta::CPAN
=encoding UTF-8
=head1 NAME
Astro::ADS::Metrics - Queries the ADS Metrics endpoint and collects the results
=head1 VERSION
version 1.92
lib/Astro/ADS/Metrics.pm view on Meta::CPAN
Returns the json response as a hash reference.
=head2 details
Queries the metrics/details endpoint with a list of bibcodes.
Takes no options.
Returns the json response as a hash reference.
=head2 Notes
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Astro/Catalog/Query/Sesame.pm view on Meta::CPAN
my $self = shift;
# clean out buffer
$self->_set_raw("");
my $endpoint = $self->endpoint();
my %options = $self->_translate_options();
# return unless we haev a target, set it otherwise
return undef unless $self->query_options("object");
# make sesame query
my $service = SOAP::Lite->service($self->endpoint());
my $ident = $self->query_options("object");
$ident =~ s/\+/ /g;
my $buffer;
lib/Astro/Catalog/Query/Sesame.pm view on Meta::CPAN
These methods are for internal use only.
=over 4
=item B<_default_endpoint>
=cut
sub _default_endpoint {
return "http://cdsws.u-strasbg.fr/axis/services/Sesame?wsdl";
}
=item B<_default_urn>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Astro/DSS/JPEG.pm view on Meta::CPAN
ua => $ua # Optional
);
All parameters are optional. The constructor by default creates an L<LWP::UserAgent>,
but you can pass your own with C<ua>, while the URL to the L<STScI|https://archive.stsci.edu/dss/copyright.html>
JPEG endpoint and the L<SIMBAD|http://simbad.u-strasbg.fr/simbad/> simple identifier query
interface can be redefined (e.g. if they change in the future) from the above shown defaults.
=head1 METHODS
=head2 C<get_image>
lib/Astro/DSS/JPEG.pm view on Meta::CPAN
=back
=head1 NOTES
Some artifacts can be seen at the borders of separate "stripes" of the survey and
also the particular JPEG endpoint used sometimes can leave the corners as plain black
squares (depending on the selected frame size, as it is to do with the way it does
segmentation), so if you want to make sure you have a frame with no corner gaps,
request some more angular size than you want and crop.
Note that the module test suite won't actually fetch data from either DSS or SIMBAD.
This is mainly to ensure it will not fail even if the DSS & SIMBAD endpoints change,
as you can still use the module by passing the updated urls to the constructor. It
also avoids unneeded strain to those free services.
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Astro/SIMBAD/Client/WSQueryInterfaceService.pm view on Meta::CPAN
our $VERSION = '0.048';
## TRW ^^^^
my %methods = (
queryObjectById => {
## endpoint => 'http://simweb.u-strasbg.fr:8080/axis/services/WSQuery',
endpoint => 'axis/services/WSQuery',
soapaction => '',
namespace => 'http://uif.simbad.cds',
parameters => [
SOAP::Data->new(name => 'in0', type => 'soapenc:string', attr => {}),
SOAP::Data->new(name => 'in1', type => 'soapenc:string', attr => {}),
SOAP::Data->new(name => 'in2', type => 'soapenc:string', attr => {}),
], # end parameters
}, # end queryObjectById
queryObjectByBib => {
## endpoint => 'http://simweb.u-strasbg.fr:8080/axis/services/WSQuery',
endpoint => 'axis/services/WSQuery',
soapaction => '',
namespace => 'http://uif.simbad.cds',
parameters => [
SOAP::Data->new(name => 'in0', type => 'soapenc:string', attr => {}),
SOAP::Data->new(name => 'in1', type => 'soapenc:string', attr => {}),
SOAP::Data->new(name => 'in2', type => 'soapenc:string', attr => {}),
], # end parameters
}, # end queryObjectByBib
queryObjectByCoord => {
## endpoint => 'http://simweb.u-strasbg.fr:8080/axis/services/WSQuery',
endpoint => 'axis/services/WSQuery',
soapaction => '',
namespace => 'http://uif.simbad.cds',
parameters => [
SOAP::Data->new(name => 'in0', type => 'soapenc:string', attr => {}),
SOAP::Data->new(name => 'in1', type => 'soapenc:string', attr => {}),
lib/Astro/SIMBAD/Client/WSQueryInterfaceService.pm view on Meta::CPAN
## my $name = UNIVERSAL::isa($method => 'SOAP::Data') ? $method->name : $method;
my $name = eval {$method->isa('SOAP::Data')} ? $method->name : $method;
## TRW ^^^^
my %method = %{$methods{$name}};
## TRW vvvv
$method{endpoint} or Carp::croak "No server address (proxy) specified";
my $endpoint = $simbad->__build_url( $method{endpoint} );
## $self->proxy($method{endpoint} || Carp::croak "No server address (proxy) specified")
$self->proxy( $endpoint )
unless $self->proxy;
## TRW ^^^^
my @templates = @{$method{parameters}};
my @parameters = ();
## TRW foreach my $param (@_) {
lib/Astro/SIMBAD/Client/WSQueryInterfaceService.pm view on Meta::CPAN
} else {
push(@parameters, $param);
}
}
## TRW $self->endpoint($method{endpoint})
## TRW ->ns($method{namespace})
## TRW ->on_action(sub{qq!"$method{soapaction}"!});
## vvv TRW
if ($self->can ('ns')) {
$self->endpoint($endpoint)
->ns($method{namespace})
->on_action (sub{$method{soapaction}});
} else {
$self->endpoint($endpoint)
->envprefix ('soap')
->uri($method{namespace})
->on_action (sub{$method{soapaction}});
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Async/Microservice.pm view on Meta::CPAN
=item * C</static/:filename> - OpenAPI files
=item * C</edit> - OpenAPI editor
=item * C</hcheck> - Health check endpoint
=back
You can override any of these default routes by defining them in your
C<get_routes()> method. Your custom routes take precedence over the defaults.
view all matches for this distribution
view release on metacpan or search on metacpan
examples/slow-redis/app.pl view on Meta::CPAN
curl http://localhost:5001/
# Test 5 concurrent requests (should still take ~1 second total!)
time (for i in 1 2 3 4 5; do curl -s http://localhost:5001/ & done; wait)
# Compare with fast endpoint (no delay)
curl http://localhost:5001/fast
=head1 DESCRIPTION
This example demonstrates non-blocking I/O by intentionally sleeping for
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Async/Template.pm view on Meta::CPAN
tt $vars, << 'END',
USE timeout = Second;
AWAIT timeout.start(10)
r = AWAIT api.call('endpoint', {param = 'val'});
error = ERROR(r);
result = RESULT(r);
RETURN IF ERROR(r);
p2 = ASYNC some_async_fn('param');
p1 = ASYNC api.call('endpoint', {});
AWAIT p1;
AWAIT p2;
RETURN IF RESULT(r);
END
sub{
view all matches for this distribution
view release on metacpan or search on metacpan
scope => $scope
};
# Prepare UA for DPoP
$http->set_tokens( undef, undef, 'DPoP', $self->_get_dpop_key() );
my $par_endpoint = $discovery->{metadata}{pushed_authorization_request_endpoint};
my $par_content = {
client_id => $client_id,
response_type => 'code',
code_challenge => $code_challenge,
code_challenge_method => 'S256',
scope => $scope,
aud => $discovery->{pds},
};
say '[DEBUG] [At] PAR request: ' . JSON::PP->new->ascii->encode($par_content) if $ENV{DEBUG};
my ($par_res) = $http->post(
$par_endpoint => {
headers => { DPoP => $http->_generate_dpop_proof( $par_endpoint, 'POST', 1 ) },
encoding => 'form',
content => $par_content,
skip_ath => 1
}
);
die 'PAR failed: ' . ( $par_res . '' ) if builtin::blessed $par_res;
say '[DEBUG] [At] PAR response: ' . JSON::PP->new->ascii->encode($par_res) if $ENV{DEBUG};
my $auth_uri = URI->new( $discovery->{metadata}{authorization_endpoint} );
$auth_uri->query_form( client_id => $client_id, request_uri => $par_res->{request_uri} );
return $auth_uri->as_string;
}
method oauth_callback ( $code, $state ) {
die 'OAuth state mismatch' unless $oauth_state && $state eq $oauth_state->{state};
my $token_endpoint = $oauth_state->{discovery}{metadata}{token_endpoint};
my $key = $self->_get_dpop_key();
my ($token_res) = $http->post(
$token_endpoint => {
headers => { DPoP => $http->_generate_dpop_proof( $token_endpoint, 'POST', 1 ) },
encoding => 'form',
content => {
grant_type => 'authorization_code',
code => $code,
client_id => $oauth_state->{client_id},
method oauth_refresh() {
return unless $session && $session->refreshJwt && $session->token_type eq 'DPoP';
my $discovery = $self->oauth_discover( $session->handle );
return unless $discovery;
my $token_endpoint = $discovery->{metadata}{token_endpoint};
my $key = $self->_get_dpop_key();
my $refresh_content = {
grant_type => 'refresh_token',
refresh_token => $session->refreshJwt,
client_id => $session->client_id // '',
aud => $discovery->{pds},
};
say '[DEBUG] [At] Refresh request: ' . JSON::PP->new->ascii->encode($refresh_content) if $ENV{DEBUG};
my ($token_res) = $http->post(
$token_endpoint => {
headers => { DPoP => $http->_generate_dpop_proof( $token_endpoint, 'POST', 1 ) },
encoding => 'form',
content => $refresh_content,
skip_ath => 1
}
);
return $self->_get_block_http( $cid_str, $did );
}
method _get_block_http ( $cid_str, $did ) {
# If no DID provided, we can't fallback to sync endpoints
return Future->done(undef) unless $did;
#~ say "[HTTP] Fetching block $cid_str for $did via com.atproto.sync.getBlocks...";
# com.atproto.sync.getBlocks returns a CAR file
return Future->call(
Once authenticated, you should store your session data securely so you can resume it later without requiring the user
to log in again.
=head3 Resuming an OAuth Session
You need to store the tokens, the DPoP key, and the PDS endpoint. The C<_raw> method on the session object provides a
simple hash for this purpose:
# After login, save the session
my $data = $at->session->_raw;
# ... store $data securely ...
# ... setup firehose ...
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
=head1 Lexicon Caching
The AT Protocol defines its API endpoints using "Lexicons" (JSON schemas). This library uses these schemas to
automatically coerce API responses into Perl objects.
=head2 How it works
When you call a method like C<app.bsky.actor.getProfile>, the library:
Resolves an AT Protocol DID to a libp2p PeerID. This is used to discover the user's data on the P2P network.
=head2 C<get_repo_head( $did )>
Retrieves the current MST (Merkle Search Tree) root CID for a user's repository via the C<com.atproto.sync.getHead>
endpoint.
=head2 C<get_block( $cid_str, [ $target_peer_id ] )>
Retrieves a raw block by its CID. If an C<ipfs_node> was provided to the constructor, this method will:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Attean/Algebra.pm view on Meta::CPAN
use Types::Standard qw(ConsumerOf Bool);
use namespace::clean;
with 'Attean::API::Algebra', 'Attean::API::UnaryQueryTree', 'Attean::API::UnionScopeVariables';
has 'endpoint' => (is => 'ro', isa => ConsumerOf['Attean::API::TermOrVariable'], required => 1);
has 'silent' => (is => 'ro', isa => Bool, default => 0);
sub algebra_as_string {
my $self = shift;
my $endpoint = $self->endpoint->as_sparql;
chomp($endpoint);
return sprintf('Service %s', $endpoint);
}
sub tree_attributes { return qw(endpoint) };
sub sparql_tokens {
my $self = shift;
my $service = AtteanX::SPARQL::Token->keyword('SERVICE');
my $l = AtteanX::SPARQL::Token->lbrace;
lib/Attean/Algebra.pm view on Meta::CPAN
my @tokens;
push(@tokens, $service);
if ($self->silent) {
push(@tokens, AtteanX::SPARQL::Token->keyword('SILENT'));
}
push(@tokens, $self->endpoint->sparql_tokens->elements);
push(@tokens, $l);
push(@tokens, $child->sparql_subtokens->elements);
push(@tokens, $r);
return Attean::ListIterator->new( values => \@tokens, item_type => 'AtteanX::SPARQL::Token' );
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AtteanX/Endpoint.pm view on Meta::CPAN
}
sub prepare_app {
my $self = shift;
my $config = $self->{config};
$self->{endpoint} = eval { AtteanX::Endpoint->new( $config ) };
if ($@) {
warn $@;
}
}
lib/AtteanX/Endpoint.pm view on Meta::CPAN
my $req = Plack::Request->new($env);
unless ($req->method =~ /^(GET|HEAD|POST)$/) {
return [ 405, [ 'Content-type', 'text/plain' ], [ 'Method not allowed' ] ];
}
my $ep = $self->{endpoint};
my $resp = $ep->run( $req );
return $resp->finalize;
}
}
lib/AtteanX/Endpoint.pm view on Meta::CPAN
This document describes AtteanX::Endpoint version 0.003
=head1 SYNOPSIS
plackup -p 9091 scripts/endpoint.psgi
=head1 DESCRIPTION
The AtteanX::Endpoint class implements a PSGI SPARQL Protocol endpoint.
=head1 ATTRIBUTES
=over 4
lib/AtteanX/Endpoint.pm view on Meta::CPAN
=item C<< model >>
=item C<< conf >>
A hash reference containing configuration data for the endpoint. For example:
{
endpoint => {
service_description => {
named_graphs => 1,
default => 1,
},
load_data => 0,
lib/AtteanX/Endpoint.pm view on Meta::CPAN
sub _run {
my $self = shift;
my $req = shift;
my $config = $self->{conf};
my $endpoint_path = $config->{endpoint}{endpoint_path} || '/sparql';
my $gsp_path = $config->{endpoint}{gsp_path} || '/gsp';
my $response = Plack::Response->new;
our $VERSION;
my $server = "AtteanX::Endpoint/$VERSION";
$server .= " " . $response->headers->header('Server') if defined($response->headers->header('Server'));
$response->headers->header('Server' => $server);
if ($req->path eq $endpoint_path or $req->path eq $gsp_path) {
# no-op
} else {
my $content;
my $path = $req->path_info;
$path =~ s#^/##;
my $dir = $ENV{ATTEAN_ENDPOINT_SHAREDIR} || File::Spec->catdir((eval { dist_dir('AtteanX-Endpoint') } || 'share'), 'endpoint');
my $abs = File::Spec->rel2abs($dir);
my $file = File::Spec->catfile($abs, 'www', $path);
if (-r $file) {
open( my $fh, '<', $file ) or croak $!;
$response->status(200);
lib/AtteanX/Endpoint.pm view on Meta::CPAN
}
$response->body($content);
return $response;
}
if ($req->path eq $endpoint_path) {
$self->_run_protocol($req, $response);
} else {
$self->_run_gsp($req, $response);
}
}
lib/AtteanX/Endpoint.pm view on Meta::CPAN
my $ae = $req->headers->header('Accept-Encoding') || '';
my $graph = $self->get_gsp_graph($req); # TODO
unless ($graph) {
die AtteanX::Endpoint::ClientError->new(
code => 400,
message => 'No graph specified', uri => 'http://id.kasei.us/rdf-endpoint/error/gsp_no_graph'
);
}
my $base = $req->base;
my $parser = Attean->get_parser('SPARQL')->new(base => $base);
my $algebra;
lib/AtteanX/Endpoint.pm view on Meta::CPAN
$self->log_gsp_request( $req );
if ($@ or not($algebra)) {
my $error = $@ || 'Internal error';
$self->log_error( $req, $error );
my $eclass = ($error =~ /Syntax/) ? 'AtteanX::Endpoint::ClientError' : 'AtteanX::Endpoint::ServerError';
die $eclass->new(message => 'SPARQL GSP parse error', uri => 'http://id.kasei.us/rdf-endpoint/error/parse_error', details => { error => $error });
}
} else {
unless ($config->{endpoint}{update}) {
die AtteanX::Endpoint::ClientError->new(code => 405, message => 'Method not allowed', uri => 'http://id.kasei.us/rdf-endpoint/error/bad_http_method');
}
if ($req->method eq 'PUT' or $req->method eq 'POST') {
my $ct = $req->headers->header('Content-Type');
unless ($ct) {
die AtteanX::Endpoint::ClientError->new(
code => 400,
message => 'No Content-Type specified for PUT request', uri => 'http://id.kasei.us/rdf-endpoint/error/gsp_no_media_type'
);
}
my $pclass = Attean->get_parser(media_type => $ct);
unless ($pclass) {
die AtteanX::Endpoint::ClientError->new(
code => 400,
message => "No parser available for media type $ct", uri => 'http://id.kasei.us/rdf-endpoint/error/gsp_unrecognized_media_type'
);
}
my $parser = $pclass->new();
my $iter = $parser->parse_iter_from_io($req->body);
lib/AtteanX/Endpoint.pm view on Meta::CPAN
} elsif ($req->method eq 'DELETE') {
$algebra = Attean::Algebra::Clear->new(drop => 1, silent => 1, target => 'GRAPH', graph => $graph);
} else {
die AtteanX::Endpoint::ClientError->new(
code => 400,
message => "Unsupported HTTP method: " . $req->method, uri => 'http://id.kasei.us/rdf-endpoint/error/gsp_unrecognized_http_method'
);
}
}
if ($self->log->is_trace) {
lib/AtteanX/Endpoint.pm view on Meta::CPAN
}
};
if ($@) {
my $error = $@;
$self->log->fatal($error);
die AtteanX::Endpoint::ServerError->new(code => 500, message => 'SPARQL GSP execution error', uri => 'http://id.kasei.us/rdf-endpoint/error/execution_error', details => { error => $@ });
}
$self->wrap_response_with_encoding($req, $response, $ae, $content);
return $response;
}
lib/AtteanX/Endpoint.pm view on Meta::CPAN
if ($req->method !~ /^(GET|POST)$/i) {
my $method = uc($req->method);
$content = "Unexpected method $method (expecting GET or POST)";
$self->log_error( $req, $content );
$response->header('Allow' => 'GET, POST');
die AtteanX::Endpoint::ClientError->new(code => 405, message => 'Method not allowed', uri => 'http://id.kasei.us/rdf-endpoint/error/bad_http_method');
} elsif (defined($ct) and $ct eq 'application/sparql-query') {
$sparql = $req->content;
} elsif (defined($ct) and $ct eq 'application/sparql-update') {
if ($config->{endpoint}{update} and $req->method eq 'POST') {
$sparql = $req->content;
}
} elsif ($req->param('query')) {
my @sparql = $req->param('query');
if (scalar(@sparql) > 1) {
$content = "More than one query string submitted";
$self->log_error( $req, $content );
die AtteanX::Endpoint::ClientError->new(code => 400, message => 'Multiple query strings not allowed', uri => 'http://id.kasei.us/rdf-endpoint/error/multiple_queries');
} else {
$sparql = $sparql[0];
}
} elsif ($req->param('update')) {
my @sparql = $req->param('update');
if (scalar(@sparql) > 1) {
$content = "More than one update string submitted";
$self->log_error( $req, $content );
die AtteanX::Endpoint::ClientError->new(code => 400, message => 'Multiple update strings not allowed', uri => 'http://id.kasei.us/rdf-endpoint/error/multiple_updates');
}
if ($config->{endpoint}{update} and $req->method eq 'POST') {
$sparql = $sparql[0];
} elsif ($req->method ne 'POST') {
my $method = $req->method;
$content = "Update operations must use POST";
$self->log_error( $req, $content );
$response->header('Allow' => 'POST');
die AtteanX::Endpoint::ClientError->new(code => 405, message => "$method Not Allowed for Update Operation", uri => 'http://id.kasei.us/rdf-endpoint/error/bad_http_method_update');
}
}
if ($sparql) {
my %args;
$args{ update } = 1 if ($config->{endpoint}{update} and $req->method eq 'POST');
$args{ load_data } = 1 if ($config->{endpoint}{load_data});
my $protocol_specifies_update_dataset = 0;
{
my @default = $req->param('default-graph-uri');
my @named = $req->param('named-graph-uri');
lib/AtteanX/Endpoint.pm view on Meta::CPAN
my $error = $@ || 'Internal error';
$self->log_error( $req, $error );
my $eclass = ($error =~ /Syntax/) ? 'AtteanX::Endpoint::ClientError' : 'AtteanX::Endpoint::ServerError';
if ($req->method ne 'POST' and $error =~ /read-only queries/sm) {
$error = 'Updates must use a HTTP POST request.';
die $eclass->new(message => 'Updates must use a HTTP POST request', uri => 'http://id.kasei.us/rdf-endpoint/error/bad_http_method_update');
} else {
die $eclass->new(message => 'SPARQL query/update parse error', uri => 'http://id.kasei.us/rdf-endpoint/error/parse_error', details => { error => $error, sparql => $sparql });
}
} else {
$self->log_query( $req, $sparql );
# TODO: handle case where query specifies update dataset
# if ($protocol_specifies_update_dataset and $query->specifies_update_dataset) {
# my $method = $req->method;
# $content = "Update operations cannot specify a dataset in both the query and with protocol parameters";
# $self->log_error( $req, $content );
# die AtteanX::Endpoint::ClientError->new(code => 400, message => 'Multiple datasets specified for update', uri => 'http://id.kasei.us/rdf-endpoint/error/update_specifies_multiple_datasets');
# }
if ($self->log->is_trace) {
$self->log->trace("Algebra:\n" . $algebra->as_string);
}
my $graph = $self->graph;
lib/AtteanX/Endpoint.pm view on Meta::CPAN
$response->headers->content_type($stype);
};
if ($@) {
my $error = $@;
$self->log->fatal($error);
die AtteanX::Endpoint::ServerError->new(code => 500, message => 'SPARQL query/update execution error', uri => 'http://id.kasei.us/rdf-endpoint/error/execution_error', details => { error => $@, sparql => $sparql });
}
}
} elsif ($req->method eq 'POST') {
$content = "POST without recognized query or update";
$self->log_error( $req, $content );
die AtteanX::Endpoint::ClientError->new(message => 'Missing SPARQL Query/Update String', uri => 'http://id.kasei.us/rdf-endpoint/error/missing_sparql_string');
} else {
my $stype = 'text/html';
my $dir = $ENV{ATTEAN_ENDPOINT_SHAREDIR} || File::Spec->catdir((eval { dist_dir('AtteanX-Endpoint') } || 'share'), 'endpoint');
my $template = File::Spec->catfile($dir, 'index.html');
my $parser = XML::LibXML->new(validation => 0, suppress_errors => 1, no_network => 1, recover => 2);
my $doc = $parser->parse_file( $template );
# my $gen = RDF::RDFa::Generator->new( style => 'HTML::Head');
# $gen->inject_document($doc, $sdmodel);
lib/AtteanX/Endpoint.pm view on Meta::CPAN
=back
=head1 BUGS
Please report any bugs or feature requests to through the GitHub web interface
at L<https://github.com/kasei/atteanx-endpoint/issues>.
=head1 SEE ALSO
L<http://www.perlrdf.org/>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AtteanX/Query/AccessPlan/Cache.pm view on Meta::CPAN
my $model = shift;
my $active_graphs = shift;
my $pattern = shift;
# First, add any plans coming from the original planner (which will
# include queries to the remote SPARQL endpoint
my @plans = $orig->(@params);
my @vars = $pattern->values_consuming_role('Attean::API::Variable');
my @varstrings = map { $_->value } @vars;
# Start checking the cache
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AtteanX/RDFQueryTranslator.pm view on Meta::CPAN
my $s = $self->translate($a->start);
my $o = $self->translate($a->end);
my $path = $self->translate_path($a->path);
return Attean::Algebra::Path->new( subject => $s, path => $path, object => $o );
} elsif ($a->isa('RDF::Query::Algebra::Service')) {
my $endpoint = $self->translate($a->endpoint);
my $p = $self->translate($a->pattern);
return Attean::Algebra::Service->new( children => [$p], endpoint => $endpoint );
} elsif ($a->isa('RDF::Query::Algebra::NamedGraph')) {
my $graph = $self->translate($a->graph);
my $p = $self->translate($a->pattern);
return Attean::Algebra::Graph->new( children => [$p], graph => $graph );
} elsif ($a->isa('RDF::Query::Algebra::Filter')) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AtteanX/Query/AccessPlan/LDF.pm view on Meta::CPAN
my $model = shift;
my $active_graphs = shift;
my $pattern = shift;
# First, add any plans coming from the original planner (which will
# include queries to the remote SPARQL endpoint
my @plans = $orig->(@params);
# Add my plans
push(@plans, AtteanX::Plan::LDF::Triple->new(subject => $pattern->subject,
predicate => $pattern->predicate,
object => $pattern->object,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AtteanX/Model/SPARQL.pm view on Meta::CPAN
AtteanX::Model::SPARQL - Attean SPARQL Model
=head1 SYNOPSIS
my $store = Attean->get_store('SPARQL')->new(endpoint_url => $url);
my $model = AtteanX::Model::SPARQL->new( store => $store );
=head1 DESCRIPTION
This model is in practice a thin wrapper around the underlying SPARQL
view all matches for this distribution
view release on metacpan or search on metacpan
t/30-utf8.t view on Meta::CPAN
my $test = Plack::Test->create($app);
my $json = JSON::MaybeXS->new->utf8->allow_nonref;
my $res = $test->request(POST "/faces");
ok $res->is_success, "request to endpoint succeeded";
is $json->decode($res->content), $faces, "request returned expected response";
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Audio/Nama.pm view on Meta::CPAN
add_mark: _add_mark ident { Audio::Nama::drop_mark $item{ident}; 1}
add_mark: _add_mark { Audio::Nama::drop_mark(); 1}
next_mark: _next_mark { Audio::Nama::next_mark(); 1}
previous_mark: _previous_mark { Audio::Nama::previous_mark(); 1}
loop: _loop someval(s) {
my @new_endpoints = @{ $item{"someval(s)"}};
$Audio::Nama::mode->{loop_enable} = 1;
@{$Audio::Nama::setup->{loop_endpoints}} = (@new_endpoints, @{$Audio::Nama::setup->{loop_endpoints}});
@{$Audio::Nama::setup->{loop_endpoints}} = @{$Audio::Nama::setup->{loop_endpoints}}[0,1];
1;}
noloop: _noloop { $Audio::Nama::mode->{loop_enable} = 0; 1}
name_mark: _name_mark ident {$Audio::Nama::this_mark->set_name( $item{ident}); 1}
list_marks: _list_marks {
my $i = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
#
# Authen::Challenge::Basic: Provides a trivial challenge/response protocol
# to assist in authentication tasks. It provides for time-window
# challenge/response sessions.
#
# Using this module, it's possible to autenticate both endpoints of
# a transaction provided that a shared-secret was exchanged prior to
# the session among the endpoints. As timestamps are part of the
# protocol, some restrictions can be applied to the timing, to help
# prevent hijacked connections.
#
# This is free software. You can use at will provided that proper
# credit is given to the author(s). This module requires MD5.
The following functions are provided by this class.
new()
Creates a new instance of a challenge/response endpoint. It has three
parameters that influence its behavior. Those can be seen next
$server = Authen::Challenge::Basic->new ('Secret' => 'known2us',
'Timeout' => 30,
'Sync' => 10);
view all matches for this distribution