genai

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 GeneratePathPrefix = "/twirp/ttab.genai.Generate/"

GeneratePathPrefix 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 (
	JobStatus_name = map[int32]string{
		0: "STATUS_UNKNOWN",
		1: "STATUS_DONE",
		2: "STATUS_FAILED",
	}
	JobStatus_value = map[string]int32{
		"STATUS_UNKNOWN": 0,
		"STATUS_DONE":    1,
		"STATUS_FAILED":  2,
	}
)

Enum value maps for JobStatus.

View Source
var (
	JobType_name = map[int32]string{
		0: "JOB_TYPE_UNKNOWN",
		1: "JOB_TYPE_DOCUMENT",
		2: "JOB_TYPE_FEEDBACK",
		3: "JOB_TYPE_TEXT",
	}
	JobType_value = map[string]int32{
		"JOB_TYPE_UNKNOWN":  0,
		"JOB_TYPE_DOCUMENT": 1,
		"JOB_TYPE_FEEDBACK": 2,
		"JOB_TYPE_TEXT":     3,
	}
)

Enum value maps for JobType.

View Source
var File_genai_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 DocumentFromTextRequest

type DocumentFromTextRequest struct {

	// Model is the URI of the model to use.
	Model string `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"`
	// Text to send as input.
	Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
	// UUID to set for the document.
	Uuid string `protobuf:"bytes,3,opt,name=uuid,proto3" json:"uuid,omitempty"`
	// URI to set for the document.
	Uri string `protobuf:"bytes,4,opt,name=uri,proto3" json:"uri,omitempty"`
	// AdditionalLinks that should be added to the generated document.
	AdditionalLinks []*newsdoc.Block `protobuf:"bytes,5,rep,name=additionalLinks,proto3" json:"additionalLinks,omitempty"`
	// AdditionalMeta blocks that should be added to the generated document.
	AdditionalMeta []*newsdoc.Block `protobuf:"bytes,6,rep,name=additionalMeta,proto3" json:"additionalMeta,omitempty"`
	// AsyncTimeoutSeconds is the time after which a JobID will be returned
	// instead of a direct result. Optional, defaults to no timeout.
	AsyncTimeoutSeconds int64 `protobuf:"varint,7,opt,name=async_timeout_seconds,json=asyncTimeoutSeconds,proto3" json:"async_timeout_seconds,omitempty"`
	// contains filtered or unexported fields
}

func (*DocumentFromTextRequest) Descriptor deprecated

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

Deprecated: Use DocumentFromTextRequest.ProtoReflect.Descriptor instead.

func (x *DocumentFromTextRequest) GetAdditionalLinks() []*newsdoc.Block

func (*DocumentFromTextRequest) GetAdditionalMeta

func (x *DocumentFromTextRequest) GetAdditionalMeta() []*newsdoc.Block

func (*DocumentFromTextRequest) GetAsyncTimeoutSeconds

func (x *DocumentFromTextRequest) GetAsyncTimeoutSeconds() int64

func (*DocumentFromTextRequest) GetModel

func (x *DocumentFromTextRequest) GetModel() string

func (*DocumentFromTextRequest) GetText

func (x *DocumentFromTextRequest) GetText() string

func (*DocumentFromTextRequest) GetUri

func (x *DocumentFromTextRequest) GetUri() string

func (*DocumentFromTextRequest) GetUuid

func (x *DocumentFromTextRequest) GetUuid() string

func (*DocumentFromTextRequest) ProtoMessage

func (*DocumentFromTextRequest) ProtoMessage()

func (*DocumentFromTextRequest) ProtoReflect

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

func (*DocumentFromTextRequest) Reset

func (x *DocumentFromTextRequest) Reset()

func (*DocumentFromTextRequest) String

func (x *DocumentFromTextRequest) String() string

type DocumentFromTextResponse

type DocumentFromTextResponse struct {

	// JobID that identifies the job.
	JobId int64 `protobuf:"varint,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"`
	// Document that was generated.
	Document *newsdoc.Document `protobuf:"bytes,2,opt,name=document,proto3" json:"document,omitempty"`
	// contains filtered or unexported fields
}

