Get Content Details

User Intent

"I want to retrieve full details for a specific content item"

Operation

  • SDK Method: graphlit.getContent()

  • GraphQL: getContent query

  • Entity Type: Content

  • Common Use Cases: View content details, access extracted markdown, check metadata

TypeScript (Canonical)

import { Graphlit } from 'graphlit-client';
import { ContentTypes, EntityState, FileTypes } from 'graphlit-client/dist/generated/graphql-types';

const graphlit = new Graphlit();

// Content IDs are GUIDs (e.g., '550e8400-e29b-41d4-a716-446655440000')
const contentId = 'content-id-here';

// Get full content details
const content = await graphlit.getContent(contentId);

console.log(`\nContent: ${content.content.name}`);
console.log(`Type: ${content.content.type}`);
console.log(`State: ${content.content.state}`);
console.log(`Created: ${content.content.creationDate}`);

// Access extracted text
if (content.content.markdown) {
  console.log(`\nExtracted text (first 500 chars):`);
  console.log(content.content.markdown.substring(0, 500));
}

// Check file details
if (content.content.fileType) {
  console.log(`\nFile Type: ${content.content.fileType}`);
  console.log(`File Size: ${content.content.fileSize} bytes`);
}

// Access URI
if (content.content.uri) {
  console.log(`URI: ${content.content.uri}`);
}

Parameters

  • id (string): Content ID

Response

{
  content: {
    id: string;
    name: string;
    type: ContentTypes;
    state: EntityState;
    creationDate: Date;
    markdown?: string;
    summary?: string;
    uri?: string;
    fileType?: FileTypes;
    fileSize?: number;
    // Many more fields...
  }
}

Developer Hints

Access Extracted Content

const content = await graphlit.getContent(contentId);

// Full extracted markdown
console.log(content.content.markdown);

// Auto-generated summary
console.log(content.content.summary);

// Custom summary (if set)
console.log(content.content.customSummary);

Check Processing State

const content = await graphlit.getContent(contentId);

if (content.content.state === EntityState.Finished) {
  console.log(' Processing complete');
} else {
  console.log('⏳ Still processing');
}

Variations

1. Basic Content Retrieval

const content = await graphlit.getContent(contentId);
console.log(content.content.name);

2. Get Extracted Text

const content = await graphlit.getContent(contentId);
const markdown = content.content.markdown;
console.log(markdown);

3. Check File Details

const content = await graphlit.getContent(contentId);
console.log(`File: ${content.content.fileType}`);
console.log(`Size: ${content.content.fileSize} bytes`);

Last updated

Was this helpful?