API-Medium

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


Not implemented yet. Fetching contributors for a publication.

    /publications/{{publicationId}}/contributors

## 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.

`publishStatus` is set to 'draft' unless you pass in another value.

## 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
`publications` is implemented.)

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

`publishStatus` is set to 'draft' unless you pass in another value.

## TODO

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

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


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



( run in 0.350 second using v1.01-cache-2.11-cpan-65fba6d93b7 )