virgilhttp

package
v4.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HTTPEndpoints = map[Endpoint]*HTTPEndpoint{
	GetCard: {
		Method:      http.MethodGet,
		URL:         "%s/v4/card/%s",
		ServiceType: ROCardService,
		Params:      1,
	},
	SearchCards: {
		Method:      http.MethodPost,
		URL:         "%s/v4/card/actions/search",
		ServiceType: ROCardService,
	},
	CreateCard: {
		Method:      http.MethodPost,
		URL:         "%s/v1/card",
		ServiceType: VRAService,
	},
	RevokeCard: {
		Method:      http.MethodDelete,
		URL:         "%s/v1/card/%s",
		ServiceType: VRAService,
		Params:      1,
	},
	VerifyIdentity: {
		Method:      http.MethodPost,
		URL:         "%s/v1/verify",
		ServiceType: IdentityService,
	},
	ConfirmIdentity: {
		Method:      http.MethodPost,
		URL:         "%s/v1/confirm",
		ServiceType: IdentityService,
	},
	ValidateIdentity: {
		Method:      http.MethodPost,
		URL:         "%s/v1/validate",
		ServiceType: IdentityService,
	},
	AddRelation: {
		Method:      http.MethodPost,
		URL:         "%s/v4/card/%s/collections/relations",
		ServiceType: Cardservice,
		Params:      1,
	},
	DeleteRelation: {
		Method:      http.MethodDelete,
		URL:         "%s/v4/card/%s/collections/relations",
		ServiceType: Cardservice,
		Params:      1,
	},
}

Functions

func TransportClientDoer

func TransportClientDoer(client Doer) func(t *TransportClient)

TransportClientDoer set a doer to Http Transport client

Types

type Doer

type Doer interface {
	Do(*fasthttp.Request, *fasthttp.Response) error
}

Doer is a simple interface for wrap request

type HTTPEndpoint

type HTTPEndpoint struct {
	URL         string
	Method      string
	ServiceType ServiceType
	Params      int
}

type ServiceType

type ServiceType int
const (
	Cardservice ServiceType = iota
	ROCardService
	IdentityService
	VRAService
)

type TransportClient

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

TransportClient is implementation for virgil client transport protocol

func NewTransportClient

func NewTransportClient(serviceURL string, roServiceURL string, identityServiceURL string, vraServiceURL string, opts ...func(t *TransportClient)) *TransportClient

NewTransportClient create a new instance of HTTP Transport protocol for Virgil Client You can send nil for second paramter and by defaolt will be used http.Client

func (*TransportClient) Call

func (c *TransportClient) Call(endpoint endpoints.Endpoint, payload interface{}, returnObj interface{}, params ...interface{}) error

func (*TransportClient) SetToken

func (c *TransportClient) SetToken(token string)

func (*TransportClient) ToServiceURL

func (c *TransportClient) ToServiceURL(serviceType ServiceType) (string, error)

Jump to

Keyboard shortcuts

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