func (*DocumentFromTextResponse) Descriptor deprecated

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

Deprecated: Use DocumentFromTextResponse.ProtoReflect.Descriptor instead.

func (*DocumentFromTextResponse) GetDocument

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

func (*DocumentFromTextResponse) GetJobId

func (x *DocumentFromTextResponse) GetJobId() int64

func (*DocumentFromTextResponse) ProtoMessage

func (*DocumentFromTextResponse) ProtoMessage()

func (*DocumentFromTextResponse) ProtoReflect

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

func (*DocumentFromTextResponse) Reset

func (x *DocumentFromTextResponse) Reset()

func (*DocumentFromTextResponse) String

func (x *DocumentFromTextResponse) String() string

type Generate

type Generate interface {
	// DocumentFromText creates a document from an input text.
	DocumentFromText(context.Context, *DocumentFromTextRequest) (*DocumentFromTextResponse, error)

	// LanguageFeedback gives feedback on a text.
	LanguageFeedback(context.Context, *LanguageFeedbackRequest) (*LanguageFeedbackResponse, error)

	// Text generates text from a input.
	Text(context.Context, *TextRequest) (*TextResponse, error)

	// ListJobs that have been submitted.
	ListJobs(context.Context, *ListJobsRequest) (*ListJobsResponse, error)

	// WaitForJobs is used to wait for status updates for a set of jobs.
	WaitForJobs(context.Context, *WaitForJobsRequest) (*WaitForJobsResponse, error)

	// GetResult returns the result for a job.
	GetResult(context.Context, *GetResultRequest) (*GetResultResponse, error)
}

func NewGenerateJSONClient

func NewGenerateJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Generate

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

func NewGenerateProtobufClient

func NewGenerateProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Generate

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

type GetResultRequest

type GetResultRequest struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetResultRequest) Descriptor deprecated

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

Deprecated: Use GetResultRequest.ProtoReflect.Descriptor instead.

func (*GetResultRequest) GetId

func (x *GetResultRequest) GetId() int64

func (*GetResultRequest) ProtoMessage

func (*GetResultRequest) ProtoMessage()

func (*GetResultRequest) ProtoReflect

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

func (*GetResultRequest) Reset

func (x *GetResultRequest) Reset()

func (*GetResultRequest) String

func (x *GetResultRequest) String() string

type GetResultResponse

