Skip to content

ApiProvider

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/apps/cli/src/providers/api.provider.ts

API data provider Fetches from Atloria REST API

Implements: DataProvider

Methods

MethodSignatureReturns
initializeinitialize(config: DataProviderConfig)Promise<void>
getProjectMetadatagetProjectMetadata()Promise<ProjectMetadata>
getEntitiesgetEntities()Promise<Entity[]>
getEntitiesByTypegetEntitiesByType(type: string)Promise<Entity[]>
getEntityByIdgetEntityById(id: string)`Promise<Entity
getRelationshipsgetRelationships()Promise<Relationship[]>
getRelationshipsForEntitygetRelationshipsForEntity(entityId: string)Promise<Relationship[]>
saveParseResults`saveParseResults(results: ParseResult[], project: DetectedProject, workflowSignals: WorkflowSignals, workflowOptions: {
  enableAiWorkflows?: boolean;
  aiModel?: string;
  forceWorkflowDiscovery?: boolean;
}, businessContextText: string)` | `Promise<void>` |

| saveDocumentation | saveDocumentation(pages: Array<{ slug: string; title: string; description: string; type: string; content: string; order: number; parentSlug?: string; entityId?: string; }>, _navigation: Array<{ title: string; href: string; children?: Array<{ title: string; href: string }>; }>) | Promise<void> | | destroy | destroy() | Promise<void> |

Where it refuses work

  • ApiProvider stops the work with Error when !response.ok, in 2 places.
  • ApiProvider stops the work with Error when !config.apiUrl — “API URL is required for dynamic mode”.
  • ApiProvider stops the work with Error when !config.projectId — “Project ID is required for dynamic mode”.
  • ApiProvider stops the work with an early return when this.entitiesCache.
  • ApiProvider stops the work with an early return when this.relationshipsCache.

When something fails

  • ApiProvider handles failure in 1 place: it turns it into a return value in all 1.

Was this page helpful?

Download as PDF