//native
/**
* Push Blog Post Draft Live
* Publish the draft version of a blog post, replacing the live version. Requires the content scope.
*/
export async function main(auth: RT.Hubspot, blog_post_id: string) {
const url = new URL(
`https://api.hubapi.com/cms/v3/blogs/posts/${blog_post_id}/draft/push-live`
)
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
if (response.status === 204) return { success: true }
return await response.json()
}
Submitted by hugo989 5 hours ago