c3nav
Version:
A c3nav API client
52 lines (51 loc) • 2.56 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LibrariesIO = void 0;
const axios_1 = require("axios");
const api_1 = require("./api");
class LibrariesIO {
constructor(options) {
if (typeof options === 'string') {
options = { apiUrl: options };
}
this.apiClient = axios_1.default.create({
baseURL: 'https://c3nav.de/api/',
});
this.api = {
accessRestrictionGroups: new api_1.AccessRestrictionGroupsAPI(this.apiClient, options),
accessRestrictions: new api_1.AccessRestrictionsAPI(this.apiClient, options),
areas: new api_1.AreasAPI(this.apiClient, options),
buildings: new api_1.BuildingsAPI(this.apiClient, options),
changesets: new api_1.ChangesetsAPI(this.apiClient, options),
columns: new api_1.ColumnsAPI(this.apiClient, options),
crossDescriptions: new api_1.CrossDescriptionsAPI(this.apiClient, options),
doors: new api_1.DoorsAPI(this.apiClient, options),
editor: new api_1.EditorAPI(this.apiClient, options),
holes: new api_1.HolesAPI(this.apiClient, options),
leaveDescriptions: new api_1.LeaveDescriptionsAPI(this.apiClient, options),
levels: new api_1.LevelListAPI(this.apiClient, options),
lineObstacles: new api_1.LineObstaclesAPI(this.apiClient, options),
locationGroupCategories: new api_1.LocationGroupCategoriesAPI(this.apiClient, options),
locationGroups: new api_1.LocationGroupsAPI(this.apiClient, options),
locations: new api_1.LocationsAPI(this.apiClient, options),
map: new api_1.MapAPI(this.apiClient, options),
obstacles: new api_1.ObstaclesAPI(this.apiClient, options),
pois: new api_1.PoisAPI(this.apiClient, options),
ramps: new api_1.RampsAPI(this.apiClient, options),
routing: new api_1.RoutingAPI(this.apiClient, options),
session: new api_1.SessionAPI(this.apiClient, options),
sources: new api_1.SourcesAPI(this.apiClient, options),
spaces: new api_1.SpacesAPI(this.apiClient, options),
stairs: new api_1.StairsAPI(this.apiClient, options),
updates: new api_1.UpdatesAPI(this.apiClient, options),
};
}
/**
* Set a new API URL.
* @param newUrl The new API URL
*/
setApiUrl(newUrl) {
this.apiClient.defaults.baseURL = newUrl;
}
}
exports.LibrariesIO = LibrariesIO;