@@ -64,20 +64,45 @@ export function headNotifications(
6464 *
6565 * Endpoint documentation: https://docs.github.com/en/rest/activity/notifications#list-notifications-for-the-authenticated-user
6666 */
67- export function listNotificationsForAuthenticatedUser (
67+ export async function listNotificationsForAuthenticatedUser (
6868 account : Account ,
6969 settings : SettingsState ,
70- ) : AxiosPromise < Notification [ ] > {
71- const url = getGitHubAPIBaseUrl ( account . hostname ) ;
72- url . pathname += 'notifications' ;
73- url . searchParams . append ( 'participating' , String ( settings . participating ) ) ;
74- return apiRequestAuth (
75- url . toString ( ) as Link ,
76- 'GET' ,
77- account . token ,
78- { } ,
79- settings . fetchAllNotifications ,
80- ) ;
70+ ) : Promise < AxiosPromise < Notification [ ] > > {
71+ const octokit = await createOctokitClient ( account . hostname , account . token ) ;
72+
73+ let response : any ;
74+
75+ if ( settings . fetchAllNotifications ) {
76+ response = await octokit . paginate . iterator (
77+ octokit . rest . activity . listNotificationsForAuthenticatedUser ,
78+ {
79+ participating : settings . participating ,
80+ } ,
81+ ) ;
82+ }
83+
84+ response = await octokit . rest . activity . listNotificationsForAuthenticatedUser ( {
85+ participating : settings . participating ,
86+ } ) ;
87+
88+ // Return axios-like response format
89+ return {
90+ data : response ,
91+ status : 200 ,
92+ statusText : 'OK' ,
93+ headers : { } ,
94+ } as any ;
95+
96+ // const url = getGitHubAPIBaseUrl(account.hostname);
97+ // url.pathname += 'notifications';
98+ // url.searchParams.append('participating', String(settings.participating));
99+ // return apiRequestAuth(
100+ // url.toString() as Link,
101+ // 'GET',
102+ // account.token,
103+ // {},
104+ // settings.fetchAllNotifications,
105+ // );
81106}
82107
83108/**
@@ -239,7 +264,7 @@ export async function searchDiscussions(
239264 notification . account . hostname ,
240265 notification . account . token ,
241266 ) ;
242-
267+
243268 const result = await octokit . graphql ( print ( QUERY_SEARCH_DISCUSSIONS ) , {
244269 queryStatement : formatAsGitHubSearchSyntax (
245270 notification . repository . full_name ,
0 commit comments