1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { LinkService } from "../link-service/link-service";
6 import { LinkClass } from "~/models/link";
7 import { FilterBuilder } from "~/services/api/filter-builder";
8 import { TagTailType, TagResource } from "~/models/tag";
9 import { OrderBuilder } from "~/services/api/order-builder";
11 export class TagService {
13 constructor(private linkService: LinkService) { }
15 create(uuid: string, data: { key: string; value: string } ) {
16 return this.linkService
19 tailUuid: TagTailType.COLLECTION,
20 linkClass: LinkClass.TAG,
24 .then(tag => tag as TagResource );
28 const filters = new FilterBuilder()
29 .addEqual("head_uuid", uuid)
30 .addEqual("tail_uuid", TagTailType.COLLECTION)
31 .addEqual("link_class", LinkClass.TAG)
34 const order = new OrderBuilder<TagResource>()
38 return this.linkService
39 .list({ filters, order })
41 return results.items.map((tag => tag as TagResource ));