Documentation
¶
Overview ¶
Package httpclient contains notifications.Service implementation over HTTP.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNotifications ¶
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.
Example ¶
package main
import (
"context"
"github.com/shurcooL/notificationsapp/httpclient"
"golang.org/x/oauth2"
)
func main() {
// 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.
_ = notificationsClient
}
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.