Skip to content

Commit b6535ba

Browse files
committed
feat: bitbucket cloud support
Signed-off-by: Adam Setch <[email protected]>
1 parent 3734ce1 commit b6535ba

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

src/utils/api/client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ export function listNotificationsForAuthenticatedUser(
7777
export function listBitbucketWork(
7878
account: Account,
7979
): AxiosPromise<Notification[]> {
80-
const url = `${account.hostname}/overview-view-state?fields=pullRequestFilters.*,pullRequests.authored.links.html,-pullRequests.authored.extra.*`;
80+
const url = `${account.hostname}/overview-view-state?fields=pullRequests.reviewing.id,pullRequests.reviewing.title,pullRequest.reviewing.state,pullRequests.reviewing.author,pullRequests.reviewing.created_on,pullRequests.reviewing.updated_on,pullRequests.reviewing.links,pullRequests.reviewing.task_count,pullRequests.reviewing.comment_count,pullRequests.reviewing.destination.repository.*`;
8181

82+
console.log(url);
8283
return apiRequestBitbucket(
8384
url.toString() as Link,
8485
'GET',

src/utils/notifications.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,23 +140,30 @@ export async function getAllNotifications(
140140
const pulls =
141141
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
142142
((await accountNotifications.notifications).data as any)
143-
.pullRequests.authored;
143+
.pullRequests?.reviewing;
144144

145-
console.log(JSON.stringify(pulls, null, 2));
146-
147-
const notifications = pulls.map((pull: any) => ({
145+
const notifications = pulls?.map((pull: any) => ({
148146
id: 1,
149-
reason: 'pull_request',
147+
reason: 'review_requested',
148+
updated_at: pull.updated_on,
149+
url: pull.links.html.href,
150150
repository: {
151-
full_name: pull.links.html.href,
151+
full_name: pull.destination.repository.links.html.href,
152152
owner: {
153-
avatar_url:
154-
'https://avatars.githubusercontent.com/u/987654321?v=4',
153+
avatar_url: pull.destination.repository.links.avatar.href,
155154
},
156155
},
157156
subject: {
158-
title: pull.extra.commit_statuses[0].key,
157+
number: pull.id,
158+
title: pull.title,
159159
url: pull.links.html.href,
160+
type: 'PullRequest',
161+
user: {
162+
login: pull.author.display_name,
163+
html_url: pull.author.links.html.href,
164+
avatar_url: pull.author.links.avatar.href,
165+
type: 'User',
166+
},
160167
},
161168
account: accountNotifications.account,
162169
}));

0 commit comments

Comments
 (0)