You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
968 B

  1. import ApiService from '@/services/api.service'
  2. import { TemplateRepository } from '~/domain/models/autoLabeling/templateRepository'
  3. import { ConfigTemplateItem, ConfigResponse } from '~/domain/models/autoLabeling/template'
  4. export class APITemplateRepository implements TemplateRepository {
  5. constructor(
  6. private readonly request = ApiService
  7. ) {}
  8. async list(projectId: string, taskName: string): Promise<string[]> {
  9. const url = `/projects/${projectId}/auto-labeling/templates?task_name=${taskName}`
  10. const response = await this.request.get(url)
  11. const responseItems: string[] = response.data
  12. return responseItems
  13. }
  14. async find(projectId: string, optionName: string): Promise<ConfigTemplateItem> {
  15. const url = `/projects/${projectId}/auto-labeling/templates/${optionName}`
  16. const response = await this.request.get(url)
  17. const responseItem: ConfigResponse = response.data
  18. return ConfigTemplateItem.valueOf(responseItem)
  19. }
  20. }