SYNOPSIS

use DNS::Hetzner;

my $api_key = '1234abc';
my $dns     = DNS::Hetzner->new(
    token => $api_key,
);

$dns->records->create(
);

ATTRIBUTES

  • endpoint

METHODS

%s ~, $methods_pod;

my $code = sprintf q~package DNS::Hetzner::API::%s;

# ABSTRACT: %s

# --- # This class is auto-generated by bin/get_hetzner_info.pl # ---

use v5.24;

use Moo; use Types::Standard qw(:all);

use Mojo::Base -strict, -signatures;

extends 'DNS::Hetzner::APIBase';

with 'MooX::Singleton';

use DNS::Hetzner::Schema; use Carp;

has endpoint => ( is => 'ro', isa => Str, default => sub { '%s' } ); %s

1;

__END__

%s ~, $class, $class, $endpoint, $subs, $pod;

return $code;
}

sub _get_sub ( $operation_id, $method, $class, $uri ) { my $method_name = decamelize $operation_id;

$method_name = 'list' if $method_name eq 'get_' . $class;

$class =~ s{s\z}{};
$method_name =~ s{_${class}s?}{};

my $sub = sprintf q~
sub %s ($self, %params) {
$self->_do( '%s', \%params, '%s', { type => '%s' } );
}
~, $method_name, $operation_id, $uri, $method;

return ($sub, $method_name);
}

sub _get_pod ( $method, $description, $object, $endpoint, $params = '') { my $pod = sprintf q~

%s

%s

$dns->%s->%s(%s);
~,
    $method, $description, $endpoint, $method, $params;

return $pod;
}

sub _get_schema_package ( $path, $data ) { my ($code) = split /__DATA__/, $path->slurp; $code .= sprintf q! __DATA__ @@ openapi.json %s !, JSON::XS->new->utf8(1)->pretty(1)->encode( $data );

return $code;
}

__END__

NAME

get_hcloud_info.pl - get API definitions from docs.hetzner.cloud

VERSION

version 0.02

AUTHOR

Renee Baecker <reneeb@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2020 by Renee Baecker.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)