docs: add imports to example
Signed-off-by: Eric Roberson <emattroberson@gmail.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user