API-Medium

 view release on metacpan or  search on metacpan

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

=head3 OAuth2 Login

Not implemented yet, mostly because medium only support the "web
server" flow and I'm using C<API::Medium> for an installed
application.

=head3 Self-issued access token / Integration token

Go to your L<settings|https://medium.com/me/settings>, scroll down to
"Integration tokens", and either create a new one, or pick the one you
want to use.

=head1 Methods

=head2 new

  my $m = API::Medium->new({
       access_token => $token,
  });

Create a new API client. You will need to pass in your C<$token>, see
above on how to get it. Please make sure no not leak your Integration
Token. If you do, anybody who has it can take over your Medium page!

=head2 get_current_user

  my $data = $m->get_current_user;

Fetch the User "object".

You will need this to get the user C<id> for posting. Depending on
your app you might want to store your C<id> in some config file to
save one API call.

=head2 publications

Not implemented yet. Listing the user's publications

  /users/{{userId}}/publications

=head2 contributors

Not implemented yet. Fetching contributors for a publication.

  /publications/{{publicationId}}/contributors

=head2 create_post

  my $url = $m->create_post( $user_id, $post_data );

Create a new post. If you pass in bad data, Medium will probably
report an error.

C<publishStatus> is set to 'draft' unless you pass in another value.

=head2 create_publication_post

  my $url = $m->create_publication_post( $publication_id, $post_data );

Create a new post under a publication. You will need to figure out the
publication_id by calling the API from the commandline (until
C<publications> is implemented.)

If you pass in bad data, Medium will probably report an error.

C<publishStatus> is set to 'draft' unless you pass in another value.

=head2 TODO

=over

=item * OAuth2 Login

=item * Get a new access_token from refresh_token

=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
the same terms as the Perl 5 programming language system itself.

=cut



( run in 1.084 second using v1.01-cache-2.11-cpan-0d23b851a93 )