reputation

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProxyRouter

func ProxyRouter(
	reputationServer string,
	reputationToken string,
) http.HandlerFunc

ProxyRouter is a reverse proxy to reputation endpoints for client access

Types

type Client

type Client interface {
	IsWalletReputable(ctx context.Context, id uuid.UUID, platform string) (bool, error)
	IsWalletAdsReputable(ctx context.Context, id uuid.UUID, platform string) (bool, error)
	IsWalletOnPlatform(ctx context.Context, id uuid.UUID, platform string) (bool, error)
}

Client abstracts over the underlying client

func New

func New() (Client, error)

New returns a new HTTPClient, retrieving the base URL from the environment

type ClientWithPrometheus

type ClientWithPrometheus struct {
	// contains filtered or unexported fields
}

ClientWithPrometheus implements Client interface with all methods wrapped with Prometheus metrics

func NewClientWithPrometheus

func NewClientWithPrometheus(base Client, instanceName string) ClientWithPrometheus

NewClientWithPrometheus returns an instance of the Client decorated with prometheus summary metric

func (ClientWithPrometheus) IsWalletAdsReputable added in v0.5.0

func (_d ClientWithPrometheus) IsWalletAdsReputable(ctx context.Context, id uuid.UUID, platform string) (b1 bool, err error)

IsWalletAdsReputable implements Client

func (ClientWithPrometheus) IsWalletOnPlatform added in v0.4.0

func (_d ClientWithPrometheus) IsWalletOnPlatform(ctx context.Context, id uuid.UUID, platform string) (b1 bool, err error)

IsWalletOnPlatform implements Client

func (ClientWithPrometheus) IsWalletReputable

func (_d ClientWithPrometheus) IsWalletReputable(ctx context.Context, id uuid.UUID, platform string) (b1 bool, err error)

IsWalletReputable implements Client

type HTTPClient

type HTTPClient struct {
	// contains filtered or unexported fields
}

HTTPClient wraps http.Client for interacting with the reputation server

func (*HTTPClient) IsWalletAdsReputable added in v0.5.0

func (c *HTTPClient) IsWalletAdsReputable(
	ctx context.Context,
	paymentID uuid.UUID,
	platform string,
) (bool, error)

IsWalletAdsReputable makes the request to the reputation server and returns whether a paymentId has enough reputation to claim a grant

func (*HTTPClient) IsWalletOnPlatform added in v0.4.0

func (c *HTTPClient) IsWalletOnPlatform(
	ctx context.Context,
	paymentID uuid.UUID,
	platform string,
) (bool, error)

IsWalletOnPlatform makes the request to the reputation server and returns whether a paymentId is on a given platform

func (*HTTPClient) IsWalletReputable

func (c *HTTPClient) IsWalletReputable(
	ctx context.Context,
	paymentID uuid.UUID,
	platform string,
) (bool, error)

IsWalletReputable makes the request to the reputation server and returns whether a paymentId has enough reputation to claim a grant

type IsReputableOpts added in v0.4.0

type IsReputableOpts struct {
	Platform string `url:"platform"`
}

IsReputableOpts - the query string options for the is reputable api call

func (*IsReputableOpts) GenerateQueryString added in v0.5.0

func (iro *IsReputableOpts) GenerateQueryString() (url.Values, error)

GenerateQueryString - implement the QueryStringBody interface

type IsWalletOnPlatformOpts added in v0.4.0

type IsWalletOnPlatformOpts struct {
	PriorTo string `url:"priorTo"`
}

IsWalletOnPlatformOpts - the query string options for the is reputable api call

func (*IsWalletOnPlatformOpts) GenerateQueryString added in v0.5.0

func (iwopo *IsWalletOnPlatformOpts) GenerateQueryString() (url.Values, error)

GenerateQueryString - implement the QueryStringBody interface

type IsWalletOnPlatformResponse added in v0.4.0

type IsWalletOnPlatformResponse struct {
	IsOnPlatform bool `json:"isOnPlatform"`
}

IsWalletOnPlatformResponse - will send back indication if wallet is on said platform

type IsWalletReputableResponse

type IsWalletReputableResponse struct {
	IsReputable bool `json:"isReputable"`
}

IsWalletReputableResponse is what the reputation server will send back when we ask if a wallet is reputable

Directories

Path Synopsis
Package mock_reputation is a generated GoMock package.
Package mock_reputation is a generated GoMock package.

Jump to

Keyboard shortcuts

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