docs: add imports to example

Signed-off-by: Eric Roberson <emattroberson@gmail.com>
This commit is contained in:
Eric Roberson
2025-03-18 08:05:15 -07:00
parent 27d10316ca
commit a580e574ec
2 changed files with 14 additions and 2 deletions
@@ -1157,6 +1157,12 @@ export class MyIncrementalEntityProvider
The last step is to implement the actual `next` method that will accept the cursor, call the API, process the result and return the result.
```ts
import {
ANNOTATION_LOCATION,
ANNOTATION_ORIGIN_LOCATION,
} from '@backstage/catalog-model';
import { IncrementalEntityProvider } from '@backstage/plugin-catalog-backend-module-incremental-ingestion';
export class MyIncrementalEntityProvider
implements IncrementalEntityProvider<Cursor, Context>
{
@@ -1183,7 +1189,7 @@ export class MyIncrementalEntityProvider
cursor: Cursor = { page: 1 },
): Promise<EntityIteratorResult<Cursor>> {
const { apiClient } = context;
const location = `${this.getProviderName()}:${mySource}`;
const location = `${this.getProviderName()}:${this.mySource}`;
// call your API with the current cursor
const data = await apiClient.getServices(cursor);
@@ -208,6 +208,12 @@ export class MyIncrementalEntityProvider
The last step is to implement the actual `next` method that will accept the cursor, call the API, process the result and return the result.
```ts
import {
ANNOTATION_LOCATION,
ANNOTATION_ORIGIN_LOCATION,
} from '@backstage/catalog-model';
import { IncrementalEntityProvider } from '@backstage/plugin-catalog-backend-module-incremental-ingestion';
export class MyIncrementalEntityProvider implements IncrementalEntityProvider<Cursor, Context> {
token: string;
@@ -232,7 +238,7 @@ export class MyIncrementalEntityProvider implements IncrementalEntityProvider<Cu
async next(context: Context, cursor?: Cursor = { page: 1 }): Promise<EntityIteratorResult<Cursor>> {
const { apiClient } = context;
const location = `${this.getProviderName()}:${mySource}`;
const location = `${this.getProviderName()}:${this.mySource}`;
// call your API with the current cursor
const data = await apiClient.getServices(cursor);