//native
/**
* Get a category
* Get a category in your ReadMe project.
>📘
> This route is only available to projects that are using [ReadMe Refactored](https://docs.readme.com/main/docs/welcome-to-readme-refactored).
*/
export async function main(
auth: RT.Readme,
section: 'guides' | 'reference' = 'guides',
title: string,
branch: string
) {
const url = new URL(`https://api.readme.com/v2/branches/${branch}/categories/${section}/${title}`)
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago