Create Custom Views
User Intent
"How do I create custom views for organized content display? Show me view configuration."
Operation
SDK Method: createView()
Use Case: Organize content into custom views
Code Example (TypeScript)
import { Graphlit } from 'graphlit-client';
const graphlit = new Graphlit();
// Create view for recent documents
const view = await graphlit.createView({
name: "Recent Documents",
description: "Documents from last 30 days",
filter: {
types: [ContentTypes.File],
creationDateRange: {
from: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString()
}
}
});
console.log(`View created: ${view.createView.id}`);
// Query view
const viewContents = await graphlit.queryContents({
filter: {
views: [{ id: view.createView.id }]
}
});Last updated
Was this helpful?