@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) • 671 B
text/typescript
import { State, StateResponse } from '@/models'
import { mapper } from '@/services/Mapper'
import { WorkspaceApi } from '@/services/WorkspaceApi'
export class WorkspaceFlowRunStatesApi extends WorkspaceApi {
protected override routePrefix = '/flow_run_states'
public async getFlowRunState(flowRunId: string): Promise<State> {
const { data } = await this.get<StateResponse>(`/${flowRunId}`)
return mapper.map('StateResponse', data, 'State')
}
public async getFlowRunStates(flowRunId: string): Promise<State[]> {
const { data } = await this.get<StateResponse[]>(`?flow_run_id=${flowRunId}`)
return mapper.map('StateResponse', data, 'State')
}
}