UNPKG

@eclipse-scout/core

Version:
64 lines 2.55 kB
import { InitModelOf, ObjectModel, ObjectWithType } from '../scout'; import { SomeRequired } from '../types'; /** * Represents a REST backend system. */ export declare class System implements SystemModel, ObjectWithType { model: SystemModel; initModel: SomeRequired<this['model'], 'name'>; self: System; objectType: string; name: string; baseUrl: string; hasUiBackend: boolean; protected _endpointUrls: Map<string, string>; /** * The default system name. It is configured to have a UI backend (see {@link setHasUiBackend}). */ static MAIN_SYSTEM: string; constructor(); init(model: InitModelOf<this>): void; /** * Sets a new base URL. This is the (typically relative) URL under which all REST endpoints of this system are available. * @param baseUrl The new base URL. */ setBaseUrl(baseUrl: string): void; /** * Specifies if this system has a Scout UI backend. */ setHasUiBackend(hasUiBackend: boolean): void; /** * Sets the URL relative to the base URL of this system for a named endpoint. * @param endpointName The endpoint identifier for which the relative URL should be updated. * @param endpointUrl The new endpoint url relative to the {@link baseUrl} of this system. */ setEndpointUrl(endpointName: string, endpointUrl: string): void; /** * @returns the endpoints to load config properties. */ getConfigEndpointUrls(): string[]; /** * @returns The full URL including the {@link baseUrl} to the endpoint with given name. The result is always without trailing slash. */ getEndpointUrl(endpointName: string, defaultEndpoint?: string): string; protected _concatPath(a: string, b: string): string; } export interface SystemModel extends ObjectModel<System> { /** * The name of the system. Default is {@link System.MAIN_SYSTEM}. */ name?: string; /** * The base URL of the system. This is the (typically relative) URL under which all REST endpoints of this system are available. */ baseUrl?: string; /** * Specifies if the system has a Scout UI server running. If {@code true} the {@link System.getConfigEndpointUrls} returns the path to the UI instead (config properties are loaded from the UI). */ hasUiBackend?: boolean; /** * A map with initial endpoint URLs. The key is the endpoint name, the value the system relative URL. */ endpointUrls?: Record<string, string>; } //# sourceMappingURL=System.d.ts.map