Documentation
¶
Index ¶
- func ConvertAPIURLToWebURL(apiURL string) (string, error)
- func ListNotifications(options NotificationOptions) error
- func MarkAsRead(id string) error
- type BackgroundRefresher
- func (b *BackgroundRefresher) ForceRefresh()
- func (b *BackgroundRefresher) GetLastError() error
- func (b *BackgroundRefresher) GetNotifications() []*github.Notification
- func (b *BackgroundRefresher) IsRunning() bool
- func (b *BackgroundRefresher) SetInterval(interval time.Duration)
- func (b *BackgroundRefresher) SetOnUpdateCallback(callback func([]*github.Notification))
- func (b *BackgroundRefresher) SetOptions(options NotificationOptions)
- func (b *BackgroundRefresher) Start()
- func (b *BackgroundRefresher) Stop()
- type CacheManager
- func (cm *CacheManager) Close() error
- func (cm *CacheManager) GetNotifications(ctx context.Context, opts *github.NotificationListOptions) ([]*github.Notification, *github.Response, error)
- func (cm *CacheManager) GetRepositoryNotifications(ctx context.Context, owner, repo string, opts *github.NotificationListOptions) ([]*github.Notification, *github.Response, error)
- func (cm *CacheManager) InvalidateNotificationsCache()
- func (cm *CacheManager) PrefetchNotificationDetails(notifications []*github.Notification)
- type Client
- func NewClient(ctx context.Context, opts ...ClientOption) (*Client, error)
- func NewClientOrExit(ctx context.Context, opts ...ClientOption) *Client
- func NewMockClient(ctx context.Context) (*Client, *httptest.Server, error)
- func NewTestClient(ctx context.Context, handler http.Handler) (*Client, *httptest.Server, error)
- func (c *Client) Do(req *http.Request, v interface{}) (*github.Response, error)
- func (c *Client) FetchNotificationDetails(notifications []*github.Notification) error
- func (c *Client) FilterNotifications(notifications []*github.Notification, filterString, sortBy string) []*github.Notification
- func (c *Client) GetAllNotifications(opts NotificationOptions) ([]*github.Notification, error)
- func (c *Client) GetFilteredNotifications(opts NotificationOptions) ([]*github.Notification, error)
- func (c *Client) GetNotification(id string) (*github.Notification, error)
- func (c *Client) GetNotificationsByOrg(org string, opts NotificationOptions) ([]*github.Notification, error)
- func (c *Client) GetNotificationsByRepo(repo string, opts NotificationOptions) ([]*github.Notification, error)
- func (c *Client) GetRawClient() *github.Client
- func (c *Client) GetThread(threadID string) (*github.Notification, *github.Response, error)
- func (c *Client) GetUnreadNotifications(opts NotificationOptions) ([]*github.Notification, error)
- func (c *Client) GroupNotifications(ctx context.Context, notifications []*github.Notification, groupBy string) ([]*NotificationGroup, error)
- func (c *Client) ListNotifications(opts *github.NotificationListOptions) ([]*github.Notification, *github.Response, error)
- func (c *Client) MarkAllNotificationsRead() error
- func (c *Client) MarkNotificationRead(threadID string) error
- func (c *Client) MarkRepositoryNotificationsRead(owner, repo string) error
- func (c *Client) MarkThreadRead(threadID string) (*github.Response, error)
- func (c *Client) OptimizedGetAllNotifications(opts NotificationOptions) ([]*github.Notification, error)
- func (c *Client) SetRawClient(client *github.Client)
- func (c *Client) WithContext(ctx context.Context) *Client
- type ClientOption
- func WithBaseURL(baseURL string) ClientOption
- func WithCacheTTL(cacheTTL time.Duration) ClientOption
- func WithDebug(debug bool) ClientOption
- func WithMaxConcurrent(maxConcurrent int) ClientOption
- func WithRetryCount(retryCount int) ClientOption
- func WithRetryDelay(retryDelay time.Duration) ClientOption
- func WithTimeout(timeout time.Duration) ClientOption
- func WithUploadURL(uploadURL string) ClientOption
- type Filter
- type NotificationGroup
- type NotificationOptions
- type NotificationResult
- type NotificationStream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertAPIURLToWebURL ¶
ConvertAPIURLToWebURL converts a GitHub API URL to a web URL
func ListNotifications ¶
func ListNotifications(options NotificationOptions) error
ListNotifications fetches and displays GitHub notifications
Types ¶
type BackgroundRefresher ¶
type BackgroundRefresher struct {
// contains filtered or unexported fields
}
BackgroundRefresher manages background refresh of notifications
func NewBackgroundRefresher ¶
func NewBackgroundRefresher(client *Client, interval time.Duration, options NotificationOptions) *BackgroundRefresher
NewBackgroundRefresher creates a new background refresher
func (*BackgroundRefresher) ForceRefresh ¶
func (b *BackgroundRefresher) ForceRefresh()
ForceRefresh forces an immediate refresh
func (*BackgroundRefresher) GetLastError ¶
func (b *BackgroundRefresher) GetLastError() error
GetLastError returns the last error encountered during refresh
func (*BackgroundRefresher) GetNotifications ¶
func (b *BackgroundRefresher) GetNotifications() []*github.Notification
GetNotifications returns the current notifications
func (*BackgroundRefresher) IsRunning ¶
func (b *BackgroundRefresher) IsRunning() bool
IsRunning returns whether the background refresh is running
func (*BackgroundRefresher) SetInterval ¶
func (b *BackgroundRefresher) SetInterval(interval time.Duration)
SetInterval updates the refresh interval
func (*BackgroundRefresher) SetOnUpdateCallback ¶
func (b *BackgroundRefresher) SetOnUpdateCallback(callback func([]*github.Notification))
SetOnUpdateCallback sets a callback function to be called when notifications are updated
func (*BackgroundRefresher) SetOptions ¶
func (b *BackgroundRefresher) SetOptions(options NotificationOptions)
SetOptions updates the notification options
func (*BackgroundRefresher) Start ¶
func (b *BackgroundRefresher) Start()
Start starts the background refresh
func (*BackgroundRefresher) Stop ¶
func (b *BackgroundRefresher) Stop()
Stop stops the background refresh
type CacheManager ¶
type CacheManager struct {
// Manager is the cache manager
Manager *cache.Manager
// Client is the GitHub client
Client *Client
// Config is the configuration
Config *config.Config
}
CacheManager manages the GitHub API cache
func NewCacheManager ¶
func NewCacheManager(client *Client, cfg *config.Config) (*CacheManager, error)
NewCacheManager creates a new cache manager
func (*CacheManager) GetNotifications ¶
func (cm *CacheManager) GetNotifications(ctx context.Context, opts *github.NotificationListOptions) ([]*github.Notification, *github.Response, error)
GetNotifications gets notifications from cache or API
func (*CacheManager) GetRepositoryNotifications ¶
func (cm *CacheManager) GetRepositoryNotifications(ctx context.Context, owner, repo string, opts *github.NotificationListOptions) ([]*github.Notification, *github.Response, error)
GetRepositoryNotifications gets repository notifications from cache or API
func (*CacheManager) InvalidateNotificationsCache ¶
func (cm *CacheManager) InvalidateNotificationsCache()
InvalidateNotificationsCache invalidates the notifications cache
func (*CacheManager) PrefetchNotificationDetails ¶
func (cm *CacheManager) PrefetchNotificationDetails(notifications []*github.Notification)
PrefetchNotificationDetails prefetches notification details
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the GitHub client with authentication and additional features
func NewClient ¶
func NewClient(ctx context.Context, opts ...ClientOption) (*Client, error)
NewClient creates a new authenticated GitHub client with enhanced features
func NewClientOrExit ¶
func NewClientOrExit(ctx context.Context, opts ...ClientOption) *Client
NewClientOrExit creates a new authenticated GitHub client or exits on error
func NewMockClient ¶
NewMockClient creates a new client for testing
func NewTestClient ¶
NewTestClient creates a new client for testing with a custom handler
func (*Client) FetchNotificationDetails ¶
func (c *Client) FetchNotificationDetails(notifications []*github.Notification) error
FetchNotificationDetails fetches additional details for notifications in parallel
func (*Client) FilterNotifications ¶
func (c *Client) FilterNotifications(notifications []*github.Notification, filterString, sortBy string) []*github.Notification
FilterNotifications filters notifications based on a filter string
func (*Client) GetAllNotifications ¶
func (c *Client) GetAllNotifications(opts NotificationOptions) ([]*github.Notification, error)
GetAllNotifications fetches all notifications with pagination support
func (*Client) GetFilteredNotifications ¶
func (c *Client) GetFilteredNotifications(opts NotificationOptions) ([]*github.Notification, error)
GetFilteredNotifications fetches notifications matching a filter
func (*Client) GetNotification ¶
func (c *Client) GetNotification(id string) (*github.Notification, error)
GetNotification fetches a single notification by ID
func (*Client) GetNotificationsByOrg ¶
func (c *Client) GetNotificationsByOrg(org string, opts NotificationOptions) ([]*github.Notification, error)
GetNotificationsByOrg fetches notifications for a specific organization
func (*Client) GetNotificationsByRepo ¶
func (c *Client) GetNotificationsByRepo(repo string, opts NotificationOptions) ([]*github.Notification, error)
GetNotificationsByRepo fetches notifications for a specific repository
func (*Client) GetRawClient ¶
GetRawClient returns the underlying GitHub client
func (*Client) GetUnreadNotifications ¶
func (c *Client) GetUnreadNotifications(opts NotificationOptions) ([]*github.Notification, error)
GetUnreadNotifications fetches only unread notifications
func (*Client) GroupNotifications ¶
func (c *Client) GroupNotifications(ctx context.Context, notifications []*github.Notification, groupBy string) ([]*NotificationGroup, error)
GroupNotifications groups notifications by the specified field
func (*Client) ListNotifications ¶
func (c *Client) ListNotifications(opts *github.NotificationListOptions) ([]*github.Notification, *github.Response, error)
ListNotifications lists GitHub notifications with rate limiting and retries
func (*Client) MarkAllNotificationsRead ¶
MarkAllNotificationsRead marks all notifications as read
func (*Client) MarkNotificationRead ¶
MarkNotificationRead marks a notification thread as read
func (*Client) MarkRepositoryNotificationsRead ¶
MarkRepositoryNotificationsRead marks all notifications in a repository as read
func (*Client) MarkThreadRead ¶
MarkThreadRead marks a notification thread as read
func (*Client) OptimizedGetAllNotifications ¶
func (c *Client) OptimizedGetAllNotifications(opts NotificationOptions) ([]*github.Notification, error)
OptimizedGetAllNotifications is an optimized version of GetAllNotifications
func (*Client) SetRawClient ¶
SetRawClient sets the underlying GitHub client
type ClientOption ¶
type ClientOption func(*Client)
ClientOption is a function that configures a Client
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL sets the base URL for the GitHub API
func WithCacheTTL ¶
func WithCacheTTL(cacheTTL time.Duration) ClientOption
WithCacheTTL sets the TTL for cached responses
func WithDebug ¶
func WithDebug(debug bool) ClientOption
WithDebug enables or disables debug logging
func WithMaxConcurrent ¶
func WithMaxConcurrent(maxConcurrent int) ClientOption
WithMaxConcurrent sets the maximum number of concurrent requests
func WithRetryCount ¶
func WithRetryCount(retryCount int) ClientOption
WithRetryCount sets the number of retries for failed requests
func WithRetryDelay ¶
func WithRetryDelay(retryDelay time.Duration) ClientOption
WithRetryDelay sets the delay between retries
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout sets the timeout for API requests
func WithUploadURL ¶
func WithUploadURL(uploadURL string) ClientOption
WithUploadURL sets the upload URL for the GitHub API
type NotificationGroup ¶
type NotificationGroup struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Count int `json:"count"`
UnreadCount int `json:"unread_count"`
Notifications []*github.Notification `json:"notifications"`
}
NotificationGroup represents a group of notifications
type NotificationOptions ¶
type NotificationOptions struct {
All bool // Include all notifications, not just unread ones
Unread bool // Only include unread notifications
RepoName string // Filter by repository name
OrgName string // Filter by organization name
Since time.Time // Only show notifications updated after this time
Before time.Time // Only show notifications updated before this time
Participating bool // Only show notifications in which the user is participating or mentioned
PerPage int // Number of results per page
Page int // Page number
UseCache bool // Whether to use cached results if available
CacheTTL time.Duration // How long to cache results
MaxConcurrent int // Maximum number of concurrent requests
FilterString string // Filter string for advanced filtering
BackgroundRefresh bool // Whether to refresh cache in the background
UseETag bool // Whether to use ETags for conditional requests
BatchSize int // Size of batches for concurrent requests
StreamResponse bool // Whether to stream the response
UseOptimized bool // Whether to use optimized fetching
}
NotificationOptions contains options for filtering notifications
type NotificationResult ¶
type NotificationResult struct {
Notifications []*github.Notification
Response *github.Response
Error error
}
NotificationResult represents the result of a notification fetch operation
type NotificationStream ¶
type NotificationStream struct {
// contains filtered or unexported fields
}
NotificationStream provides a streaming interface for notifications
func NewNotificationStream ¶
func NewNotificationStream(client *Client, options NotificationOptions) *NotificationStream
NewNotificationStream creates a new notification stream
func (*NotificationStream) CollectAll ¶
func (s *NotificationStream) CollectAll() ([]*github.Notification, error)
CollectAll collects all notifications from the stream and returns them as a slice
func (*NotificationStream) Errors ¶
func (s *NotificationStream) Errors() <-chan error
Errors returns a channel of errors
func (*NotificationStream) Notifications ¶
func (s *NotificationStream) Notifications() <-chan *github.Notification
Notifications returns a channel of notifications
func (*NotificationStream) Start ¶
func (s *NotificationStream) Start() error
Start starts the notification stream
func (*NotificationStream) Stop ¶
func (s *NotificationStream) Stop()
Stop stops the notification stream