API-Medium

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


- OAuth2 Login
- Get a new access\_token from refresh\_token
- `publications`
- `contributors`

## Thanks

Thanks to Dave Cross for starting [Cultured
Perl](https://medium.com/cultured-perl), which prompted me to write
this module so I can auto-post blogposts from [my private
blog](http://domm.plix.at) to medium.

# AUTHOR

Thomas Klausner <domm@plix.at>

# COPYRIGHT AND LICENSE

This software is copyright (c) 2016 - 2021 by Thomas Klausner.

This is free software; you can redistribute it and/or modify it under

lib/API/Medium.pm  view on Meta::CPAN

package API::Medium;

# ABSTRACT: Talk with medium.com using their REST API
our $VERSION = '0.902'; # VERSION

use Moose;
use HTTP::Tiny;
use Log::Any qw($log);
use JSON::MaybeXS;
use Module::Runtime 'use_module';

has 'server' => (
    isa     => 'Str',
    is      => 'ro',
    default => 'https://api.medium.com/v1',
);

has 'access_token' => (

lib/API/Medium.pm  view on Meta::CPAN

        $res = $self->_client->request( $method, $url,
            { content => encode_json($data) } );
    }
    else {
        $res = $self->_client->request( $method, $url );
    }
    if ( $res->{success} ) {
        return decode_json( $res->{content} );
    }
    else {
        $log->errorf( "Could not talk to medium: %i %s",
            $res->{status}, $res->{reason} );
        die join( ' ', $res->{status}, $res->{reason} );
    }
}

__PACKAGE__->meta->make_immutable;
1;

__END__

lib/API/Medium.pm  view on Meta::CPAN

=item * C<publications>

=item * C<contributors>

=back

=head2 Thanks

Thanks to Dave Cross for starting L<Cultured
Perl|https://medium.com/cultured-perl>, which prompted me to write
this module so I can auto-post blogposts from L<my private
blog|http://domm.plix.at> to medium.

=head1 AUTHOR

Thomas Klausner <domm@plix.at>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2016 - 2021 by Thomas Klausner.

This is free software; you can redistribute it and/or modify it under



( run in 1.230 second using v1.01-cache-2.11-cpan-49f99fa48dc )