Google-RestApi

 view release on metacpan or  search on metacpan

lib/Google/RestApi/DriveApi3/Drive.pm  view on Meta::CPAN

package Google::RestApi::DriveApi3::Drive;

our $VERSION = '1.1.0';

use Google::RestApi::Setup;

use parent 'Google::RestApi::SubResource';

sub new {
  my $class = shift;
  state $check = signature(
    bless => !!0,
    named => [
      drive_api => HasApi,
      id        => Str, { optional => 1 },
    ],
  );
  return bless $check->(@_), $class;
}

sub _uri_base { 'drives' }
sub _parent_accessor { 'drive_api' }

sub get {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      fields                  => Str, { optional => 1 },
      use_domain_admin_access => Bool, { default => 0 },
    ],
  );
  my $p = $check->(@_);

  $self->require_id('get');

  my %params;
  $params{fields} = $p->{fields} if defined $p->{fields};
  $params{useDomainAdminAccess} = 'true' if $p->{use_domain_admin_access};

  return $self->api(params => \%params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      name                    => Str, { optional => 1 },
      color_rgb               => Str, { optional => 1 },
      theme_id                => Str, { optional => 1 },
      background_image_file   => HashRef, { optional => 1 },
      restrictions            => HashRef, { optional => 1 },
      use_domain_admin_access => Bool, { default => 0 },
      _extra_                 => slurpy HashRef,
    ],
  );
  my $p = named_extra($check->(@_));

  $self->require_id('update');

  my %params;
  $params{useDomainAdminAccess} = 'true' if delete $p->{use_domain_admin_access};

  my %content;
  $content{name} = delete $p->{name} if defined $p->{name};
  $content{colorRgb} = delete $p->{color_rgb} if defined $p->{color_rgb};
  $content{themeId} = delete $p->{theme_id} if defined $p->{theme_id};
  $content{backgroundImageFile} = delete $p->{background_image_file}
    if defined $p->{background_image_file};
  $content{restrictions} = delete $p->{restrictions} if defined $p->{restrictions};

  DEBUG(sprintf("Updating shared drive '%s'", $self->{id}));
  return $self->api(
    method  => 'patch',
    params  => \%params,
    content => \%content,
  );
}

sub delete {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      use_domain_admin_access => Bool, { default => 0 },
      allow_item_deletion     => Bool, { default => 0 },
    ],
  );
  my $p = $check->(@_);

  $self->require_id('delete');

  my %params;
  $params{useDomainAdminAccess} = 'true' if $p->{use_domain_admin_access};
  $params{allowItemDeletion} = 'true' if $p->{allow_item_deletion};

  DEBUG(sprintf("Deleting shared drive '%s'", $self->{id}));
  return $self->api(method => 'delete', params => \%params);
}

sub hide {
  my $self = shift;



( run in 1.534 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )