@felwine/medium-api
v1.1.1
Published
Wrapper for Medium API for - Gettting a user - Creating posts - Getting posts - Gettting publications
Downloads
6
Readme
Medium API
Wrapper for Medium API for
- Gettting a user
- Creating posts
- Getting posts
- Gettting publications
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