Rename updator -> updater
[arvados.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 { AuthService } from "./auth-service/auth-service";
6 import { GroupsService } from "./groups-service/groups-service";
7 import { ProjectService } from "./project-service/project-service";
8 import { LinkService } from "./link-service/link-service";
9 import { FavoriteService } from "./favorite-service/favorite-service";
10 import { AxiosInstance } from "axios";
11 import { CollectionService } from "./collection-service/collection-service";
12 import Axios from "axios";
13 import { CollectionFilesService } from "./collection-files-service/collection-files-service";
14
15 export interface ServiceRepository {
16     apiClient: AxiosInstance;
17
18     authService: AuthService;
19     groupsService: GroupsService;
20     projectService: ProjectService;
21     linkService: LinkService;
22     favoriteService: FavoriteService;
23     collectionService: CollectionService;
24     collectionFilesService: CollectionFilesService;
25 }
26
27 export const createServices = (baseUrl: string): ServiceRepository => {
28     const apiClient = Axios.create();
29     apiClient.defaults.baseURL = `${baseUrl}/arvados/v1`;
30
31     const authService = new AuthService(apiClient, baseUrl);
32     const groupsService = new GroupsService(apiClient);
33     const projectService = new ProjectService(apiClient);
34     const linkService = new LinkService(apiClient);
35     const favoriteService = new FavoriteService(linkService, groupsService);
36     const collectionService = new CollectionService(apiClient);
37     const collectionFilesService = new CollectionFilesService(collectionService);
38
39     return {
40         apiClient,
41         authService,
42         groupsService,
43         projectService,
44         linkService,
45         favoriteService,
46         collectionService,
47         collectionFilesService
48     };
49 };