Add typescript paths to top level folders
[arvados-workbench2.git] / src / services / services.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import Axios, { AxiosInstance } from "axios";
6 import { AuthService } from "./auth-service/auth-service";
7 import { GroupsService } from "./groups-service/groups-service";
8 import { ProjectService } from "./project-service/project-service";
9 import { LinkService } from "./link-service/link-service";
10 import { FavoriteService } from "./favorite-service/favorite-service";
11 import { CollectionService } from "./collection-service/collection-service";
12 import { TagService } from "./tag-service/tag-service";
13 import { CollectionFilesService } from "./collection-files-service/collection-files-service";
14 import { KeepService } from "./keep-service/keep-service";
15
16 export interface ServiceRepository {
17     apiClient: AxiosInstance;
18
19     authService: AuthService;
20     keepService: KeepService;
21     groupsService: GroupsService;
22     projectService: ProjectService;
23     linkService: LinkService;
24     favoriteService: FavoriteService;
25     tagService: TagService;
26     collectionService: CollectionService;
27     collectionFilesService: CollectionFilesService;
28 }
29
30 export const createServices = (baseUrl: string): ServiceRepository => {
31     const apiClient = Axios.create();
32     apiClient.defaults.baseURL = `${baseUrl}/arvados/v1`;
33
34     const authService = new AuthService(apiClient, baseUrl);
35     const keepService = new KeepService(apiClient);
36     const groupsService = new GroupsService(apiClient);
37     const projectService = new ProjectService(apiClient);
38     const linkService = new LinkService(apiClient);
39     const favoriteService = new FavoriteService(linkService, groupsService);
40     const collectionService = new CollectionService(apiClient, keepService);
41     const tagService = new TagService(linkService);
42     const collectionFilesService = new CollectionFilesService(collectionService);
43
44     return {
45         apiClient,
46         authService,
47         keepService,
48         groupsService,
49         projectService,
50         linkService,
51         favoriteService,
52         collectionService,
53         tagService,
54         collectionFilesService
55     };
56 };