web

package
v0.6.2-0...-d734bc3 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	Username string
	Password string
}

type InternalPassClient

type InternalPassClient struct {
	Requester
	ExternalBaseURI string
	InternalBaseURI string
	Credentials     *Credentials
}

InternalPassClient uses "private" backend URIs for interacting with the PASS repository It is intended for use on private networks. Public URIs will be converted to private URIs when accessing the repository.

func (*InternalPassClient) FetchEntity

func (c *InternalPassClient) FetchEntity(url string, entityPointer interface{}) error

FetchEntity fetches and parses the PASS entity at the given URL to the struct or map pointed to by entityPointer

type PassEntityFetcher

type PassEntityFetcher interface {
	FetchEntity(url string, entityPointer interface{}) error
}

PassEntityFetcher retrieves the JSON-LD content at the given url, and unmarshals it into the provided struct.

entityPointer is expected to be a pointer to a struct or map (i.e. anything encoding/json can unmarshal into). An error will be returned otherwise.

type Request

type Request struct {
	Resources []string
}

Request is a schema service request, logically containing a list of URLs

func (*Request) ReadJSON

func (r *Request) ReadJSON(stream io.Reader) error

Read parses a request body containing a single list of URIs, e.g.

["http://example.org/one", "http://example.org/two"]

func (*Request) ReadText

func (r *Request) ReadText(stream io.Reader) error

ReadText parses a body containing URIs separated by newlines

type Requester

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

Requester performs http requests

type SchemaRef

type SchemaRef struct {
	Schemas []string `json:"schemas"`
}

SchemaRef is a "cut down" pass entity containing only an array of schema URIs. It is a subset of the pass Repository entity.

func (*SchemaRef) Resolve

func (r *SchemaRef) Resolve(resolver jsonschema.Fetcher) ([]jsonschema.Instance, error)

Resolve fetches and parses all schemas referenced by this SchemaRef

type SchemaService

type SchemaService struct {
	PassClient    PassEntityFetcher
	SchemaFetcher jsonschema.Fetcher
}

func (*SchemaService) Schemas

func (s *SchemaService) Schemas(r *Request) ([]jsonschema.Instance, error)

Jump to

Keyboard shortcuts

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