httpclient

package
v0.0.0-...-1301412 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2023 License: MIT Imports: 10 Imported by: 2

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL