Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/github/gh-notification-delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

# This section loads configuration files needed to set environment variables
# such as GITHUB_TOKEN. If these variables are already exported globally in the shell,
# the files below can remain commented out. Otherwise, uncomment the appropriate
# file(s) as needed. This particular script only needs GITHUB_TOKEN to function properly.

# source "$GITNAP/utils/auth.sh"
# source "$GITNAP/utils/settings.sh"



function delete_github_notifications() {
local NOTIFICATION_ID
local endpoint
local response
local tmp_file

NOTIFICATION_ID="$1"

# Checks if the parameter was provided.
if [[ -z "$NOTIFICATION_ID" ]]; then
echo "Provide id notification to delete"
exit 1
fi

# API Endpoint
endpoint="https://api.github.com/notifications/threads/$NOTIFICATION_ID"

# Delete notifications
response=$(curl -sSL -X DELETE "$endpoint" \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" )

echo "$response"

}

delete_github_notifications "$1"
35 changes: 35 additions & 0 deletions src/github/gh-notification-list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

# This section loads configuration files needed to set environment variables
# such as GITHUB_TOKEN. If these variables are already exported globally in the shell,
# the files below can remain commented out. Otherwise, uncomment the appropriate
# file(s) as needed. This particular script only needs GITHUB_TOKEN to function properly.

# source "$GITNAP/utils/auth.sh"
# source "$GITNAP/utils/settings.sh"



function list_github_notifications() {
local endpoint
local response
local tmp_file

# API Endpoint
endpoint="https://api.github.com/notifications"

# Get notifications
response=$(curl -sSL "$endpoint" \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" )

# See in terminal
tmp_file=$(mktemp)
echo "$response" > "$tmp_file"
less "$tmp_file"
rm "$tmp_file"

}

list_github_notifications
Loading