UNPKG

@prefecthq/prefect-ui-library

Version:

This library is the Vue and Typescript component library for [Prefect 2](https://github.com/PrefectHQ/prefect) and [Prefect Cloud 2](https://www.prefect.io/cloud/). _The components and utilities in this project are not meant to be used independently_.

17 lines (14 loc) 778 B
import { CollectionItem, CollectionsResponse, PrefectWorkerCollectionResponse, WorkerCollectionItem } from '@/models' import { Api } from '@/services/Api' import { mapper } from '@/services/Mapper' export class CollectionsApi extends Api { protected override routePrefix = '/collections' public getFlowCollection(): Promise<CollectionItem[]> { return this.get<CollectionsResponse>('/views/aggregate-flow-metadata') .then(({ data }) => mapper.map('CollectionResponse', data, 'CollectionItems')) } public getWorkerCollection(): Promise<WorkerCollectionItem[]> { return this.get<PrefectWorkerCollectionResponse>('/views/aggregate-worker-metadata') .then(({ data }) => mapper.map('PrefectWorkerCollectionResponse', data, 'WorkerCollectionItem')) } }