#!/usr/bin/perl use strict; use warnings; use English; use Getopt::Long; use Pod::Usage; use NGCP::API::Client; use Readonly; Readonly my @required => qw(id); my $opts = { verbose => 0, }; GetOptions( $opts, "help|h" => sub { usage() }, "id=i", "verbose", ) or usage(); sub check_params { my @missing; foreach my $param (@required) { push @missing, $param unless $opts->{$param}; } usage(join(' ', @missing)) if scalar @missing; return; } sub usage { my $missing = shift; pod2usage(-exitval => $missing ? 1 : 0, -verbose => 99, -sections => 'SYNOPSIS|REQUIRED ARGUMENTS|OPTIONS', -message => $missing ? "Missing parameters: $missing" : '', ); return; } sub main { check_params(); my $uri = '/api/soundsets/'; $uri .= $opts->{id} ? $opts->{id} : ''; my $client = new NGCP::API::Client; $client->set_verbose($opts->{verbose}); my $res = $client->request("GET", $uri); $res->is_success ? print $res->content."\n" : print $res->result."\n"; exit !$res->is_success; return; } main(); exit 0; __END__ =head1 NAME ngcp-sound-set - retreives an NGCP Sound Set =head1 SYNOPSIS B [I...] I... =head1 DESCRIPTION B retreives a sound set from the NGCP platform. =head1 REQUIRED ARGUMENTS =over 8 =item B<--id> I Sound set ID. =back =head1 OPTIONS =over 8 =item B<--verbose> Show additional debug information. Default false. =item B<--help> Print a brief help message. =back =head1 EXIT STATUS Exit code 0 means everything is ok otherwise 1. =head1 SEE ALSO NGCP::API::Client =head1 BUGS AND LIMITATIONS Please report problems you notice to the Sipwise Development Team . =head1 AUTHOR Victor Seva =head1 LICENSE Copyright (C) 2016 Sipwise GmbH, Austria This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . =cut