eidos

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const TaggerPathPrefix = "/twirp/ttab.eidos.Tagger/"

TaggerPathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html

Variables

View Source
var File_eidos_service_proto protoreflect.FileDescriptor

Functions

func WriteError

func WriteError(resp http.ResponseWriter, err error)

WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)

Types

type AnalyseDocumentRequest

type AnalyseDocumentRequest struct {

	// DocumentUUID is the uuid of the document to analyse, optional. Required if
	// no document is provided in the request.
	DocumentUuid string `protobuf:"bytes,1,opt,name=document_uuid,json=documentUuid,proto3" json:"document_uuid,omitempty"`
	// Document to analyse, optional.
	Document *newsdoc.Document `protobuf:"bytes,2,opt,name=document,proto3" json:"document,omitempty"`
	// contains filtered or unexported fields
}

func (*AnalyseDocumentRequest) Descriptor deprecated

func (*AnalyseDocumentRequest) Descriptor() ([]byte, []int)

Deprecated: Use AnalyseDocumentRequest.ProtoReflect.Descriptor instead.

func (*AnalyseDocumentRequest) GetDocument

func (x *AnalyseDocumentRequest) GetDocument() *newsdoc.Document

func (*AnalyseDocumentRequest) GetDocumentUuid

func (x *AnalyseDocumentRequest) GetDocumentUuid() string

func (*AnalyseDocumentRequest) ProtoMessage

func (*AnalyseDocumentRequest) ProtoMessage()

func (*AnalyseDocumentRequest) ProtoReflect

func (x *AnalyseDocumentRequest) ProtoReflect() protoreflect.Message

func (*AnalyseDocumentRequest) Reset

func (x *AnalyseDocumentRequest) Reset()

func (*AnalyseDocumentRequest) String

func (x *AnalyseDocumentRequest) String() string

type AnalyseDocumentResponse

type AnalyseDocumentResponse struct {

	// Meta document with the detected entities and topics.
	Meta *newsdoc.Document `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta,omitempty"`
	// Text used in recognition query.
	Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
	// contains filtered or unexported fields
}

func (*AnalyseDocumentResponse) Descriptor deprecated

func (*AnalyseDocumentResponse) Descriptor() ([]byte, []int)

Deprecated: Use AnalyseDocumentResponse.ProtoReflect.Descriptor instead.

func (*AnalyseDocumentResponse) GetMeta

func (*AnalyseDocumentResponse) GetText

func (x *AnalyseDocumentResponse) GetText() string

func (*AnalyseDocumentResponse) ProtoMessage

func (*AnalyseDocumentResponse) ProtoMessage()

func (*AnalyseDocumentResponse) ProtoReflect

func (x *AnalyseDocumentResponse) ProtoReflect() protoreflect.Message

func (*AnalyseDocumentResponse) Reset

func (x *AnalyseDocumentResponse) Reset()

func (*AnalyseDocumentResponse) String

func (x *AnalyseDocumentResponse) String() string

type HTTPClient

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

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.

type RegisterUsageRequest added in v0.4.3

type RegisterUsageRequest struct {

	// ContentType of the media that was tagged.
	ContentType string `protobuf:"bytes,1,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"`
	// ContentURI is an URI that identified the tagged media.
	ContextUri string `protobuf:"bytes,2,opt,name=context_uri,json=contextUri,proto3" json:"context_uri,omitempty"`
	// The UUIDs of the entities that were used.
	EntityUuids []string `protobuf:"bytes,3,rep,name=entity_uuids,json=entityUuids,proto3" json:"entity_uuids,omitempty"`
	// contains filtered or unexported fields
}

func (*RegisterUsageRequest) Descriptor deprecated added in v0.4.3

func (*RegisterUsageRequest) Descriptor() ([]byte, []int)

Deprecated: Use RegisterUsageRequest.ProtoReflect.Descriptor instead.

func (*RegisterUsageRequest) GetContentType added in v0.4.3

func (x *RegisterUsageRequest) GetContentType() string

func (*RegisterUsageRequest) GetContextUri added in v0.4.3

func (x *RegisterUsageRequest) GetContextUri() string

func (*RegisterUsageRequest) GetEntityUuids added in v0.4.3

func (x *RegisterUsageRequest) GetEntityUuids() []string

func (*RegisterUsageRequest) ProtoMessage added in v0.4.3

func (*RegisterUsageRequest) ProtoMessage()

func (*RegisterUsageRequest) ProtoReflect added in v0.4.3

func (x *RegisterUsageRequest) ProtoReflect() protoreflect.Message

func (*RegisterUsageRequest) Reset added in v0.4.3

func (x *RegisterUsageRequest) Reset()

func (*RegisterUsageRequest) String added in v0.4.3

func (x *RegisterUsageRequest) String() string

type RegisterUsageResponse added in v0.4.3

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

func (*RegisterUsageResponse) Descriptor deprecated added in v0.4.3

func (*RegisterUsageResponse) Descriptor() ([]byte, []int)

Deprecated: Use RegisterUsageResponse.ProtoReflect.Descriptor instead.

func (*RegisterUsageResponse) ProtoMessage added in v0.4.3

func (*RegisterUsageResponse) ProtoMessage()

func (*RegisterUsageResponse) ProtoReflect added in v0.4.3

func (x *RegisterUsageResponse) ProtoReflect() protoreflect.Message

func (*RegisterUsageResponse) Reset added in v0.4.3

func (x *RegisterUsageResponse) Reset()

func (*RegisterUsageResponse) String added in v0.4.3

func (x *RegisterUsageResponse) String() string

type Tagger

type Tagger interface {
	// AnalyseDocument and return the generated meta document and the text
	// representatin of the document that was used for analysis.
	AnalyseDocument(context.Context, *AnalyseDocumentRequest) (*AnalyseDocumentResponse, error)

	// RegisterUsage is used to inform eidos when an external system has tagged a
	// piece of media with entities managed by eidos.
	RegisterUsage(context.Context, *RegisterUsageRequest) (*RegisterUsageResponse, error)
}

func NewTaggerJSONClient

func NewTaggerJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Tagger

NewTaggerJSONClient creates a JSON client that implements the Tagger interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewTaggerProtobufClient

func NewTaggerProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Tagger

NewTaggerProtobufClient creates a Protobuf client that implements the Tagger interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type TwirpServer

type TwirpServer interface {
	http.Handler

	// ServiceDescriptor returns gzipped bytes describing the .proto file that
	// this service was generated from. Once unzipped, the bytes can be
	// unmarshalled as a
	// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.
	//
	// The returned integer is the index of this particular service within that
	// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
	// low-level field, expected to be used for reflection.
	ServiceDescriptor() ([]byte, int)

	// ProtocGenTwirpVersion is the semantic version string of the version of
	// twirp used to generate this file.
	ProtocGenTwirpVersion() string

	// PathPrefix returns the HTTP URL path prefix for all methods handled by this
	// service. This can be used with an HTTP mux to route Twirp requests.
	// The path prefix is in the form: "/<prefix>/<package>.<Service>/"
	// that is, everything in a Twirp route except for the <Method> at the end.
	PathPrefix() string
}

TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.

func NewTaggerServer

func NewTaggerServer(svc Tagger, opts ...interface{}) TwirpServer

NewTaggerServer builds a TwirpServer that can be used as an http.Handler to handle HTTP requests that are routed to the right method in the provided svc implementation. The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).

Jump to

Keyboard shortcuts

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