Skip to content

Commit 5b11a17

Browse files
Copilothotlong
andcommitted
fix(client): add proper type annotations for notification preferences methods
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 9410533 commit 5b11a17

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/client/src/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ import {
4848
RegisterDeviceRequest,
4949
RegisterDeviceResponse,
5050
UnregisterDeviceResponse,
51+
GetNotificationPreferencesResponse,
52+
UpdateNotificationPreferencesRequest,
53+
UpdateNotificationPreferencesResponse,
5154
ListNotificationsResponse,
5255
MarkNotificationsReadResponse,
5356
MarkAllNotificationsReadResponse,
@@ -899,22 +902,22 @@ export class ObjectStackClient {
899902
/**
900903
* Get notification preferences for the current user
901904
*/
902-
getPreferences: async () => {
905+
getPreferences: async (): Promise<GetNotificationPreferencesResponse> => {
903906
const route = this.getRoute('notifications');
904907
const res = await this.fetch(`${this.baseUrl}${route}/preferences`);
905-
return this.unwrapResponse(res);
908+
return this.unwrapResponse<GetNotificationPreferencesResponse>(res);
906909
},
907910

908911
/**
909912
* Update notification preferences
910913
*/
911-
updatePreferences: async (preferences: Record<string, any>) => {
914+
updatePreferences: async (preferences: UpdateNotificationPreferencesRequest['preferences']): Promise<UpdateNotificationPreferencesResponse> => {
912915
const route = this.getRoute('notifications');
913916
const res = await this.fetch(`${this.baseUrl}${route}/preferences`, {
914917
method: 'PUT',
915918
body: JSON.stringify({ preferences })
916919
});
917-
return this.unwrapResponse(res);
920+
return this.unwrapResponse<UpdateNotificationPreferencesResponse>(res);
918921
},
919922

920923
/**

0 commit comments

Comments
 (0)