package PublishECCU;

# -- generated by SOAP::Lite (v0.60) for Perl -- soaplite.com -- Copyright (C) 2000-2001 Paul Kulchenko --
# -- generated from file:PublishECCU.wsdl [Wed Mar  3 11:35:05 2004]

my %methods = (
  getInfo => {
    endpoint => 'https://control.akamai.com/webservices/services/PublishECCU',
    soapaction => '',
    uri => 'https://control.akamai.com/2003/Sep/PublishECCU.xsd',
    parameters => [
      SOAP::Data->new(name => 'fileId', type => 'xsd:int', attr => {}),
      SOAP::Data->new(name => 'retrieveContents', type => 'xsd:boolean', attr => {}),
    ],
  },
  setNotes => {
    endpoint => 'https://control.akamai.com/webservices/services/PublishECCU',
    soapaction => '',
    uri => 'https://control.akamai.com/2003/Sep/PublishECCU.xsd',
    parameters => [
      SOAP::Data->new(name => 'fileId', type => 'xsd:int', attr => {}),
      SOAP::Data->new(name => 'notes', type => 'xsd:string', attr => {}),
    ],
  },
  upload => {
    endpoint => 'https://control.akamai.com/webservices/services/PublishECCU',
    soapaction => '',
    uri => 'https://control.akamai.com/2003/Sep/PublishECCU.xsd',
    parameters => [
      SOAP::Data->new(name => 'filename', type => 'xsd:string', attr => {}),
      SOAP::Data->new(name => 'contents', type => 'xsd:base64Binary', attr => {}),
      SOAP::Data->new(name => 'notes', type => 'xsd:string', attr => {}),
      SOAP::Data->new(name => 'versionString', type => 'xsd:string', attr => {}),
      SOAP::Data->new(name => 'propertyName', type => 'xsd:string', attr => {}),
      SOAP::Data->new(name => 'propertyType', type => 'xsd:string', attr => {}),
      SOAP::Data->new(name => 'propertyNameExactMatch', type => 'xsd:boolean', attr => {}),
      SOAP::Data->new(name => 'statusChangeEmail', type => 'xsd:string', attr => {}),
    ],
  },
  delete => {
    endpoint => 'https://control.akamai.com/webservices/services/PublishECCU',
    soapaction => '',
    uri => 'https://control.akamai.com/2003/Sep/PublishECCU.xsd',
    parameters => [
      SOAP::Data->new(name => 'fileId', type => 'xsd:int', attr => {}),
    ],
  },
  setStatusChangeEmail => {
    endpoint => 'https://control.akamai.com/webservices/services/PublishECCU',
    soapaction => '',
    uri => 'https://control.akamai.com/2003/Sep/PublishECCU.xsd',
    parameters => [
      SOAP::Data->new(name => 'fileId', type => 'xsd:int', attr => {}),
      SOAP::Data->new(name => 'statusChangeEmail', type => 'xsd:string', attr => {}),
    ],
  },
  getIds => {
    endpoint => 'https://control.akamai.com/webservices/services/PublishECCU',
    soapaction => '',
    uri => 'https://control.akamai.com/2003/Sep/PublishECCU.xsd',
    parameters => [
    ],
  },
);

use SOAP::Lite;
use Exporter;
use Carp ();

use vars qw(@ISA $AUTOLOAD @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter SOAP::Lite);
@EXPORT_OK = (keys %methods);
%EXPORT_TAGS = ('all' => [@EXPORT_OK]);

no strict 'refs';
for my $method (@EXPORT_OK) {
  my %method = %{$methods{$method}};
  *$method = sub {
    my $self = UNIVERSAL::isa($_[0] => __PACKAGE__) 
      ? ref $_[0] ? shift # OBJECT
                  # CLASS, either get self or create new and assign to self
                  : (shift->self || __PACKAGE__->self(__PACKAGE__->new))
      # function call, either get self or create new and assign to self
      : (__PACKAGE__->self || __PACKAGE__->self(__PACKAGE__->new));
    $self->proxy($method{endpoint} || Carp::croak "No server address (proxy) specified") unless $self->proxy;
    my @templates = @{$method{parameters}};
    my $som = $self
      -> endpoint($method{endpoint})
      -> uri($method{uri})
      -> on_action(sub{qq!"$method{soapaction}"!})
      -> call($method => map {@templates ? shift(@templates)->value($_) : $_} @_); 
    UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ? $som->paramsall : $som->result 
                                        : $som;
  }
}

sub AUTOLOAD {
  my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2);
  return if $method eq 'DESTROY';

  die "Unrecognized method '$method'. List of available method(s): @EXPORT_OK\n";
}

1;
