1.1.1 • Published 1 year ago

@felwine/medium-api v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Medium API

Wrapper for Medium API for

  • Gettting a user
  • Creating posts
  • Getting posts
  • Gettting publications

npm Package NPM Downloads Build Status License: MIT JavaScript Style Guide

Install

yarn add @felwine/medium-api

Use

import {
  MediumClient
} from '@felwine/medium-api'

export default async (payload) => {

  const {
    token,
    title,
    content,
    contentHTML,
    contentFormat = "markdown",
    publishStatus = "draft",
    license = "all-rights-reserved",
    canonicalUrl,
    tags = [],
    notifyFollowers = true
  } = payload

  const client = new MediumClient(token)
  const user = await client.getUser()

  const { id: userId, username } = user

  const post = await client.createPost({
    title,
    content,
    userId,
    contentFormat,   // Defaults to `markdown`
    publishStatus,  // Defaults to `draft`
    tags,
    canonicalUrl,
    license,
  })

  return post
}

License

MIT © servable-community

1.1.1

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago