@@ -36,7 +36,7 @@ import {
3636import { MergeQueryBuilder } from './graphql/MergeQueryBuilder' ;
3737import { createOctokitClient } from './octokit' ;
3838import { performGraphQLRequest , performGraphQLRequestString } from './request' ;
39- import { getNumberFromUrl } from './utils' ;
39+ import { getNumberFromUrl } from './utils' ;
4040
4141/**
4242 * Perform a HEAD operation, used to validate that connectivity is established.
@@ -64,34 +64,33 @@ export async function listNotificationsForAuthenticatedUser(
6464) : Promise < ListNotificationsForAuthenticatedUserResponse > {
6565 const octokit = await createOctokitClient ( account ) ;
6666
67- if ( settings . fetchAllNotifications ) {
68- // Fetch all pages using Octokit's pagination
69- return await octokit . paginate (
70- octokit . rest . activity . listNotificationsForAuthenticatedUser ,
71- {
72- participating : settings . participating ,
73- all : settings . fetchReadNotifications ,
74- per_page : 100 ,
75- headers : {
76- 'Cache-Control' : 'no-cache' , // Prevent caching
77- } ,
78- } ,
79- ) ;
80- }
81-
82- // Single page request
83- const response =
84- await octokit . rest . activity . listNotificationsForAuthenticatedUser ( {
67+ if ( settings . fetchAllNotifications ) {
68+ // Fetch all pages using Octokit's pagination
69+ return await octokit . paginate (
70+ octokit . rest . activity . listNotificationsForAuthenticatedUser ,
71+ {
8572 participating : settings . participating ,
8673 all : settings . fetchReadNotifications ,
8774 per_page : 100 ,
8875 headers : {
8976 'Cache-Control' : 'no-cache' , // Prevent caching
9077 } ,
91- } ) ;
78+ } ,
79+ ) ;
80+ }
9281
93- return response . data ;
94-
82+ // Single page request
83+ const response =
84+ await octokit . rest . activity . listNotificationsForAuthenticatedUser ( {
85+ participating : settings . participating ,
86+ all : settings . fetchReadNotifications ,
87+ per_page : 100 ,
88+ headers : {
89+ 'Cache-Control' : 'no-cache' , // Prevent caching
90+ } ,
91+ } ) ;
92+
93+ return response . data ;
9594}
9695
9796/**
@@ -106,12 +105,11 @@ export async function markNotificationThreadAsRead(
106105) : Promise < MarkNotificationThreadAsReadResponse > {
107106 const octokit = await createOctokitClient ( account ) ;
108107
109- const response = await octokit . rest . activity . markThreadAsRead ( {
110- thread_id : Number ( threadId ) ,
111- } ) ;
108+ const response = await octokit . rest . activity . markThreadAsRead ( {
109+ thread_id : Number ( threadId ) ,
110+ } ) ;
112111
113- return response . data ;
114-
112+ return response . data ;
115113}
116114
117115/**
@@ -128,12 +126,11 @@ export async function markNotificationThreadAsDone(
128126) : Promise < MarkNotificationThreadAsDoneResponse > {
129127 const octokit = await createOctokitClient ( account ) ;
130128
131- const response = await octokit . rest . activity . markThreadAsDone ( {
132- thread_id : Number ( threadId ) ,
133- } ) ;
129+ const response = await octokit . rest . activity . markThreadAsDone ( {
130+ thread_id : Number ( threadId ) ,
131+ } ) ;
134132
135- return response . data ;
136-
133+ return response . data ;
137134}
138135
139136/**
@@ -147,13 +144,12 @@ export async function ignoreNotificationThreadSubscription(
147144) : Promise < IgnoreNotificationThreadSubscriptionResponse > {
148145 const octokit = await createOctokitClient ( account ) ;
149146
150- const response = await octokit . rest . activity . setThreadSubscription ( {
151- thread_id : Number ( threadId ) ,
152- ignored : true ,
153- } ) ;
147+ const response = await octokit . rest . activity . setThreadSubscription ( {
148+ thread_id : Number ( threadId ) ,
149+ ignored : true ,
150+ } ) ;
154151
155- return response . data ;
156-
152+ return response . data ;
157153}
158154
159155/**
@@ -165,8 +161,7 @@ export async function getCommit(
165161 account : Account ,
166162 url : Link ,
167163) : Promise < GetCommitResponse > {
168- return followUrl < GetCommitResponse > ( account , url )
169-
164+ return followUrl < GetCommitResponse > ( account , url ) ;
170165}
171166
172167/**
@@ -178,8 +173,7 @@ export async function getCommitComment(
178173 account : Account ,
179174 url : Link ,
180175) : Promise < GetCommitCommentResponse > {
181- return followUrl < GetCommitCommentResponse > ( account , url )
182-
176+ return followUrl < GetCommitCommentResponse > ( account , url ) ;
183177}
184178
185179/**
@@ -191,8 +185,7 @@ export async function getRelease(
191185 account : Account ,
192186 url : Link ,
193187) : Promise < GetReleaseResponse > {
194- return followUrl < GetReleaseResponse > ( account , url )
195-
188+ return followUrl < GetReleaseResponse > ( account , url ) ;
196189}
197190
198191/**
@@ -202,7 +195,7 @@ export async function getHtmlUrl(
202195 account : Account ,
203196 url : Link ,
204197) : Promise < GitHubHtmlUrlResponse > {
205- return followUrl < GitHubHtmlUrlResponse > ( account , url )
198+ return followUrl < GitHubHtmlUrlResponse > ( account , url ) ;
206199}
207200
208201/**
@@ -214,13 +207,12 @@ async function followUrl<TResult>(
214207) : Promise < TResult > {
215208 const octokit = await createOctokitClient ( account ) ;
216209
217- // Perform a generic GET request using Octokit's request method
218- const response = await octokit . request ( 'GET {+url}' , {
219- url : url ,
220- } ) ;
210+ // Perform a generic GET request using Octokit's request method
211+ const response = await octokit . request ( 'GET {+url}' , {
212+ url : url ,
213+ } ) ;
221214
222- return response . data as TResult ;
223-
215+ return response . data as TResult ;
224216}
225217
226218/**
@@ -231,10 +223,9 @@ export async function fetchAuthenticatedUserDetails(
231223) : Promise < OctokitResponse < GetAuthenticatedUserResponse > > {
232224 const octokit = await createOctokitClient ( account ) ;
233225
234- const response = await octokit . rest . users . getAuthenticated ( ) ;
226+ const response = await octokit . rest . users . getAuthenticated ( ) ;
235227
236- return response ;
237-
228+ return response ;
238229}
239230
240231/**
0 commit comments