api

package
v0.0.0-...-8098de6 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: GPL-3.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 Extend

type Extend struct {

	// Definition of the settings configurable by the user when fetching a property
	PropertySettings []*PropertySetting `json:"property_settings,omitempty"`

	// Location of the endpoint to propose properties to fetch for a given type
	ProposeProperties *ServiceDefinition `json:"propose_properties,omitempty"`
}

Extend Settings for the data extension protocol, to fetch property values

type ExtendProperty

type ExtendProperty struct {
	// ID of the property requested.
	ID string `json:"id"`

	// Settings that apply to the property value request.
	Settings map[string]interface{} `json:"settings,omitempty"`
}

ExtendProperty defines a property requested in an ExtendRequest.

type ExtendRequest

type ExtendRequest struct {
	// IDs is the list of Entity IDs to extend with property values.
	IDs []model.EntityID `json:"ids"`

	// Properties defines the list of requested properties.
	Properties []*ExtendProperty `json:"properties"`
}

ExtendRequest defines a property request for a set of Entity IDs.

type Manifest

type Manifest struct {

	// DefaultTypes contains a list of entity types supported for reconciliation.
	DefaultTypes []*model.Type `json:"defaultTypes,omitempty"`

	// Extend protocol defitions for the data extension protocol, to fetch property values.
	Extend *Extend `json:"extend,omitempty"`

	// IdentifierSpace is a URI describing the entity identifiers used in this service
	IdentifierSpace string `json:"identifierSpace"`

	// Name is a human-readable name for the service or data source.
	Name string `json:"name"`

	// Preview protocol definitions for retrieving HTML previews of entities.
	Preview *Preview `json:"preview,omitempty"`

	// SchemaSpace is a URI describing the schema used in this service.
	SchemaSpace string `json:"schemaSpace"`

	// Suggest protocol defintions for auto-completion of entities, properties and types.
	Suggest *Suggest `json:"suggest,omitempty"`

	// Versions contains a list of API versions supported by this service.
	Versions []string `json:"versions"`

	// View contains a template to turn an entity identifier into a URI.
	View *View `json:"view,omitempty"`
}

Manifest describes the features supported by this Reconciliation endpoint.

type Preview

type Preview struct {
	// Width of the container that will show the HTML preview.
	Width int `json:"width"`

	// Width of the container that will show the HTML preview.
	Height int `json:"height"`

	// URL teamplte to transforms the entity ID into a preview URL for it.
	URL URLTemplate `json:"url"`
}

Preview Settings for the preview protocol, for HTML previews of entities

type PropertyChoice

type PropertyChoice struct {
	// Name of the property value displayed to the user.
	Name string `json:"name"`
	// Value of the property as stored in the data.
	Value string `json:"value"`
}

PropertyChoice is a selectable choice for a property in a select.

type PropertySetting

type PropertySetting struct {
	// Name of the setting, which identifies the setting uniquely.
	Name string `json:"name"`

	// Label is used when presenting the setting to the user in a form.
	Label string `json:"label"`

	// HelpText describes the meaning of the field to the user. This is
	// meant to be a short string that can be displayed alongside the
	// corresponding form field.
	HelpText string `json:"help_text"`

	// Default value for the setting, when not provided by the user.
	Default string `json:"default"`

	// Type determines which type of value the property setting is
	// expected to store:  one of the strings "number", "text",
	// "checkbox", or "select". Clients SHOULD render this setting
	// with the corresponding HTML element.
	Type string `json:"type"`

	// Choices is a list of property setting choices when Type is select.
	Choices []*PropertyChoice `json:"choices,omitempty"`
}

PropertySetting defines a configurable setting for a requested property.

type Service

type Service struct {
	// embedded servemux allows Service to act as one also
	*http.ServeMux
	// contains filtered or unexported fields
}

Service provides an implementation of the Reconciliation Service API.

func NewService

func NewService(urlRoot, prefix string, src model.Source) *Service

NewService returns a new service provider bound to the specified url and prefix, which serves reconciliation request for the given data source.

type ServiceDefinition

type ServiceDefinition struct {
	// ServicePath describes the path appended to ServiceURL to access the service.
	ServicePath string `json:"service_path,omitempty"`

	// ServiceURL describes the root URL to access the service.
	ServiceURL string `json:"service_url,omitempty"`
}

ServiceDefinition describes a service endpoint by its base URL and path.

type Suggest

type Suggest struct {
	// Entity describes the entity suggestion endpoint.
	Entity *ServiceDefinition `json:"entity,omitempty"`

	// Property describes the property suggestion endpoint.
	Property *ServiceDefinition `json:"property,omitempty"`

	// Type describes the type suggestion endpoint.
	Type *ServiceDefinition `json:"type,omitempty"`
}

Suggest describes for the suggest protocol, to auto-complete entities, properties and types

type URLTemplate

type URLTemplate string

URLTemplate is a URL template pattern. Internally, it contains a '%s' placeholder although the spec uses '{{id}}' or '${id}' for the placeholder officially.

func (URLTemplate) Apply

func (u URLTemplate) Apply(ident interface{}) string

Apply returns the URL after interpolating an identifier into the template.

func (URLTemplate) MarshalJSON

func (u URLTemplate) MarshalJSON() ([]byte, error)

MarshalJSON implements the necessary json interface, so it can transparently convert the internal representation to expected format.

func (*URLTemplate) UnmarshalJSON

func (u *URLTemplate) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the necessary json interface, so it can transparently update the template for string interpolation.

type View

type View struct {
	// URL template to transform an entity identifier into the corresponding URI
	URL URLTemplate `json:"url"`
}

View defines a template to turn an entity identifier into a URI.

Jump to

Keyboard shortcuts

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