Skip to content

Instantly share code, notes, and snippets.

@banyudu
Created August 16, 2019 01:36
Show Gist options
  • Save banyudu/2002ab5272608e0eeff4595b1d40e5a3 to your computer and use it in GitHub Desktop.
Save banyudu/2002ab5272608e0eeff4595b1d40e5a3 to your computer and use it in GitHub Desktop.
Fetch yuque article by token、bookId and slug
import * as SDK from '@yuque/sdk'
const syncArticle = async (token: string, bookId: number | string, slug: number) => {
const client = new SDK({
token: token || process.env.YUQUE_TOKEN || undefined
})
const article = await client.docs.get({
namespace: bookId,
slug,
data: {
raw: 1
}
})
return article.body
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment