Documentation
¶
Overview ¶
Package httpapi exposes the service over loopback HTTP.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DictionariesResponse ¶
type DictionariesResponse struct {
Directory string `json:"directory"`
Dictionaries []mdict.Info `json:"dictionaries"`
Generated time.Time `json:"generated"`
Elapsed time.Duration `json:"-"`
}
DictionariesResponse lists the installed dictionaries.
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
Message string `json:"message"`
// Hint tells the user what to actually do about it.
Hint string `json:"hint,omitempty"`
}
ErrorResponse is the uniform error shape the plugin understands.
type LookupRequest ¶
type LookupRequest struct {
Query string `json:"query"`
// Dictionaries restricts the search; empty means every dictionary.
Dictionaries []string `json:"dictionaries,omitempty"`
// Mode is "exact" or "smart".
Mode string `json:"mode,omitempty"`
// Limit caps how many dictionaries answer.
Limit int `json:"limit,omitempty"`
// MaxExamples caps examples per sense.
MaxExamples int `json:"maxExamples,omitempty"`
Debug bool `json:"debug,omitempty"`
// Format is "ir" (default) or "bob". "bob" adds a rendered toDict so the
// plugin can pass it straight to Bob without interpreting the IR.
Format string `json:"format,omitempty"`
// IncludeExamples and IncludeExtras let the user trim what Bob displays.
IncludeExamples *bool `json:"includeExamples,omitempty"`
IncludeExtras *bool `json:"includeExtras,omitempty"`
// MultiRecordMode controls Bob presentation only: "separate" selects one
// semantic record with sibling navigation; "combined" renders all records.
MultiRecordMode string `json:"multiRecordMode,omitempty"`
// RecordOrdinal is one-based over the visible, deduplicated EntrySet.
RecordOrdinal int `json:"recordOrdinal,omitempty"`
}
LookupRequest is the body of POST /v2/lookup.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server routes HTTP requests to the service.
type StatusResponse ¶
type StatusResponse struct {
Service string `json:"service"`
ServiceVersion string `json:"serviceVersion"`
BuildCommit string `json:"buildCommit"`
APIVersion string `json:"apiVersion"`
Platform string `json:"platform"`
Architecture string `json:"architecture"`
DictionaryDirectory string `json:"dictionaryDirectory"`
DictionaryCount int `json:"dictionaryCount"`
HealthyDictionaryCount int `json:"healthyDictionaryCount"`
AudioAvailable bool `json:"audioAvailable"`
SpeexAvailable bool `json:"speexAvailable"`
SpeexDecoder string `json:"speexDecoder,omitempty"`
UptimeSeconds float64 `json:"uptimeSeconds"`
}
StatusResponse describes the running service.