App-WatchLater

 view release on metacpan or  search on metacpan

lib/App/WatchLater/YouTube.pm  view on Meta::CPAN


  bless {
    http  => $http,
    key   => $key,
    token => $token,
  } => $class;
}

=head2 request

    my $body = $api->request($method, $endpoint, %params);

Send a request to the specified API endpoint using the given HTTP method. Query
parameters may be specified in C<%params>. Croaks if the request fails.

=cut

sub request {
  my ($self, $method, $endpoint, %params) = @_;
  my $url = 'https://www.googleapis.com/youtube/v3' . $endpoint;

  my %headers;

  if (defined $self->{token}) {
    $headers{Authorization} = 'Bearer ' . $self->{token};
  } else {
    $params{key} ||= $self->{key};
  }

  my $query = $self->{http}->www_form_urlencode(\%params);

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.443 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )