Documentation ¶
Index ¶
- func Build(ctx context.Context, opts *BuildOptions) (interface{}, error)
- func Bulk(ctx context.Context, opts *BulkOptions) <-chan *BulkResponse
- func FindType(term string) schema.ID
- func Sign(ctx context.Context, opts *SignOptions) (*gobl.Envelope, error)
- func Validate(ctx context.Context, r io.Reader) error
- func Verify(ctx context.Context, in io.Reader, key *dsig.PublicKey) error
- type BuildOptions
- type BuildRequest
- type BulkOptions
- type BulkRequest
- type BulkResponse
- type KeygenResponse
- type ParseOptions
- type SignOptions
- type SignRequest
- type ValidateRequest
- type ValidateResponse
- type VerifyRequest
- type VerifyResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build(ctx context.Context, opts *BuildOptions) (interface{}, error)
Build builds and validates GOBL data.
func Bulk ¶ added in v0.14.0
func Bulk(ctx context.Context, opts *BulkOptions) <-chan *BulkResponse
Bulk processes a stream of bulk requests.
func Sign ¶ added in v0.40.0
Sign parses a GOBL document into an envelope, performs calculations, validates it, and finally signs its headers. The parsed envelope *must* be a draft, or else an error is returned.
Types ¶
type BuildOptions ¶
type BuildOptions struct { *ParseOptions // When set to a non-nil value, the returned data is wrapped in an envelope (if needed) // with its `draft` property set to true or false. Draft *bool }
type BuildRequest ¶ added in v0.14.0
type BuildRequest struct { Template []byte `json:"template"` Data []byte `json:"data"` DocType string `json:"type"` Draft *bool `json:"draft"` Envelop bool `json:"envelop"` }
BuildRequest is the payload for a build reqeuest.
type BulkOptions ¶ added in v0.46.0
type BulkOptions struct { // In is the input stream of requests In io.Reader // DefaultPrivateKey is the default private key to use with sign requests DefaultPrivateKey *dsig.PrivateKey }
BulkOptions are the options used for processing a stream of bulk requests.
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"` // When true, responses are indented for easier human consumption Indent bool `json:"indent"` }
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 ParseOptions ¶ added in v0.42.0
type ParseOptions struct { Template io.Reader Data io.Reader DocType string SetYAML map[string]string SetString map[string]string SetFile map[string]string // When set to `true`, the parsed data is wrapped in an envelope (if needed). Envelop bool }
ParseOptions are the options used for parsing incoming GOBL data.
type SignOptions ¶ added in v0.42.0
type SignOptions struct { *ParseOptions PrivateKey *dsig.PrivateKey }
SignOptions are the options used for signing a GOBL document.
type SignRequest ¶ added in v0.48.1
type SignRequest struct { Template []byte `json:"template"` Data []byte `json:"data"` PrivateKey *dsig.PrivateKey `json:"privatekey"` DocType string `json:"type"` Draft *bool `json:"draft"` Envelop bool `json:"envelop"` }
SignRequest is the payload for a sign reqeuest.
type ValidateRequest ¶ added in v0.42.0
type ValidateRequest struct {
Data []byte `json:"data"`
}
type ValidateResponse ¶ added in v0.42.0
type ValidateResponse struct {
OK bool `json:"ok"`
}
ValidateResponse is the response to a validate request.
type VerifyRequest ¶ added in v0.14.0
type VerifyRequest struct { Data []byte `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.