type GetResultResponse struct {
	Id        int64             `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Model     string            `protobuf:"bytes,2,opt,name=model,proto3" json:"model,omitempty"`
	Type      JobType           `protobuf:"varint,3,opt,name=type,proto3,enum=ttab.genai.JobType" json:"type,omitempty"`
	Status    JobStatus         `protobuf:"varint,4,opt,name=status,proto3,enum=ttab.genai.JobStatus" json:"status,omitempty"`
	ErrorCode string            `protobuf:"bytes,5,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"`
	Error     string            `protobuf:"bytes,6,opt,name=error,proto3" json:"error,omitempty"`
	Document  *newsdoc.Document `protobuf:"bytes,7,opt,name=document,proto3" json:"document,omitempty"`
	Feedback  *LanguageFeedback `protobuf:"bytes,8,opt,name=feedback,proto3" json:"feedback,omitempty"`
	// contains filtered or unexported fields
}

func (*GetResultResponse) Descriptor deprecated

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

Deprecated: Use GetResultResponse.ProtoReflect.Descriptor instead.

func (*GetResultResponse) GetDocument

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

func (*GetResultResponse) GetError

func (x *GetResultResponse) GetError() string

func (*GetResultResponse) GetErrorCode

func (x *GetResultResponse) GetErrorCode() string

func (*GetResultResponse) GetFeedback

func (x *GetResultResponse) GetFeedback() *LanguageFeedback

func (*GetResultResponse) GetId

func (x *GetResultResponse) GetId() int64

func (*GetResultResponse) GetModel

func (x *GetResultResponse) GetModel() string

func (*GetResultResponse) GetStatus

func (x *GetResultResponse) GetStatus() JobStatus

func (*GetResultResponse) GetType

func (x *GetResultResponse) GetType() JobType

func (*GetResultResponse) ProtoMessage

func (*GetResultResponse) ProtoMessage()

func (*GetResultResponse) ProtoReflect

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

func (*GetResultResponse) Reset

func (x *GetResultResponse) Reset()

func (*GetResultResponse) String

func (x *GetResultResponse) 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 JobReference

type JobReference struct {
	Id     int64     `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Status JobStatus `protobuf:"varint,2,opt,name=status,proto3,enum=ttab.genai.JobStatus" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*JobReference) Descriptor deprecated

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

Deprecated: Use JobReference.ProtoReflect.Descriptor instead.

func (*JobReference) GetId

func (x *JobReference) GetId() int64

func (*JobReference) GetStatus

func (x *JobReference) GetStatus() JobStatus

func (*JobReference) ProtoMessage

func (*JobReference) ProtoMessage()

func (*JobReference) ProtoReflect

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

func (*JobReference) Reset

func (x *JobReference) Reset()

func (*JobReference) String

func (x *JobReference) String() string

type JobStatus

type JobStatus int32
const (
	JobStatus_STATUS_UNKNOWN JobStatus = 0
	JobStatus_STATUS_DONE    JobStatus = 1
	JobStatus_STATUS_FAILED  JobStatus = 2
)

func (JobStatus) Descriptor

func (JobStatus) Descriptor() protoreflect.EnumDescriptor

func (JobStatus) Enum

func (x JobStatus) Enum() *JobStatus

func (JobStatus) EnumDescriptor deprecated

func (JobStatus) EnumDescriptor() ([]byte, []int)

Deprecated: Use JobStatus.Descriptor instead.

func (JobStatus) Number

func (x JobStatus) Number() protoreflect.EnumNumber

func (JobStatus) String

func (x JobStatus) String() string

func (JobStatus) Type

type JobType

type JobType int32
const (
	JobType_JOB_TYPE_UNKNOWN  JobType = 0
	JobType_JOB_TYPE_DOCUMENT JobType = 1
	JobType_JOB_TYPE_FEEDBACK JobType = 2
	JobType_JOB_TYPE_TEXT     JobType = 3
)

func (JobType) Descriptor

func (JobType) Descriptor() protoreflect.EnumDescriptor

func (JobType) Enum

func (x JobType) Enum() *JobType

func (JobType) EnumDescriptor deprecated

func (JobType) EnumDescriptor() ([]byte, []int)

Deprecated: Use JobType.Descriptor instead.

func (JobType) Number

func (x JobType) Number() protoreflect.EnumNumber

func (JobType) String

func (x JobType) String() string

func (JobType) Type

func (JobType) Type() protoreflect.EnumType

type LanguageFeedback

type LanguageFeedback struct {

	// Paragraph index. Set to -1 if the feedback couldn't be connected to a
	// specific paragraph.
	Paragraph int64 `protobuf:"varint,1,opt,name=paragraph,proto3" json:"paragraph,omitempty"`
	// Original text excerpt.
	Original string `protobuf:"bytes,2,opt,name=original,proto3" json:"original,omitempty"`
	// Suggestion for new text.
	Suggestion string `protobuf:"bytes,4,opt,name=suggestion,proto3" json:"suggestion,omitempty"`
	// Motivation for the change.
	Motivation string `protobuf:"bytes,5,opt,name=motivation,proto3" json:"motivation,omitempty"`
	// ParagraphID is present when the feedback is performed on a document and the
	// text block had a ID.
	ParagraphId string `protobuf:"bytes,6,opt,name=paragraph_id,json=paragraphId,proto3" json:"paragraph_id,omitempty"`
	// contains filtered or unexported fields
}

func (*LanguageFeedback) Descriptor deprecated

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

Deprecated: Use LanguageFeedback.ProtoReflect.Descriptor instead.

func (*LanguageFeedback) GetMotivation

func (x *LanguageFeedback) GetMotivation() string

func (*LanguageFeedback) GetOriginal

func (x *LanguageFeedback) GetOriginal() string

func (*LanguageFeedback) GetParagraph

func (x *LanguageFeedback) GetParagraph() int64

func (*LanguageFeedback) GetParagraphId

func (x *LanguageFeedback) GetParagraphId() string

func (*LanguageFeedback) GetSuggestion

func (x *LanguageFeedback) GetSuggestion() string

func (*LanguageFeedback) ProtoMessage

func (*LanguageFeedback) ProtoMessage()

func (*LanguageFeedback) ProtoReflect

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

func (*LanguageFeedback) Reset

func (x *LanguageFeedback) Reset()

func (*LanguageFeedback) String

func (x *LanguageFeedback) String() string

type LanguageFeedbackRequest

type LanguageFeedbackRequest struct {

	// Model is the URI of the model to use.
	Model string `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"`
	// Paragraphs to review. Feedback will reference these paragraphs by
	// index. Optional, but either paragraphs, document_uuid, or document must be
	// set.
	Paragraphs []string `protobuf:"bytes,2,rep,name=paragraphs,proto3" json:"paragraphs,omitempty"`
	// DocumentUUID of the document to give feedback on. The "core/text" content
	// blocks will be extracted and the feedback will reference them by
	// index. Optional, but either paragraphs, document_uuid, or document must be
	// set.
	DocumentUuid string `protobuf:"bytes,3,opt,name=document_uuid,json=documentUuid,proto3" json:"document_uuid,omitempty"`
	// Document is the document to give feedback on. The "core/text" content
	// blocks will be extracted and the feedback will reference them by
	// index. Optional, but either paragraphs, document_uuid, or document must be
	// set.
	Document *newsdoc.Document `protobuf:"bytes,4,opt,name=document,proto3" json:"document,omitempty"`
	// AsyncTimeoutSeconds is the time after which a JobID will be returned
	// instead of a direct result. Optional, defaults to no timeout.
	AsyncTimeoutSeconds int64 `protobuf:"varint,5,opt,name=async_timeout_seconds,json=asyncTimeoutSeconds,proto3" json:"async_timeout_seconds,omitempty"`
	// contains filtered or unexported fields
}

