Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed api calls with double slashes #32

Merged
merged 2 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0
3.1.1
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ import RestClientBase from "./RestClientBase";

export default class CommonRestClient extends RestClientBase {
public serverTime(): Promise<ServerTimeResponse> {
return this.get<ServerTimeResponse>("/time", new ServerTimeResponse());
return this.get<ServerTimeResponse>("time", new ServerTimeResponse());
}

public applicationInfo(): Promise<ApplicationInformationResponse> {
return this.get<ApplicationInformationResponse>("/info/application", new ApplicationInformationResponse());
return this.get<ApplicationInformationResponse>("info/application", new ApplicationInformationResponse());
}

public applicationLoad(): Promise<ApplicationLoadResponse> {
return this.get<ApplicationLoadResponse>("/info/application/load", new ApplicationLoadResponse());
return this.get<ApplicationLoadResponse>("info/application/load", new ApplicationLoadResponse());
}

public hostInfo(): Promise<HostInformationResponse> {
return this.get<HostInformationResponse>("/info/system", new HostInformationResponse());
return this.get<HostInformationResponse>("info/system", new HostInformationResponse());
}

public systemLoad(): Promise<SystemLoadResponse> {
return this.get<SystemLoadResponse>("/info/system/load", new SystemLoadResponse());
return this.get<SystemLoadResponse>("info/system/load", new SystemLoadResponse());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,50 @@ import TestConnectionResponse from "./responses/TestConnectionResponse";

export default class DatabasesRestClient extends RestClientBase {
public databaseModels(): Promise<DataModel[]> {
return this.get<DataModel[]>("/", []);
return this.get<DataModel[]>("", []);
}

public deleteAllDatabaseModels(): Promise<InvocationResponse> {
return this.deleteNoBody<InvocationResponse>("/", new InvocationResponse());
return this.deleteNoBody<InvocationResponse>("", new InvocationResponse());
}

public databaseModel(targetModel: string): Promise<DataModel> {
return this.get<DataModel>("/model/" + targetModel, new DataModel());
return this.get<DataModel>("model/" + targetModel, new DataModel());
}

public saveDatabaseConfig(request: DatabaseConfigModel, targetModel: string): Promise<Response> {
return this.post<DatabaseConfigModel, Response>("/model/" + targetModel + "/config", request, new Response());
return this.post<DatabaseConfigModel, Response>("model/" + targetModel + "/config", request, new Response());
}

public testDatabaseConfig(request: DatabaseConfigModel, targetModel: string): Promise<TestConnectionResponse> {
return this.post<DatabaseConfigModel, TestConnectionResponse>("/model/" + targetModel + "/config/test", request, new TestConnectionResponse());
return this.post<DatabaseConfigModel, TestConnectionResponse>("model/" + targetModel + "/config/test", request, new TestConnectionResponse());
}

public createDatabase(request: DatabaseConfigModel, targetModel: string): Promise<InvocationResponse> {
return this.post<DatabaseConfigModel, InvocationResponse>("/model/" + targetModel + "/create", request, new InvocationResponse());
return this.post<DatabaseConfigModel, InvocationResponse>("model/" + targetModel + "/create", request, new InvocationResponse());
}

public eraseDatabase(request: DatabaseConfigModel, targetModel: string): Promise<InvocationResponse> {
return this.delete<DatabaseConfigModel, InvocationResponse>("/model/" + targetModel, request, new InvocationResponse());
return this.delete<DatabaseConfigModel, InvocationResponse>("model/" + targetModel, request, new InvocationResponse());
}

public dumpDatabase(request: DatabaseConfigModel, targetModel: string): Promise<InvocationResponse> {
return this.post<DatabaseConfigModel, InvocationResponse>("/model/" + targetModel + "/dump", request, new InvocationResponse());
return this.post<DatabaseConfigModel, InvocationResponse>("model/" + targetModel + "/dump", request, new InvocationResponse());
}

public restoreDatabase(request: RestoreDatabaseRequest, targetModel: string): Promise<InvocationResponse> {
return this.post<RestoreDatabaseRequest, InvocationResponse>("/model/" + targetModel + "/restore", request, new InvocationResponse());
return this.post<RestoreDatabaseRequest, InvocationResponse>("model/" + targetModel + "/restore", request, new InvocationResponse());
}

public applyMigration(targetModel: string, migrationName: string, request: DatabaseConfigModel): Promise<DatabaseUpdateSummary> {
return this.post<DatabaseConfigModel, DatabaseUpdateSummary>("/model/" + targetModel + "/" + migrationName + "/migrate", request, new DatabaseUpdateSummary());
return this.post<DatabaseConfigModel, DatabaseUpdateSummary>("model/" + targetModel + "/" + migrationName + "/migrate", request, new DatabaseUpdateSummary());
}

public rollbackDatabase(targetModel: string, request: DatabaseConfigModel): Promise<InvocationResponse> {
return this.post<DatabaseConfigModel, InvocationResponse>("/model/" + targetModel + "/rollback", request, new InvocationResponse());
return this.post<DatabaseConfigModel, InvocationResponse>("model/" + targetModel + "/rollback", request, new InvocationResponse());
}

public executeSetup(targetModel: string, request: ExecuteSetupRequest): Promise<InvocationResponse> {
return this.post<ExecuteSetupRequest, InvocationResponse>("/model/" + targetModel + "/setup", request, new InvocationResponse());
return this.post<ExecuteSetupRequest, InvocationResponse>("model/" + targetModel + "/setup", request, new InvocationResponse());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@ import AddAppenderResponse from "./responses/AddAppenderResponse";

export default class LogRestClient extends RestClientBase {
public loggers(): Promise<LoggerModel[]> {
return this.get<LoggerModel[]>("/", []);
return this.get<LoggerModel[]>("", []);
}

public addRemoteAppender(name: string, minLevel: LogLevel): Promise<AddAppenderResponse> {
const request = new AddRemoteAppenderRequest();
request.MinLevel = minLevel;
request.Name = name;
return this.post<AddRemoteAppenderRequest, AddAppenderResponse>("/appender", request, new AddAppenderResponse());
return this.post<AddRemoteAppenderRequest, AddAppenderResponse>("appender", request, new AddAppenderResponse());
}

public removeRemoteAppender(appenderId: number): Promise<InvocationResponse> {
return this.deleteNoBody<InvocationResponse>("/appender/" + appenderId.toString(), new InvocationResponse());
return this.deleteNoBody<InvocationResponse>("appender/" + appenderId.toString(), new InvocationResponse());
}

public messages(appenderId: number): Promise<LogMessageModel[]> {
return this.get<LogMessageModel[]>("/appender/" + appenderId.toString(), []);
return this.get<LogMessageModel[]>("appender/" + appenderId.toString(), []);
}

public logLevel(loggerName: string, level: LogLevel): Promise<InvocationResponse> {
const request = new SetLogLevelRequest();
request.Level = level;
return this.put<SetLogLevelRequest, InvocationResponse>("/logger/" + loggerName + "/loglevel", request, new InvocationResponse());
return this.put<SetLogLevelRequest, InvocationResponse>("logger/" + loggerName + "/loglevel", request, new InvocationResponse());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,51 +14,51 @@ import SaveConfigRequest from "./requests/SaveConfigRequest";

export default class ModulesRestClient extends RestClientBase {
public modules(): Promise<ServerModuleModel[]> {
return this.get<ServerModuleModel[]>("/", []);
return this.get<ServerModuleModel[]>("", []);
}

public healthState(moduleName: string): Promise<ModuleServerModuleState> {
return this.get<ModuleServerModuleState>("/module/" + moduleName + "/healthstate", ModuleServerModuleState.Failure);
return this.get<ModuleServerModuleState>("module/" + moduleName + "/healthstate", ModuleServerModuleState.Failure);
}

public notifications(moduleName: string): Promise<NotificationModel[]> {
return this.get<NotificationModel[]>("/module/" + moduleName + "/notifications", []);
return this.get<NotificationModel[]>("module/" + moduleName + "/notifications", []);
}

public startModule(moduleName: string): Promise<Response> {
return this.postNoBody<Response>("/module/" + moduleName + "/start", new Response());
return this.postNoBody<Response>("module/" + moduleName + "/start", new Response());
}

public stopModule(moduleName: string): Promise<Response> {
return this.postNoBody<Response>("/module/" + moduleName + "/stop", new Response());
return this.postNoBody<Response>("module/" + moduleName + "/stop", new Response());
}

public reincarnateModule(moduleName: string): Promise<Response> {
return this.postNoBody<Response>("/module/" + moduleName + "/reincarnate", new Response());
return this.postNoBody<Response>("module/" + moduleName + "/reincarnate", new Response());
}

public confirmModuleWarning(moduleName: string): Promise<Response> {
return this.postNoBody<Response>("/module/" + moduleName + "/confirm", new Response());
return this.postNoBody<Response>("module/" + moduleName + "/confirm", new Response());
}

public updateModule(request: ServerModuleModel): Promise<Response> {
return this.post<ServerModuleModel, Response>("/module/" + request.Name, request, new Response());
return this.post<ServerModuleModel, Response>("module/" + request.Name, request, new Response());
}

public moduleConfig(moduleName: string): Promise<Config> {
return this.get<Config>("/module/" + moduleName + "/config", new Config());
return this.get<Config>("module/" + moduleName + "/config", new Config());
}

public saveModuleConfig(moduleName: string, request: SaveConfigRequest): Promise<Response> {
return this.post<SaveConfigRequest, Response>("/module/" + moduleName + "/config", request, new Response(), ModulesRestClient.entryReplacer);
return this.post<SaveConfigRequest, Response>("module/" + moduleName + "/config", request, new Response(), ModulesRestClient.entryReplacer);
}

public moduleMethods(moduleName: string): Promise<MethodEntry[]> {
return this.get<MethodEntry[]>("/module/" + moduleName + "/console", []);
return this.get<MethodEntry[]>("module/" + moduleName + "/console", []);
}

public invokeMethod(moduleName: string, request: MethodEntry): Promise<Entry> {
return this.post<MethodEntry, Entry>("/module/" + moduleName + "/console", request, new Entry(), ModulesRestClient.entryReplacer);
return this.post<MethodEntry, Entry>("module/" + moduleName + "/console", request, new Entry(), ModulesRestClient.entryReplacer);
}

private static entryReplacer(key: string, value: any): any {
Expand Down