Add friend code lookup to API proxy

This commit is contained in:
Samuel Elliott
2022-07-28 13:57:39 +01:00
parent b3efd0f15c
commit 0cc39aad13
2 changed files with 85 additions and 3 deletions

View File

@@ -97,8 +97,9 @@ export default class ZncProxyApi implements CoralApi {
return {status: CoralStatus.OK as const, result: response.user, correlationId: ''};
}
async getUserByFriendCode(friend_code: string, hash?: string): Promise<CoralSuccessResponse<FriendCodeUser>> {
throw new Error('Not supported in ZncProxyApi');
async getUserByFriendCode(friend_code: string, hash?: string) {
const response = await this.fetch<{user: FriendCodeUser}>('/friendcode/' + friend_code);
return {status: CoralStatus.OK as const, result: response.user, correlationId: ''};
}
async sendFriendRequest(nsa_id: string): Promise<CoralSuccessResponse<{}>> {