vulcan

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package vulcan allows to consume the Vulcan async API.

Index

Constants

View Source
const (
	// MajorVersion is the major version of the Vulcan asynchronous API
	// supported by [Client].
	MajorVersion = 0

	// AssetsEntityName is the name of the entity linked to assets.
	AssetsEntityName = "assets-v0"
)

Variables

View Source
var ErrUnsupportedVersion = errors.New("unsupported version")

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	Key   string `json:"Key"`
	Value string `json:"Value"`
}

Annotation represents the "annotation" model as defined by the Vulcan async API.

type AssetHandler

type AssetHandler func(payload AssetPayload, isNil bool) error

AssetHandler processes an asset. isNil is true when the value of the stream message is nil.

type AssetMetadata

type AssetMetadata struct {
	Version    string    `json:"Version"`
	Type       AssetType `json:"Type"`
	Identifier string    `json:"Identifier"`
}

AssetMetadata represents the "assetMetadata" model as defined by the Vulcan async API.

type AssetPayload

type AssetPayload struct {
	ID          string       `json:"Id"`
	Team        Team         `json:"Team"`
	Alias       string       `json:"Alias"`
	Rolfp       string       `json:"Rolfp"`
	Scannable   bool         `json:"Scannable"`
	AssetType   AssetType    `json:"AssetType"`
	Identifier  string       `json:"Identifier"`
	Annotations []Annotation `json:"Annotations"`
}

AssetPayload represents the "assetPayload" model as defined by the Vulcan async API.

type AssetType

type AssetType string

AssetType represents the "assetType" model as defined by the Vulcan async API.

type Client

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

Client is a Vulcan async API client.

func NewClient

func NewClient(proc stream.Processor) Client

NewClient returns a client for the Vulcan async API using the provided stream processor.

func (Client) ProcessAssets

func (c Client) ProcessAssets(ctx context.Context, h AssetHandler) error

ProcessAssets receives assets from the underlying stream and processes them using the provided handler. This method blocks the calling goroutine until the specified context is cancelled.

type Team

type Team struct {
	ID          string `json:"Id"`
	Name        string `json:"Name"`
	Description string `json:"Description"`
	Tag         string `json:"Tag"`
}

Team represents the "team" model as defined by the Vulcan async API.

Jump to

Keyboard shortcuts

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