func (*LanguageFeedbackRequest) Descriptor deprecated

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

Deprecated: Use LanguageFeedbackRequest.ProtoReflect.Descriptor instead.

func (*LanguageFeedbackRequest) GetAsyncTimeoutSeconds

func (x *LanguageFeedbackRequest) GetAsyncTimeoutSeconds() int64

func (*LanguageFeedbackRequest) GetDocument

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

func (*LanguageFeedbackRequest) GetDocumentUuid

func (x *LanguageFeedbackRequest) GetDocumentUuid() string

func (*LanguageFeedbackRequest) GetModel

func (x *LanguageFeedbackRequest) GetModel() string

func (*LanguageFeedbackRequest) GetParagraphs

func (x *LanguageFeedbackRequest) GetParagraphs() []string

func (*LanguageFeedbackRequest) ProtoMessage

func (*LanguageFeedbackRequest) ProtoMessage()

func (*LanguageFeedbackRequest) ProtoReflect

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

func (*LanguageFeedbackRequest) Reset

func (x *LanguageFeedbackRequest) Reset()

func (*LanguageFeedbackRequest) String

func (x *LanguageFeedbackRequest) String() string

type LanguageFeedbackResponse

type LanguageFeedbackResponse struct {

	// JobID that identifies the created job.
	JobId int64 `protobuf:"varint,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"`
	// Feedback items.
	Feedback []*LanguageFeedback `protobuf:"bytes,2,rep,name=feedback,proto3" json:"feedback,omitempty"`
	// Paragraphs are the paragraphs being referenced in the feedback.
	Paragraphs []string `protobuf:"bytes,3,rep,name=paragraphs,proto3" json:"paragraphs,omitempty"`
	// contains filtered or unexported fields
}

