notificationsapp: github.com/shurcooL/notificationsapp/httpclient Index | Examples | Files

package httpclient

import "github.com/shurcooL/notificationsapp/httpclient"

Package httpclient contains notifications.Service implementation over HTTP.

Index

Examples

Package Files

httpclient.go

func NewNotifications Uses

func NewNotifications(httpClient *http.Client, scheme, host string) notifications.Service

NewNotifications creates a client that implements notifications.Service remotely over HTTP. If a nil httpClient is provided, http.DefaultClient will be used. scheme and host can be empty strings to target local service.

Code:

// HTTP client with authentication.
src := oauth2.StaticTokenSource(
    &oauth2.Token{AccessToken: "... your access token ..."},
)
httpClient := oauth2.NewClient(context.Background(), src)

notificationsClient := httpclient.NewNotifications(httpClient, "http", "localhost:8080")

// Now you can use any of notificationsClient methods.

Package httpclient imports 10 packages (graph) and is imported by 4 packages. Updated 2018-11-14. Refresh now. Tools for package owners.