internal

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(ctx context.Context, opts *BuildOptions) (*gobl.Envelope, error)

Build builds and validates a GOBL envelope from the opts.

func Bulk added in v0.14.0

func Bulk(ctx context.Context, in io.Reader) <-chan *BulkResponse

Bulk processes a stream of bulk requests.

func Envelop added in v0.13.0

func Envelop(ctx context.Context, opts *BuildOptions) (*gobl.Envelope, error)

Envelop assumes the incoming BuildOptions define the contents of a document payload and we need to prepare the envelope around it.

func FindType added in v0.6.0

func FindType(term string) schema.ID

func Verify

func Verify(ctx context.Context, in io.Reader, key *dsig.PublicKey) error

Verify reads a GOBL document from in, and returns an error if there are any validation errors.

Types

type BuildOptions

type BuildOptions struct {
	Template   io.Reader
	Data       io.Reader
	DocType    string
	SetYAML    map[string]string
	SetString  map[string]string
	SetFile    map[string]string
	PrivateKey *dsig.PrivateKey
}

BuildOptions are the options to pass to the Build function.

type BuildRequest added in v0.14.0

type BuildRequest struct {
	Template   json.RawMessage  `json:"template"`
	Data       json.RawMessage  `json:"data"`
	PrivateKey *dsig.PrivateKey `json:"privatekey"`
	DocType    string           `json:"type"`
}

BuildRequest is the payload for a build reqeuest.

type BulkRequest added in v0.14.0

type BulkRequest struct {
	// Action is the action to perform on the payload.
	Action string `json:"action"`
	// ReqID is an opaque request ID, which is returned with the associated
	// response.
	ReqID string `json:"req_id"`
	// Payload is the payload upon which to perform the action.
	Payload json.RawMessage `json:"payload"`
}

BulkRequest represents a single request in the stream of bulk requests.

type BulkResponse added in v0.14.0

type BulkResponse struct {
	// ReqID is an exact copy of the value provided in the request, if any.
	ReqID string `json:"req_id,omitempty"`
	// SeqID is the sequence ID of the request this response correspond to,
	// starting at 1.
	SeqID int64 `json:"seq_id"`
	// Payload is the response payload.
	Payload json.RawMessage `json:"payload,omitempty"`
	// Error represents an error processing a request item.
	Error string `json:"error"`
	// IsFinal will be true once the end of the request input stream has been
	// reached, or an unrecoverable error has occurred.
	IsFinal bool `json:"is_final"`
}

BulkResponse represents a singel response in the stream of bulk responses.

type KeygenResponse added in v0.14.0

type KeygenResponse struct {
	Private *dsig.PrivateKey `json:"private"`
	Public  *dsig.PublicKey  `json:"public"`
}

KeygenResponse is the payload for a key generation response.

type VerifyRequest added in v0.14.0

type VerifyRequest struct {
	Data      json.RawMessage `json:"data"`
	PublicKey *dsig.PublicKey `json:"publickey"`
}

VerifyRequest is the payload for a verification request.

type VerifyResponse added in v0.14.0

type VerifyResponse struct {
	OK bool `json:"ok"`
}

VerifyResponse is the response to a verification request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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