Remove unused APIs

This commit is contained in:
Travis Ralston 2018-03-24 14:54:20 -06:00
parent 58f8ca8335
commit bc4319da7d

View File

@ -3,7 +3,6 @@ import { AdminService } from "./AdminService";
import AppService from "../../db/models/AppService";
import { AppserviceStore } from "../../db/AppserviceStore";
import { ApiError } from "../ApiError";
import AppServiceUser from "../../db/models/AppServiceUser";
import { MatrixAppserviceClient } from "../../matrix/MatrixAppserviceClient";
import config from "../../config";
import { LogService } from "matrix-js-snippets";
@ -15,17 +14,6 @@ interface AppserviceResponse {
userPrefix: string;
}
interface UserResponse {
userId: string;
accessToken: string;
displayName: string;
avatarUrl: string;
}
interface NewUserRequest {
userId: string;
}
interface AppserviceCreateRequest {
userPrefix: string;
}
@ -73,22 +61,6 @@ export class AdminAppserviceService {
return this.mapAppservice(appservice);
}
@GET
@Path(":appserviceId/users")
public async getUsers(@QueryParam("scalar_token") scalarToken: string, @PathParam("appserviceId") asId: string): Promise<UserResponse[]> {
await AdminService.validateAndGetAdminTokenOwner(scalarToken);
return (await AppserviceStore.getUsers(asId)).map(u => this.mapUser(u));
}
@POST
@Path(":appserviceId/users/register")
public async registerUser(@QueryParam("scalar_token") scalarToken: string, @PathParam("appserviceId") asId: string, request: NewUserRequest): Promise<UserResponse> {
await AdminService.validateAndGetAdminTokenOwner(scalarToken);
const user = await AppserviceStore.registerUser(asId, request.userId);
return this.mapUser(user);
}
@POST
@Path(":appserviceId/test")
public async test(@QueryParam("scalar_token") scalarToken: string, @PathParam("appserviceId") asId: string): Promise<any> {
@ -110,13 +82,4 @@ export class AdminAppserviceService {
userPrefix: as.userPrefix,
};
}
private mapUser(user: AppServiceUser): UserResponse {
return {
userId: user.id,
accessToken: user.accessToken,
displayName: user.displayName,
avatarUrl: user.avatarUrl,
};
}
}