Created
August 16, 2019 01:36
-
-
Save banyudu/2002ab5272608e0eeff4595b1d40e5a3 to your computer and use it in GitHub Desktop.
Fetch yuque article by token、bookId and slug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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