Add updating isNew (CoralApi.deleteFriendIsNew) and isOnlineNotificationEnabled (CoralApi.updateFriendOnlineNotificationSettings) to API proxy

This commit is contained in:
Samuel Elliott
2025-07-27 21:51:49 +01:00
parent ddaa7a5ba0
commit 4897aca3e6
3 changed files with 75 additions and 6 deletions

View File

@@ -53,6 +53,7 @@ export interface CoralApiInterface {
getFriendList(): Promise<Result<Friends_4>>;
addFavouriteFriend(nsa_id: string): Promise<Result<{}>>;
removeFavouriteFriend(nsa_id: string): Promise<Result<{}>>;
deleteFriendIsNew(nsa_id: string): Promise<Result<{}>>;
getWebServices(): Promise<Result<WebServices_4>>;
getChats(): Promise<Result<ListChat>>;
getMedia(): Promise<Result<ListMedia>>;
@@ -65,6 +66,7 @@ export interface CoralApiInterface {
getSentFriendRequests(): Promise<Result<SentFriendRequests>>;
getFriendCodeUrl(): Promise<Result<FriendCodeUrl>>;
getCurrentUserPermissions(): Promise<Result<CurrentUserPermissions>>;
updateFriendOnlineNotificationSettings(nsa_id: string, value: boolean): Promise<Result<{}>>;
getWebServiceToken(id: number): Promise<Result<WebServiceToken>>;
}

View File

@@ -95,6 +95,13 @@ export default class ZncProxyApi extends AbstractCoralApi implements CoralApiInt
return createResult(result, {});
}
async deleteFriendIsNew(nsa_id: string) {
const result = await this.fetchProxyApi('friend/' + nsa_id, 'PATCH', JSON.stringify({
isNew: false,
}));
return createResult(result, {});
}
async getWebServices() {
const result = await this.fetchProxyApi<{webservices: WebService_4[]}>('webservices');
return createResult(result, result.webservices);
@@ -169,6 +176,13 @@ export default class ZncProxyApi extends AbstractCoralApi implements CoralApiInt
// throw new Error('Not supported in ZncProxyApi');
// }
async updateFriendOnlineNotificationSettings(nsa_id: string, value: boolean) {
const result = await this.fetchProxyApi('friend/' + nsa_id, 'PATCH', JSON.stringify({
isOnlineNotificationEnabled: value,
}));
return createResult(result, {});
}
async getWebServiceToken(id: number) {
const result = await this.fetchProxyApi<{token: WebServiceToken}>('webservice/' + id + '/token');
return createResult(result, result.token);