notifications: github.com/shurcooL/notifications/githubapi Index | Files

package githubapi

import "github.com/shurcooL/notifications/githubapi"

Package githubapi implements notifications.Service using GitHub API clients.

Index

Package Files

githubapi.go

func NewService Uses

func NewService(clientV3 *github.Client, clientV4 *githubql.Client, router Router) notifications.Service

NewService creates a GitHub-backed notifications.Service using given GitHub clients. At this time it infers the current user from the client (its authentication info), and cannot be used to serve multiple users.

Caching can't be used for Activity.ListNotifications until GitHub REST API v3 fixes the odd behavior of returning 304 even when some notifications get marked as read. Otherwise read notifications remain forever (until a new notification comes in).

This service uses Cache-Control: no-cache request header to disable caching.

If router is nil, GitHubRouter is used, which links to https://github.com.

type GitHubRouter Uses

type GitHubRouter struct{}

GitHubRouter provides HTML URLs of GitHub notification subjects on https://github.com.

func (GitHubRouter) IssueURL Uses

func (GitHubRouter) IssueURL(owner, repo string, issueID, commentID uint64) string

IssueURL returns the HTML URL of the specified GitHub issue on the https://github.com issue tracker.

func (GitHubRouter) PullRequestURL Uses

func (GitHubRouter) PullRequestURL(owner, repo string, prID, commentID uint64) string

type Router Uses

type Router interface {
    // IssueURL returns the HTML URL of the specified GitHub issue.
    IssueURL(owner, repo string, issueID, commentID uint64) string

    // PullRequestURL returns the HTML URL of the specified GitHub pull request.
    PullRequestURL(owner, repo string, prID, commentID uint64) string
}

Router provides HTML URLs of GitHub notification subjects.

Package githubapi imports 13 packages (graph) and is imported by 2 packages. Updated 2017-11-19. Refresh now. Tools for package owners.