octokit / octokit.js

The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEAT]: notifications: filter done/undone

antonengelhardt opened this issue · comments

Describe the need

Hello,

the GitHub Raycast Extension has a command (Notifications) to fetch all notifications for the user using the listNotificationsForAuthenticatedUser() endpoint:

Screenshot-Arc-006646@2x

const {
    data,
    isLoading,
    mutate: mutateList,
  } = useCachedPromise(async () => {
    const response = await octokit.rest.activity.listNotificationsForAuthenticatedUser({ all: true });
    return response.data;
  });

When setting the all-parameter to true, it returns all notifications (including done ones). When setting it to false, only unread notifications are returned.

The GitHub Website groups notifications depending if they're done or undone. Additionally, a filter can display only the unread notifications:

Screenshot-Arc-006648@2x

@tom-sherman proposed to follow the GitHub style in a recently opened issue. Following the Github style would mean that the extension would have to group the notifications by undone/done and highlight unread ones, which is currently impossible, because there is no way to tell if a notification is done or not.

My proposal is that either

  1. the notification object gets a done attribute of boolean type (then we can partition the notifications ourselves) or
  2. that the listNotificationsForAuthenticatedUser() endpoint gets more filters e.g showDone (bool), showRead (boolean).

Thanks for considering. Cheers.

SDK Version

v3.1.2

API Version

v20

Relevant log output

-

Code of Conduct

  • I agree to follow this project's Code of Conduct

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

That is out of scope for this package. We only provide wrappers around the GitHub API

Feel free to submit this as a feature request to GitHub for their API.
https://github.com/orgs/community/discussions/categories/api-and-webhooks