Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import GhostContentAPI, { PostOrPage } from '@tryghost/content-api';
const api = GhostContentAPI({ url: 'test', version: 'v3', key: '' }); // $ExpectType GhostAPI
let pages: PostOrPage[];
const pagesBrowsePromise = api.pages.browse(); // $ExpectType Promise
pagesBrowsePromise.then(pageObject => {
pages = pageObject.pages;
api.pages.read(pages[0], { include: 'authors' }); // $ExpectType Promise
});
import GhostContentAPI from "@tryghost/content-api";
// Create API instance with site credentials
const api = new GhostContentAPI({
url: 'https://overthought.ghost.io',
key: 'a731438732f44c2cdf30dd4955',
version: "v3"
});
export async function getPosts() {
return await api.posts
.browse({
limit: "all"
})
.catch(err => {
console.error(err);
});
}
function isFeatured(post) {
import GhostContentAPI from '@tryghost/content-api'
import { Post } from './domain'
const api = GhostContentAPI({
url: process.env.GHOST_URL || '',
key: process.env.GHOST_KEY || '',
version: 'canary',
})
const getPosts = async (): Promise => {
const response = await api.posts.browse({
limit: 5,
include: ['authors', 'tags'],
formats: ['html'],
})
if (!response) {
return []
}
this.resultTemplate = resultTemplate
this.singleResultTemplate = singleResultTemplate
this.showResult = document.querySelector(showResult)
this.excerpt_length = excerpt_length
this.time_format = time_format
/**
* trigger when user type to search
*/
this.input.addEventListener('keyup', this.doSearch)
/**
* Initialize ghost content api constructor
*/
this.api = new GhostContentAPI({
url: this.homeUrl,
key: this.contentApiKey,
version: 'v3',
})
}