func (*LanguageFeedbackResponse) Descriptor deprecated

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

Deprecated: Use LanguageFeedbackResponse.ProtoReflect.Descriptor instead.

func (*LanguageFeedbackResponse) GetFeedback

func (x *LanguageFeedbackResponse) GetFeedback() []*LanguageFeedback

func (*LanguageFeedbackResponse) GetJobId

func (x *LanguageFeedbackResponse) GetJobId() int64

func (*LanguageFeedbackResponse) GetParagraphs

func (x *LanguageFeedbackResponse) GetParagraphs() []string

func (*LanguageFeedbackResponse) ProtoMessage

func (*LanguageFeedbackResponse) ProtoMessage()

func (*LanguageFeedbackResponse) ProtoReflect

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

func (*LanguageFeedbackResponse) Reset

func (x *LanguageFeedbackResponse) Reset()

func (*LanguageFeedbackResponse) String

func (x *LanguageFeedbackResponse) String() string

type ListJobsRequest

type ListJobsRequest struct {

	// After lists jobs after the given ID. Optional, omit to get latest.
	After int64 `protobuf:"varint,1,opt,name=after,proto3" json:"after,omitempty"`
	// contains filtered or unexported fields
}

func (*ListJobsRequest) Descriptor deprecated

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

Deprecated: Use ListJobsRequest.ProtoReflect.Descriptor instead.

func (*ListJobsRequest) GetAfter

func (x *ListJobsRequest) GetAfter() int64

func (*ListJobsRequest) ProtoMessage

func (*ListJobsRequest) ProtoMessage()

func (*ListJobsRequest) ProtoReflect

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

func (*ListJobsRequest) Reset

func (x *ListJobsRequest) Reset()

func (*ListJobsRequest) String

func (x *ListJobsRequest) String() string

type ListJobsResponse

type ListJobsResponse struct {
	Jobs []*JobReference `protobuf:"bytes,1,rep,name=jobs,proto3" json:"jobs,omitempty"`
	// contains filtered or unexported fields
}

func (*ListJobsResponse) Descriptor deprecated

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

Deprecated: Use ListJobsResponse.ProtoReflect.Descriptor instead.

func (*ListJobsResponse) GetJobs

func (x *ListJobsResponse) GetJobs() []*JobReference

func (*ListJobsResponse) ProtoMessage

func (*ListJobsResponse) ProtoMessage()

func (*ListJobsResponse) ProtoReflect

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

func (*ListJobsResponse) Reset

func (x *ListJobsResponse) Reset()

func (*ListJobsResponse) String

func (x *ListJobsResponse) String() string

type TextRequest

type TextRequest struct {

	// Model is the URI of the model to use.
	Model string `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"`
	// Text to send as input.
	Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
	// ParseText tries to parse the generated text into blocks if set to true.
	ParseText bool `protobuf:"varint,3,opt,name=parse_text,json=parseText,proto3" json:"parse_text,omitempty"`
	// CharacterCount sets a target for how long the generated text should be.
	CharacterCount int32 `protobuf:"varint,4,opt,name=character_count,json=characterCount,proto3" json:"character_count,omitempty"`
	// AsyncTimeoutSeconds is the time after which a JobID will be returned
	// instead of a direct result. Optional, defaults to no timeout.
	AsyncTimeoutSeconds int64 `protobuf:"varint,5,opt,name=async_timeout_seconds,json=asyncTimeoutSeconds,proto3" json:"async_timeout_seconds,omitempty"`
	// contains filtered or unexported fields
}

func (*TextRequest) Descriptor deprecated

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

Deprecated: Use TextRequest.ProtoReflect.Descriptor instead.

func (*TextRequest) GetAsyncTimeoutSeconds

func (x *TextRequest) GetAsyncTimeoutSeconds() int64

func (*TextRequest) GetCharacterCount

