ld

package
v0.0.0-...-57c6170 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InvalidRequestErrorCode is an error code for invalid requests.
	InvalidRequestErrorCode = command.Code(iota + command.LD)

	// AddContextsErrorCode is an error code for AddContexts command.
	AddContextsErrorCode

	// AddRemoteProviderErrorCode is an error code for AddRemoteProvider command.
	AddRemoteProviderErrorCode

	// RefreshRemoteProviderErrorCode is an error code for RefreshRemoteProvider command.
	RefreshRemoteProviderErrorCode

	// DeleteRemoteProviderErrorCode is an error code for DeleteRemoteProvider command.
	DeleteRemoteProviderErrorCode

	// GetAllRemoteProvidersErrorCode is an error code for GetAllRemoteProviders command.
	GetAllRemoteProvidersErrorCode

	// RefreshAllRemoteProvidersErrorCode is an error code for RefreshAllRemoteProviders command.
	RefreshAllRemoteProvidersErrorCode
)
View Source
const (
	// CommandName is a base command name for JSON-LD operations.
	CommandName = "ld"

	// AddContextsCommandMethod is a command method for adding contexts.
	AddContextsCommandMethod = "AddContexts"

	// AddRemoteProviderCommandMethod is a command method for adding new remote provider.
	AddRemoteProviderCommandMethod = "AddRemoteProvider"

	// RefreshRemoteProviderCommandMethod is a command method for refreshing contexts from the remote provider.
	RefreshRemoteProviderCommandMethod = "RefreshRemoteProvider"

	// DeleteRemoteProviderCommandMethod is a command method for deleting provider and contexts from that provider.
	DeleteRemoteProviderCommandMethod = "DeleteRemoteProvider"

	// GetAllRemoteProvidersCommandMethod is a command method for getting list of all remote providers.
	GetAllRemoteProvidersCommandMethod = "GetAllRemoteProviders"

	// RefreshAllRemoteProvidersCommandMethod is a command method for refreshing contexts from all remote providers.
	RefreshAllRemoteProvidersCommandMethod = "RefreshAllRemoteProviders"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddContextsRequest

type AddContextsRequest struct {
	Documents []ldcontext.Document `json:"documents"`
}

AddContextsRequest is a request model for adding JSON-LD contexts.

type AddRemoteProviderRequest

type AddRemoteProviderRequest struct {
	Endpoint string `json:"endpoint"`
}

AddRemoteProviderRequest is a request model for adding a new remote context provider.

type Command

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

Command contains command operations.

func New

func New(svc ld.Service, opts ...Option) *Command

New returns a new JSON-LD command instance.

func (*Command) AddContexts

func (c *Command) AddContexts(w io.Writer, r io.Reader) command.Error

AddContexts command adds JSON-LD contexts to the underlying storage.

func (*Command) AddRemoteProvider

func (c *Command) AddRemoteProvider(w io.Writer, r io.Reader) command.Error

AddRemoteProvider command adds remote provider and JSON-LD contexts from that provider.

func (*Command) DeleteRemoteProvider

func (c *Command) DeleteRemoteProvider(w io.Writer, r io.Reader) command.Error

DeleteRemoteProvider command deletes remote provider and contexts from that provider.

func (*Command) GetAllRemoteProviders

func (c *Command) GetAllRemoteProviders(w io.Writer, _ io.Reader) command.Error

GetAllRemoteProviders command gets all remote providers.

func (*Command) GetHandlers

func (c *Command) GetHandlers() []command.Handler

GetHandlers returns list of all commands supported by this controller command.

func (*Command) RefreshAllRemoteProviders

func (c *Command) RefreshAllRemoteProviders(w io.Writer, _ io.Reader) command.Error

RefreshAllRemoteProviders command updates contexts from all remote providers.

func (*Command) RefreshRemoteProvider

func (c *Command) RefreshRemoteProvider(w io.Writer, r io.Reader) command.Error

RefreshRemoteProvider command updates contexts from the remote provider.

type GetAllRemoteProvidersResponse

type GetAllRemoteProvidersResponse struct {
	Providers []ld.RemoteProviderRecord `json:"providers"`
}

GetAllRemoteProvidersResponse is a response model for listing all remote providers.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient represents an HTTP client.

type Option

type Option func(cmd *Command)

Option configures the JSON-LD command.

func WithHTTPClient

func WithHTTPClient(client HTTPClient) Option

WithHTTPClient sets the custom HTTP client.

type ProviderID

type ProviderID struct {
	ID string `json:"id"`
}

ProviderID is a request/response model for operations that involve remote provider ID.

Jump to

Keyboard shortcuts

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