mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 05:05:53 +00:00
Remove unused APIs
This commit is contained in:
parent
58f8ca8335
commit
bc4319da7d
@ -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,
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user