func (x *TextRequest) GetCharacterCount() int32

func (*TextRequest) GetModel

func (x *TextRequest) GetModel() string

func (*TextRequest) GetParseText

func (x *TextRequest) GetParseText() bool

func (*TextRequest) GetText

func (x *TextRequest) GetText() string

func (*TextRequest) ProtoMessage

func (*TextRequest) ProtoMessage()

func (*TextRequest) ProtoReflect

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

func (*TextRequest) Reset

func (x *TextRequest) Reset()

func (*TextRequest) String

func (x *TextRequest) String() string

type TextResponse

type TextResponse struct {

	// JobID that identifies the created job.
	JobId int64 `protobuf:"varint,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"`
	// Text is the generated text.
	Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
	// Contet blocks generated from the text.
	Content []*newsdoc.Block `protobuf:"bytes,3,rep,name=content,proto3" json:"content,omitempty"`
	// contains filtered or unexported fields
}

func (*TextResponse) Descriptor deprecated

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

Deprecated: Use TextResponse.ProtoReflect.Descriptor instead.

func (*TextResponse) GetContent

func (x *TextResponse) GetContent() []*newsdoc.Block

func (*TextResponse) GetJobId

func (x *TextResponse) GetJobId() int64

func (*TextResponse) GetText

func (x *TextResponse) GetText() string

func (*TextResponse) ProtoMessage

func (*TextResponse) ProtoMessage()

func (*TextResponse) ProtoReflect

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

func (*TextResponse) Reset

func (x *TextResponse) Reset()

func (*TextResponse) String

func (x *TextResponse) String() string

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 NewGenerateServer

func NewGenerateServer(svc Generate, opts ...interface{}) TwirpServer

NewGenerateServer 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).

type WaitForJobsRequest

type WaitForJobsRequest struct {

	// Jobs and the currently known version that the client is waiting
	// for. Required.
	Jobs map[int64]int64 `` /* 137-byte string literal not displayed */
	// MaxWaitSec is the maximum time to wait for updates. Optional, defaults to
	// 10.
	MaxWaitSec int64 `protobuf:"varint,2,opt,name=max_wait_sec,json=maxWaitSec,proto3" json:"max_wait_sec,omitempty"`
	// contains filtered or unexported fields
}

func (*WaitForJobsRequest) Descriptor deprecated

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

Deprecated: Use WaitForJobsRequest.ProtoReflect.Descriptor instead.

func (*WaitForJobsRequest) GetJobs

func (x *WaitForJobsRequest) GetJobs() map[int64]int64

func (*WaitForJobsRequest) GetMaxWaitSec

func (x *WaitForJobsRequest) GetMaxWaitSec() int64

func (*WaitForJobsRequest) ProtoMessage

func (*WaitForJobsRequest) ProtoMessage()

func (*WaitForJobsRequest) ProtoReflect

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

func (*WaitForJobsRequest) Reset

func (x *WaitForJobsRequest) Reset()

func (*WaitForJobsRequest) String

func (x *WaitForJobsRequest) String() string

type WaitForJobsResponse

type WaitForJobsResponse struct {

	// Updated jobs, can be empty if the wait timed out without any updates.
	Updated []*JobReference `protobuf:"bytes,1,rep,name=updated,proto3" json:"updated,omitempty"`
	// contains filtered or unexported fields
}

func (*WaitForJobsResponse) Descriptor deprecated

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

Deprecated: Use WaitForJobsResponse.ProtoReflect.Descriptor instead.

func (*WaitForJobsResponse) GetUpdated

func (x *WaitForJobsResponse) GetUpdated() []*JobReference

func (*WaitForJobsResponse) ProtoMessage

func (*WaitForJobsResponse) ProtoMessage()

func (*WaitForJobsResponse) ProtoReflect

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

func (*WaitForJobsResponse) Reset

func (x *WaitForJobsResponse) Reset()

func (*WaitForJobsResponse) String

func (x *WaitForJobsResponse) String() string

Jump to

Keyboard shortcuts

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