Documentation
¶
Index ¶
- Constants
- Variables
- func WriteError(resp http.ResponseWriter, err error)
- type Check
- type CorrectionLevel
- func (CorrectionLevel) Descriptor() protoreflect.EnumDescriptor
- func (x CorrectionLevel) Enum() *CorrectionLevel
- func (CorrectionLevel) EnumDescriptor() ([]byte, []int)deprecated
- func (x CorrectionLevel) Number() protoreflect.EnumNumber
- func (x CorrectionLevel) String() string
- func (CorrectionLevel) Type() protoreflect.EnumType
- type CustomDictionary
- func (*CustomDictionary) Descriptor() ([]byte, []int)deprecated
- func (x *CustomDictionary) GetEntryCount() int64
- func (x *CustomDictionary) GetLanguage() string
- func (x *CustomDictionary) GetPendingCount() int64
- func (x *CustomDictionary) GetRuleCount() int64
- func (x *CustomDictionary) GetRulePendingCount() int64
- func (*CustomDictionary) ProtoMessage()
- func (x *CustomDictionary) ProtoReflect() protoreflect.Message
- func (x *CustomDictionary) Reset()
- func (x *CustomDictionary) String() string
- type CustomEntry
- func (*CustomEntry) Descriptor() ([]byte, []int)deprecated
- func (x *CustomEntry) GetAfter() []string
- func (x *CustomEntry) GetBefore() []string
- func (x *CustomEntry) GetCaseSensitive() bool
- func (x *CustomEntry) GetCommonMistakes() []string
- func (x *CustomEntry) GetDescription() string
- func (x *CustomEntry) GetForms() map[string]string
- func (x *CustomEntry) GetLanguage() string
- func (x *CustomEntry) GetLevel() CorrectionLevel
- func (x *CustomEntry) GetNotAfter() []string
- func (x *CustomEntry) GetNotBefore() []string
- func (x *CustomEntry) GetStatus() string
- func (x *CustomEntry) GetText() string
- func (x *CustomEntry) GetUpdated() string
- func (x *CustomEntry) GetUpdatedBy() string
- func (*CustomEntry) ProtoMessage()
- func (x *CustomEntry) ProtoReflect() protoreflect.Message
- func (x *CustomEntry) Reset()
- func (x *CustomEntry) String() string
- type DeleteEntryRequest
- func (*DeleteEntryRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DeleteEntryRequest) GetLanguage() string
- func (x *DeleteEntryRequest) GetText() string
- func (*DeleteEntryRequest) ProtoMessage()
- func (x *DeleteEntryRequest) ProtoReflect() protoreflect.Message
- func (x *DeleteEntryRequest) Reset()
- func (x *DeleteEntryRequest) String() string
- type DeleteEntryResponse
- type DeleteRuleRequest
- type DeleteRuleResponse
- type Dictionaries
- type GetEntryRequest
- func (*GetEntryRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetEntryRequest) GetLanguage() string
- func (x *GetEntryRequest) GetText() string
- func (*GetEntryRequest) ProtoMessage()
- func (x *GetEntryRequest) ProtoReflect() protoreflect.Message
- func (x *GetEntryRequest) Reset()
- func (x *GetEntryRequest) String() string
- type GetEntryResponse
- type GetRuleRequest
- type GetRuleResponse
- type HTTPClient
- type Language
- type ListDictionariesRequest
- type ListDictionariesResponse
- func (*ListDictionariesResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ListDictionariesResponse) GetDictionaries() []*CustomDictionary
- func (*ListDictionariesResponse) ProtoMessage()
- func (x *ListDictionariesResponse) ProtoReflect() protoreflect.Message
- func (x *ListDictionariesResponse) Reset()
- func (x *ListDictionariesResponse) String() string
- type ListEntriesRequest
- func (*ListEntriesRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ListEntriesRequest) GetLanguage() string
- func (x *ListEntriesRequest) GetPage() int64
- func (x *ListEntriesRequest) GetPageSize() int64
- func (x *ListEntriesRequest) GetQuery() string
- func (x *ListEntriesRequest) GetStatus() string
- func (*ListEntriesRequest) ProtoMessage()
- func (x *ListEntriesRequest) ProtoReflect() protoreflect.Message
- func (x *ListEntriesRequest) Reset()
- func (x *ListEntriesRequest) String() string
- type ListEntriesResponse
- func (*ListEntriesResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ListEntriesResponse) GetEntries() []*CustomEntry
- func (*ListEntriesResponse) ProtoMessage()
- func (x *ListEntriesResponse) ProtoReflect() protoreflect.Message
- func (x *ListEntriesResponse) Reset()
- func (x *ListEntriesResponse) String() string
- type ListRulesRequest
- func (*ListRulesRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ListRulesRequest) GetLanguage() string
- func (x *ListRulesRequest) GetPage() int64
- func (x *ListRulesRequest) GetPageSize() int64
- func (x *ListRulesRequest) GetQuery() string
- func (x *ListRulesRequest) GetStatus() string
- func (*ListRulesRequest) ProtoMessage()
- func (x *ListRulesRequest) ProtoReflect() protoreflect.Message
- func (x *ListRulesRequest) Reset()
- func (x *ListRulesRequest) String() string
- type ListRulesResponse
- type Misspelled
- type MisspelledEntry
- func (*MisspelledEntry) Descriptor() ([]byte, []int)deprecated
- func (x *MisspelledEntry) GetLevel() CorrectionLevel
- func (x *MisspelledEntry) GetSpans() []*TextSpan
- func (x *MisspelledEntry) GetStatus() string
- func (x *MisspelledEntry) GetSuggestions() []*Suggestion
- func (x *MisspelledEntry) GetText() string
- func (*MisspelledEntry) ProtoMessage()
- func (x *MisspelledEntry) ProtoReflect() protoreflect.Message
- func (x *MisspelledEntry) Reset()
- func (x *MisspelledEntry) String() string
- type RenameEntryRequest
- func (*RenameEntryRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RenameEntryRequest) GetLanguage() string
- func (x *RenameEntryRequest) GetNewText() string
- func (x *RenameEntryRequest) GetText() string
- func (*RenameEntryRequest) ProtoMessage()
- func (x *RenameEntryRequest) ProtoReflect() protoreflect.Message
- func (x *RenameEntryRequest) Reset()
- func (x *RenameEntryRequest) String() string
- type RenameEntryResponse
- type Rule
- func (*Rule) Descriptor() ([]byte, []int)deprecated
- func (x *Rule) GetAfter() []string
- func (x *Rule) GetBefore() []string
- func (x *Rule) GetCaseSensitive() bool
- func (x *Rule) GetDescription() string
- func (x *Rule) GetId() int64
- func (x *Rule) GetLanguage() string
- func (x *Rule) GetLevel() CorrectionLevel
- func (x *Rule) GetName() string
- func (x *Rule) GetNotAfter() []string
- func (x *Rule) GetNotBefore() []string
- func (x *Rule) GetPattern() string
- func (x *Rule) GetReplacement() string
- func (x *Rule) GetStatus() string
- func (x *Rule) GetUpdated() string
- func (x *Rule) GetUpdatedBy() string
- func (*Rule) ProtoMessage()
- func (x *Rule) ProtoReflect() protoreflect.Message
- func (x *Rule) Reset()
- func (x *Rule) String() string
- type Rules
- type SetEntryRequest
- type SetEntryResponse
- type SetEntryStatusRequest
- func (*SetEntryStatusRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SetEntryStatusRequest) GetLanguage() string
- func (x *SetEntryStatusRequest) GetStatus() string
- func (x *SetEntryStatusRequest) GetText() string
- func (*SetEntryStatusRequest) ProtoMessage()
- func (x *SetEntryStatusRequest) ProtoReflect() protoreflect.Message
- func (x *SetEntryStatusRequest) Reset()
- func (x *SetEntryStatusRequest) String() string
- type SetEntryStatusResponse
- type SetRuleRequest
- type SetRuleResponse
- type SetRuleStatusRequest
- func (*SetRuleStatusRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SetRuleStatusRequest) GetId() int64
- func (x *SetRuleStatusRequest) GetStatus() string
- func (*SetRuleStatusRequest) ProtoMessage()
- func (x *SetRuleStatusRequest) ProtoReflect() protoreflect.Message
- func (x *SetRuleStatusRequest) Reset()
- func (x *SetRuleStatusRequest) String() string
- type SetRuleStatusResponse
- type Suggestion
- type SuggestionsRequest
- func (*SuggestionsRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SuggestionsRequest) GetCustomOnly() bool
- func (x *SuggestionsRequest) GetLanguage() string
- func (x *SuggestionsRequest) GetText() string
- func (*SuggestionsRequest) ProtoMessage()
- func (x *SuggestionsRequest) ProtoReflect() protoreflect.Message
- func (x *SuggestionsRequest) Reset()
- func (x *SuggestionsRequest) String() string
- type SuggestionsResponse
- func (*SuggestionsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *SuggestionsResponse) GetSuggestions() []*Suggestion
- func (*SuggestionsResponse) ProtoMessage()
- func (x *SuggestionsResponse) ProtoReflect() protoreflect.Message
- func (x *SuggestionsResponse) Reset()
- func (x *SuggestionsResponse) String() string
- type SupportedLanguagesRequest
- type SupportedLanguagesResponse
- func (*SupportedLanguagesResponse) Descriptor() ([]byte, []int)deprecated
- func (x *SupportedLanguagesResponse) GetLanguages() []*Language
- func (*SupportedLanguagesResponse) ProtoMessage()
- func (x *SupportedLanguagesResponse) ProtoReflect() protoreflect.Message
- func (x *SupportedLanguagesResponse) Reset()
- func (x *SupportedLanguagesResponse) String() string
- type TextRequest
- func (*TextRequest) Descriptor() ([]byte, []int)deprecated
- func (x *TextRequest) GetCustomOnly() bool
- func (x *TextRequest) GetLanguage() string
- func (x *TextRequest) GetSuggestions() bool
- func (x *TextRequest) GetText() []string
- func (*TextRequest) ProtoMessage()
- func (x *TextRequest) ProtoReflect() protoreflect.Message
- func (x *TextRequest) Reset()
- func (x *TextRequest) String() string
- type TextResponse
- type TextSpan
- type TwirpServer
Constants ¶
const CheckPathPrefix = "/twirp/elephant.spell.Check/"
CheckPathPrefix 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
const DictionariesPathPrefix = "/twirp/elephant.spell.Dictionaries/"
DictionariesPathPrefix 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
const RulesPathPrefix = "/twirp/elephant.spell.Rules/"
RulesPathPrefix 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 ¶
var ( CorrectionLevel_name = map[int32]string{ 0: "LEVEL_UNSPECIFIED", 1: "LEVEL_ERROR", 2: "LEVEL_SUGGESTION", } CorrectionLevel_value = map[string]int32{ "LEVEL_UNSPECIFIED": 0, "LEVEL_ERROR": 1, "LEVEL_SUGGESTION": 2, } )
Enum value maps for CorrectionLevel.
var File_spell_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 Check ¶
type Check interface {
// Text spellchecks a text and returns the misspelled words or phrases.
Text(context.Context, *TextRequest) (*TextResponse, error)
// Suggestions returns suggestions for a word or phrase.
Suggestions(context.Context, *SuggestionsRequest) (*SuggestionsResponse, error)
}
Check content for spelling errors.
func NewCheckJSONClient ¶
func NewCheckJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Check
NewCheckJSONClient creates a JSON client that implements the Check interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewCheckProtobufClient ¶
func NewCheckProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Check
NewCheckProtobufClient creates a Protobuf client that implements the Check interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type CorrectionLevel ¶ added in v0.19.4
type CorrectionLevel int32
const ( CorrectionLevel_LEVEL_UNSPECIFIED CorrectionLevel = 0 CorrectionLevel_LEVEL_ERROR CorrectionLevel = 1 CorrectionLevel_LEVEL_SUGGESTION CorrectionLevel = 2 )
func (CorrectionLevel) Descriptor ¶ added in v0.19.4
func (CorrectionLevel) Descriptor() protoreflect.EnumDescriptor
func (CorrectionLevel) Enum ¶ added in v0.19.4
func (x CorrectionLevel) Enum() *CorrectionLevel
func (CorrectionLevel) EnumDescriptor
deprecated
added in
v0.19.4
func (CorrectionLevel) EnumDescriptor() ([]byte, []int)
Deprecated: Use CorrectionLevel.Descriptor instead.
func (CorrectionLevel) Number ¶ added in v0.19.4
func (x CorrectionLevel) Number() protoreflect.EnumNumber
func (CorrectionLevel) String ¶ added in v0.19.4
func (x CorrectionLevel) String() string
func (CorrectionLevel) Type ¶ added in v0.19.4
func (CorrectionLevel) Type() protoreflect.EnumType
type CustomDictionary ¶
type CustomDictionary struct {
// Language the dictionary is for.
Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"`
// EntryCount for the dictionary.
EntryCount int64 `protobuf:"varint,2,opt,name=entry_count,json=entryCount,proto3" json:"entry_count,omitempty"`
// PendingCount is the number of entries awaiting moderation.
PendingCount int64 `protobuf:"varint,3,opt,name=pending_count,json=pendingCount,proto3" json:"pending_count,omitempty"`
// RuleCount is the number of pattern rules for the language.
RuleCount int64 `protobuf:"varint,4,opt,name=rule_count,json=ruleCount,proto3" json:"rule_count,omitempty"`
// RulePendingCount is the number of rules awaiting moderation.
RulePendingCount int64 `protobuf:"varint,5,opt,name=rule_pending_count,json=rulePendingCount,proto3" json:"rule_pending_count,omitempty"`
// contains filtered or unexported fields
}
func (*CustomDictionary) Descriptor
deprecated
func (*CustomDictionary) Descriptor() ([]byte, []int)
Deprecated: Use CustomDictionary.ProtoReflect.Descriptor instead.
func (*CustomDictionary) GetEntryCount ¶
func (x *CustomDictionary) GetEntryCount() int64
func (*CustomDictionary) GetLanguage ¶
func (x *CustomDictionary) GetLanguage() string
func (*CustomDictionary) GetPendingCount ¶ added in v0.23.1
func (x *CustomDictionary) GetPendingCount() int64
func (*CustomDictionary) GetRuleCount ¶ added in v0.23.1
func (x *CustomDictionary) GetRuleCount() int64
func (*CustomDictionary) GetRulePendingCount ¶ added in v0.23.1
func (x *CustomDictionary) GetRulePendingCount() int64
func (*CustomDictionary) ProtoMessage ¶
func (*CustomDictionary) ProtoMessage()
func (*CustomDictionary) ProtoReflect ¶
func (x *CustomDictionary) ProtoReflect() protoreflect.Message
func (*CustomDictionary) Reset ¶
func (x *CustomDictionary) Reset()
func (*CustomDictionary) String ¶
func (x *CustomDictionary) String() string
type CustomEntry ¶
type CustomEntry struct {
// Language the entry is for.
Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"`
// Text is the word (or phrase) itself.
Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
// Status of the entry, this is used for moderation.
Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
// Description of the entry.
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
// CommonMistakes are misspellings or alternative spellings that should be
// flagged and corrected to the entry text. Supports {A|B} expansion.
CommonMistakes []string `protobuf:"bytes,5,rep,name=common_mistakes,json=commonMistakes,proto3" json:"common_mistakes,omitempty"`
// Level to use when offering corrections based on this entry. Optional,
// defaults to LEVEL_ERROR.
Level CorrectionLevel `protobuf:"varint,6,opt,name=level,proto3,enum=elephant.spell.CorrectionLevel" json:"level,omitempty"`
// Forms is an alternative to the common mistakes -> text pairing and allows
// the mapping of different forms of the word or phrase to specific
// replacements.
Forms map[string]string `` /* 137-byte string literal not displayed */
// Updated is the last update time in RFC3339 format.
Updated string `protobuf:"bytes,8,opt,name=updated,proto3" json:"updated,omitempty"`
// UpdatedBy is the identity of the party that last updated the entry.
UpdatedBy string `protobuf:"bytes,9,opt,name=updated_by,json=updatedBy,proto3" json:"updated_by,omitempty"`
// CaseSensitive controls whether the entry matches only with the exact casing
// of its text and common mistakes. Defaults to false (case-insensitive
// matching), which suits ordinary words. Enable it for proper nouns; a
// case-sensitive entry additionally flags leading-letter miscasings of its
// text and common mistakes (e.g. "mexico city") and suggests the exact
// casing.
CaseSensitive bool `protobuf:"varint,10,opt,name=case_sensitive,json=caseSensitive,proto3" json:"case_sensitive,omitempty"`
// Before, when set, only flags a match when immediately preceded by one of
// these words.
Before []string `protobuf:"bytes,11,rep,name=before,proto3" json:"before,omitempty"`
// After, when set, only flags a match when immediately followed by one of
// these words.
After []string `protobuf:"bytes,12,rep,name=after,proto3" json:"after,omitempty"`
// NotBefore suppresses the match when preceded by one of these words.
NotBefore []string `protobuf:"bytes,13,rep,name=not_before,json=notBefore,proto3" json:"not_before,omitempty"`
// NotAfter suppresses the match when followed by one of these words.
NotAfter []string `protobuf:"bytes,14,rep,name=not_after,json=notAfter,proto3" json:"not_after,omitempty"`
// contains filtered or unexported fields
}
func (*CustomEntry) Descriptor
deprecated
func (*CustomEntry) Descriptor() ([]byte, []int)
Deprecated: Use CustomEntry.ProtoReflect.Descriptor instead.
func (*CustomEntry) GetAfter ¶ added in v0.23.1
func (x *CustomEntry) GetAfter() []string
func (*CustomEntry) GetBefore ¶ added in v0.23.1
func (x *CustomEntry) GetBefore() []string
func (*CustomEntry) GetCaseSensitive ¶ added in v0.23.1
func (x *CustomEntry) GetCaseSensitive() bool
func (*CustomEntry) GetCommonMistakes ¶
func (x *CustomEntry) GetCommonMistakes() []string
func (*CustomEntry) GetDescription ¶
func (x *CustomEntry) GetDescription() string
func (*CustomEntry) GetForms ¶ added in v0.19.4
func (x *CustomEntry) GetForms() map[string]string
func (*CustomEntry) GetLanguage ¶
func (x *CustomEntry) GetLanguage() string
func (*CustomEntry) GetLevel ¶ added in v0.19.4
func (x *CustomEntry) GetLevel() CorrectionLevel
func (*CustomEntry) GetNotAfter ¶ added in v0.23.1
func (x *CustomEntry) GetNotAfter() []string
func (*CustomEntry) GetNotBefore ¶ added in v0.23.1
func (x *CustomEntry) GetNotBefore() []string
func (*CustomEntry) GetStatus ¶
func (x *CustomEntry) GetStatus() string
func (*CustomEntry) GetText ¶
func (x *CustomEntry) GetText() string
func (*CustomEntry) GetUpdated ¶ added in v0.22.0
func (x *CustomEntry) GetUpdated() string
func (*CustomEntry) GetUpdatedBy ¶ added in v0.22.0
func (x *CustomEntry) GetUpdatedBy() string
func (*CustomEntry) ProtoMessage ¶
func (*CustomEntry) ProtoMessage()
func (*CustomEntry) ProtoReflect ¶
func (x *CustomEntry) ProtoReflect() protoreflect.Message
func (*CustomEntry) Reset ¶
func (x *CustomEntry) Reset()
func (*CustomEntry) String ¶
func (x *CustomEntry) String() string
type DeleteEntryRequest ¶
type DeleteEntryRequest struct {
// Language the entry is for.
Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"`
// Text is the word or phrase to delete.
Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
// contains filtered or unexported fields
}
func (*DeleteEntryRequest) Descriptor
deprecated
func (*DeleteEntryRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteEntryRequest.ProtoReflect.Descriptor instead.
func (*DeleteEntryRequest) GetLanguage ¶
func (x *DeleteEntryRequest) GetLanguage() string
func (*DeleteEntryRequest) GetText ¶
func (x *DeleteEntryRequest) GetText() string
func (*DeleteEntryRequest) ProtoMessage ¶
func (*DeleteEntryRequest) ProtoMessage()
func (*DeleteEntryRequest) ProtoReflect ¶
func (x *DeleteEntryRequest) ProtoReflect() protoreflect.Message
func (*DeleteEntryRequest) Reset ¶
func (x *DeleteEntryRequest) Reset()
func (*DeleteEntryRequest) String ¶
func (x *DeleteEntryRequest) String() string
type DeleteEntryResponse ¶
type DeleteEntryResponse struct {
// contains filtered or unexported fields
}
func (*DeleteEntryResponse) Descriptor
deprecated
func (*DeleteEntryResponse) Descriptor() ([]byte, []int)
Deprecated: Use DeleteEntryResponse.ProtoReflect.Descriptor instead.
func (*DeleteEntryResponse) ProtoMessage ¶
func (*DeleteEntryResponse) ProtoMessage()
func (*DeleteEntryResponse) ProtoReflect ¶
func (x *DeleteEntryResponse) ProtoReflect() protoreflect.Message
func (*DeleteEntryResponse) Reset ¶
func (x *DeleteEntryResponse) Reset()
func (*DeleteEntryResponse) String ¶
func (x *DeleteEntryResponse) String() string
type DeleteRuleRequest ¶ added in v0.23.1
type DeleteRuleRequest struct {
// ID of the rule to delete.
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// contains filtered or unexported fields
}
func (*DeleteRuleRequest) Descriptor
deprecated
added in
v0.23.1
func (*DeleteRuleRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteRuleRequest.ProtoReflect.Descriptor instead.
func (*DeleteRuleRequest) GetId ¶ added in v0.23.1
func (x *DeleteRuleRequest) GetId() int64
func (*DeleteRuleRequest) ProtoMessage ¶ added in v0.23.1
func (*DeleteRuleRequest) ProtoMessage()
func (*DeleteRuleRequest) ProtoReflect ¶ added in v0.23.1
func (x *DeleteRuleRequest) ProtoReflect() protoreflect.Message
func (*DeleteRuleRequest) Reset ¶ added in v0.23.1
func (x *DeleteRuleRequest) Reset()
func (*DeleteRuleRequest) String ¶ added in v0.23.1
func (x *DeleteRuleRequest) String() string
type DeleteRuleResponse ¶ added in v0.23.1
type DeleteRuleResponse struct {
// contains filtered or unexported fields
}
func (*DeleteRuleResponse) Descriptor
deprecated
added in
v0.23.1
func (*DeleteRuleResponse) Descriptor() ([]byte, []int)
Deprecated: Use DeleteRuleResponse.ProtoReflect.Descriptor instead.
func (*DeleteRuleResponse) ProtoMessage ¶ added in v0.23.1
func (*DeleteRuleResponse) ProtoMessage()
func (*DeleteRuleResponse) ProtoReflect ¶ added in v0.23.1
func (x *DeleteRuleResponse) ProtoReflect() protoreflect.Message
func (*DeleteRuleResponse) Reset ¶ added in v0.23.1
func (x *DeleteRuleResponse) Reset()
func (*DeleteRuleResponse) String ¶ added in v0.23.1
func (x *DeleteRuleResponse) String() string
type Dictionaries ¶
type Dictionaries interface {
// SupportedLanguages returns a list of supported languages.
SupportedLanguages(context.Context, *SupportedLanguagesRequest) (*SupportedLanguagesResponse, error)
// ListDictionaries lists the currently available custom dictionaries.
ListDictionaries(context.Context, *ListDictionariesRequest) (*ListDictionariesResponse, error)
// ListEntries lists entries in the custom dictionaries.
ListEntries(context.Context, *ListEntriesRequest) (*ListEntriesResponse, error)
// GetEntry returns the details of a custom word or phrase.
GetEntry(context.Context, *GetEntryRequest) (*GetEntryResponse, error)
// SetEntry is used to add or update custom dictionary entries.
SetEntry(context.Context, *SetEntryRequest) (*SetEntryResponse, error)
// SetEntryStatus updates only the moderation status of an entry. It is a
// lightweight alternative to SetEntry for accept/reject workflows that don't
// need to round-trip the whole entry.
SetEntryStatus(context.Context, *SetEntryStatusRequest) (*SetEntryStatusResponse, error)
// DeleteEntry is used to remove an entry.
DeleteEntry(context.Context, *DeleteEntryRequest) (*DeleteEntryResponse, error)
// RenameEntry changes the text of a custom dictionary entry, keeping the rest
// of its data. The text is the entry's identity, so renaming is a dedicated
// operation rather than a SetEntry.
RenameEntry(context.Context, *RenameEntryRequest) (*RenameEntryResponse, error)
}
Dictionaries is used to manage custom dictionary entries. Custom dictionaries can be used to add both words and phrases.
func NewDictionariesJSONClient ¶
func NewDictionariesJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Dictionaries
NewDictionariesJSONClient creates a JSON client that implements the Dictionaries interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewDictionariesProtobufClient ¶
func NewDictionariesProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Dictionaries
NewDictionariesProtobufClient creates a Protobuf client that implements the Dictionaries interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type GetEntryRequest ¶
type GetEntryRequest struct {
// Language the entry is for.
Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"`
// Text is the word or phrase to get the entry for.
Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
// contains filtered or unexported fields
}
func (*GetEntryRequest) Descriptor
deprecated
func (*GetEntryRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetEntryRequest.ProtoReflect.Descriptor instead.
func (*GetEntryRequest) GetLanguage ¶
func (x *GetEntryRequest) GetLanguage() string
func (*GetEntryRequest) GetText ¶
func (x *GetEntryRequest) GetText() string
func (*GetEntryRequest) ProtoMessage ¶
func (*GetEntryRequest) ProtoMessage()
func (*GetEntryRequest) ProtoReflect ¶
func (x *GetEntryRequest) ProtoReflect() protoreflect.Message
func (*GetEntryRequest) Reset ¶
func (x *GetEntryRequest) Reset()
func (*GetEntryRequest) String ¶
func (x *GetEntryRequest) String() string
type GetEntryResponse ¶
type GetEntryResponse struct {
// Entry information.
Entry *CustomEntry `protobuf:"bytes,1,opt,name=entry,proto3" json:"entry,omitempty"`
// contains filtered or unexported fields
}
func (*GetEntryResponse) Descriptor
deprecated
func (*GetEntryResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetEntryResponse.ProtoReflect.Descriptor instead.
func (*GetEntryResponse) GetEntry ¶
func (x *GetEntryResponse) GetEntry() *CustomEntry
func (*GetEntryResponse) ProtoMessage ¶
func (*GetEntryResponse) ProtoMessage()
func (*GetEntryResponse) ProtoReflect ¶
func (x *GetEntryResponse) ProtoReflect() protoreflect.Message
func (*GetEntryResponse) Reset ¶
func (x *GetEntryResponse) Reset()
func (*GetEntryResponse) String ¶
func (x *GetEntryResponse) String() string
type GetRuleRequest ¶ added in v0.23.1
type GetRuleRequest struct {
// ID of the rule to get.
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// contains filtered or unexported fields
}
func (*GetRuleRequest) Descriptor
deprecated
added in
v0.23.1
func (*GetRuleRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetRuleRequest.ProtoReflect.Descriptor instead.
func (*GetRuleRequest) GetId ¶ added in v0.23.1
func (x *GetRuleRequest) GetId() int64
func (*GetRuleRequest) ProtoMessage ¶ added in v0.23.1
func (*GetRuleRequest) ProtoMessage()
func (*GetRuleRequest) ProtoReflect ¶ added in v0.23.1
func (x *GetRuleRequest) ProtoReflect() protoreflect.Message
func (*GetRuleRequest) Reset ¶ added in v0.23.1
func (x *GetRuleRequest) Reset()
func (*GetRuleRequest) String ¶ added in v0.23.1
func (x *GetRuleRequest) String() string
type GetRuleResponse ¶ added in v0.23.1
type GetRuleResponse struct {
Rule *Rule `protobuf:"bytes,1,opt,name=rule,proto3" json:"rule,omitempty"`
// contains filtered or unexported fields
}
func (*GetRuleResponse) Descriptor
deprecated
added in
v0.23.1
func (*GetRuleResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetRuleResponse.ProtoReflect.Descriptor instead.
func (*GetRuleResponse) GetRule ¶ added in v0.23.1
func (x *GetRuleResponse) GetRule() *Rule
func (*GetRuleResponse) ProtoMessage ¶ added in v0.23.1
func (*GetRuleResponse) ProtoMessage()
func (*GetRuleResponse) ProtoReflect ¶ added in v0.23.1
func (x *GetRuleResponse) ProtoReflect() protoreflect.Message
func (*GetRuleResponse) Reset ¶ added in v0.23.1
func (x *GetRuleResponse) Reset()
func (*GetRuleResponse) String ¶ added in v0.23.1
func (x *GetRuleResponse) String() string
type HTTPClient ¶
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 Language ¶ added in v0.17.5
type Language struct {
// Code for the language.
Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
// contains filtered or unexported fields
}
func (*Language) Descriptor
deprecated
added in
v0.17.5
func (*Language) ProtoMessage ¶ added in v0.17.5
func (*Language) ProtoMessage()
func (*Language) ProtoReflect ¶ added in v0.17.5
func (x *Language) ProtoReflect() protoreflect.Message
type ListDictionariesRequest ¶
type ListDictionariesRequest struct {
// contains filtered or unexported fields
}
func (*ListDictionariesRequest) Descriptor
deprecated
func (*ListDictionariesRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListDictionariesRequest.ProtoReflect.Descriptor instead.
func (*ListDictionariesRequest) ProtoMessage ¶
func (*ListDictionariesRequest) ProtoMessage()
func (*ListDictionariesRequest) ProtoReflect ¶
func (x *ListDictionariesRequest) ProtoReflect() protoreflect.Message
func (*ListDictionariesRequest) Reset ¶
func (x *ListDictionariesRequest) Reset()
func (*ListDictionariesRequest) String ¶
func (x *ListDictionariesRequest) String() string
type ListDictionariesResponse ¶
type ListDictionariesResponse struct {
Dictionaries []*CustomDictionary `protobuf:"bytes,1,rep,name=dictionaries,proto3" json:"dictionaries,omitempty"`
// contains filtered or unexported fields
}
func (*ListDictionariesResponse) Descriptor
deprecated
func (*ListDictionariesResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListDictionariesResponse.ProtoReflect.Descriptor instead.
func (*ListDictionariesResponse) GetDictionaries ¶
func (x *ListDictionariesResponse) GetDictionaries() []*CustomDictionary
func (*ListDictionariesResponse) ProtoMessage ¶
func (*ListDictionariesResponse) ProtoMessage()
func (*ListDictionariesResponse) ProtoReflect ¶
func (x *ListDictionariesResponse) ProtoReflect() protoreflect.Message
func (*ListDictionariesResponse) Reset ¶
func (x *ListDictionariesResponse) Reset()
func (*ListDictionariesResponse) String ¶
func (x *ListDictionariesResponse) String() string
type ListEntriesRequest ¶
type ListEntriesRequest struct {
// Language to list entries for.
Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"`
// Page to return.
Page int64 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"`
// Query filters entries by a free-text substring, matched against the entry
// text, its description, and its common mistakes.
Query string `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"`
// Status to filter entries by
Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"`
// PageSize is the number of entries to return per page. Optional, defaults to
// 100 when zero.
PageSize int64 `protobuf:"varint,5,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
// contains filtered or unexported fields
}
func (*ListEntriesRequest) Descriptor
deprecated
func (*ListEntriesRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListEntriesRequest.ProtoReflect.Descriptor instead.
func (*ListEntriesRequest) GetLanguage ¶
func (x *ListEntriesRequest) GetLanguage() string
func (*ListEntriesRequest) GetPage ¶
func (x *ListEntriesRequest) GetPage() int64
func (*ListEntriesRequest) GetPageSize ¶ added in v0.23.1
func (x *ListEntriesRequest) GetPageSize() int64
func (*ListEntriesRequest) GetQuery ¶ added in v0.23.1
func (x *ListEntriesRequest) GetQuery() string
func (*ListEntriesRequest) GetStatus ¶
func (x *ListEntriesRequest) GetStatus() string
func (*ListEntriesRequest) ProtoMessage ¶
func (*ListEntriesRequest) ProtoMessage()
func (*ListEntriesRequest) ProtoReflect ¶
func (x *ListEntriesRequest) ProtoReflect() protoreflect.Message
func (*ListEntriesRequest) Reset ¶
func (x *ListEntriesRequest) Reset()
func (*ListEntriesRequest) String ¶
func (x *ListEntriesRequest) String() string
type ListEntriesResponse ¶
type ListEntriesResponse struct {
Entries []*CustomEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
// contains filtered or unexported fields
}
func (*ListEntriesResponse) Descriptor
deprecated
func (*ListEntriesResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListEntriesResponse.ProtoReflect.Descriptor instead.
func (*ListEntriesResponse) GetEntries ¶
func (x *ListEntriesResponse) GetEntries() []*CustomEntry
func (*ListEntriesResponse) ProtoMessage ¶
func (*ListEntriesResponse) ProtoMessage()
func (*ListEntriesResponse) ProtoReflect ¶
func (x *ListEntriesResponse) ProtoReflect() protoreflect.Message
func (*ListEntriesResponse) Reset ¶
func (x *ListEntriesResponse) Reset()
func (*ListEntriesResponse) String ¶
func (x *ListEntriesResponse) String() string
type ListRulesRequest ¶ added in v0.23.1
type ListRulesRequest struct {
// Language to list rules for.
Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"`
// Page to return.
Page int64 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"`
// Query filters rules by a free-text substring, matched against the name,
// description, pattern and replacement.
Query string `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"`
// Status to filter rules by.
Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"`
// PageSize is the number of rules per page. Optional, defaults to 100.
PageSize int64 `protobuf:"varint,5,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
// contains filtered or unexported fields
}
func (*ListRulesRequest) Descriptor
deprecated
added in
v0.23.1
func (*ListRulesRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListRulesRequest.ProtoReflect.Descriptor instead.
func (*ListRulesRequest) GetLanguage ¶ added in v0.23.1
func (x *ListRulesRequest) GetLanguage() string
func (*ListRulesRequest) GetPage ¶ added in v0.23.1
func (x *ListRulesRequest) GetPage() int64
func (*ListRulesRequest) GetPageSize ¶ added in v0.23.1
func (x *ListRulesRequest) GetPageSize() int64
func (*ListRulesRequest) GetQuery ¶ added in v0.23.1
func (x *ListRulesRequest) GetQuery() string
func (*ListRulesRequest) GetStatus ¶ added in v0.23.1
func (x *ListRulesRequest) GetStatus() string
func (*ListRulesRequest) ProtoMessage ¶ added in v0.23.1
func (*ListRulesRequest) ProtoMessage()
func (*ListRulesRequest) ProtoReflect ¶ added in v0.23.1
func (x *ListRulesRequest) ProtoReflect() protoreflect.Message
func (*ListRulesRequest) Reset ¶ added in v0.23.1
func (x *ListRulesRequest) Reset()
func (*ListRulesRequest) String ¶ added in v0.23.1
func (x *ListRulesRequest) String() string
type ListRulesResponse ¶ added in v0.23.1
type ListRulesResponse struct {
Rules []*Rule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"`
// contains filtered or unexported fields
}
func (*ListRulesResponse) Descriptor
deprecated
added in
v0.23.1
func (*ListRulesResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListRulesResponse.ProtoReflect.Descriptor instead.
func (*ListRulesResponse) GetRules ¶ added in v0.23.1
func (x *ListRulesResponse) GetRules() []*Rule
func (*ListRulesResponse) ProtoMessage ¶ added in v0.23.1
func (*ListRulesResponse) ProtoMessage()
func (*ListRulesResponse) ProtoReflect ¶ added in v0.23.1
func (x *ListRulesResponse) ProtoReflect() protoreflect.Message
func (*ListRulesResponse) Reset ¶ added in v0.23.1
func (x *ListRulesResponse) Reset()
func (*ListRulesResponse) String ¶ added in v0.23.1
func (x *ListRulesResponse) String() string
type Misspelled ¶ added in v0.17.2
type Misspelled struct {
Entries []*MisspelledEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
// contains filtered or unexported fields
}
func (*Misspelled) Descriptor
deprecated
added in
v0.17.2
func (*Misspelled) Descriptor() ([]byte, []int)
Deprecated: Use Misspelled.ProtoReflect.Descriptor instead.
func (*Misspelled) GetEntries ¶ added in v0.17.2
func (x *Misspelled) GetEntries() []*MisspelledEntry
func (*Misspelled) ProtoMessage ¶ added in v0.17.2
func (*Misspelled) ProtoMessage()
func (*Misspelled) ProtoReflect ¶ added in v0.17.2
func (x *Misspelled) ProtoReflect() protoreflect.Message
func (*Misspelled) Reset ¶ added in v0.17.2
func (x *Misspelled) Reset()
func (*Misspelled) String ¶ added in v0.17.2
func (x *Misspelled) String() string
type MisspelledEntry ¶
type MisspelledEntry struct {
// Text that was used in the source text.
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
// Suggestions for replacements.
Suggestions []*Suggestion `protobuf:"bytes,2,rep,name=suggestions,proto3" json:"suggestions,omitempty"`
// Level is the level of the correction.
Level CorrectionLevel `protobuf:"varint,3,opt,name=level,proto3,enum=elephant.spell.CorrectionLevel" json:"level,omitempty"`
// Status of the custom entry the correction is based on, e.g. "accepted" or
// "pending". Empty for corrections that don't originate from a custom entry
// (such as plain hunspell results). Clients can use this to indicate that a
// correction comes from an unreviewed (pending) entry.
Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"`
// Spans are the character ranges in the source text where this specific
// correction applies. The same text can occur several times with different
// outcomes (e.g. only one occurrence is corrected), so clients should act on
// these ranges rather than searching for the text. Empty for corrections that
// apply wherever the text appears, such as plain hunspell results.
Spans []*TextSpan `protobuf:"bytes,5,rep,name=spans,proto3" json:"spans,omitempty"`
// contains filtered or unexported fields
}
func (*MisspelledEntry) Descriptor
deprecated
func (*MisspelledEntry) Descriptor() ([]byte, []int)
Deprecated: Use MisspelledEntry.ProtoReflect.Descriptor instead.
func (*MisspelledEntry) GetLevel ¶ added in v0.19.4
func (x *MisspelledEntry) GetLevel() CorrectionLevel
func (*MisspelledEntry) GetSpans ¶ added in v0.23.1
func (x *MisspelledEntry) GetSpans() []*TextSpan
func (*MisspelledEntry) GetStatus ¶ added in v0.23.1
func (x *MisspelledEntry) GetStatus() string
func (*MisspelledEntry) GetSuggestions ¶
func (x *MisspelledEntry) GetSuggestions() []*Suggestion
func (*MisspelledEntry) GetText ¶
func (x *MisspelledEntry) GetText() string
func (*MisspelledEntry) ProtoMessage ¶
func (*MisspelledEntry) ProtoMessage()
func (*MisspelledEntry) ProtoReflect ¶
func (x *MisspelledEntry) ProtoReflect() protoreflect.Message
func (*MisspelledEntry) Reset ¶
func (x *MisspelledEntry) Reset()
func (*MisspelledEntry) String ¶
func (x *MisspelledEntry) String() string
type RenameEntryRequest ¶ added in v0.23.1
type RenameEntryRequest struct {
// Language the entry is for.
Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"`
// Text is the current entry text.
Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
// NewText is the text to rename the entry to.
NewText string `protobuf:"bytes,3,opt,name=new_text,json=newText,proto3" json:"new_text,omitempty"`
// contains filtered or unexported fields
}
func (*RenameEntryRequest) Descriptor
deprecated
added in
v0.23.1
func (*RenameEntryRequest) Descriptor() ([]byte, []int)
Deprecated: Use RenameEntryRequest.ProtoReflect.Descriptor instead.
func (*RenameEntryRequest) GetLanguage ¶ added in v0.23.1
func (x *RenameEntryRequest) GetLanguage() string
func (*RenameEntryRequest) GetNewText ¶ added in v0.23.1
func (x *RenameEntryRequest) GetNewText() string
func (*RenameEntryRequest) GetText ¶ added in v0.23.1
func (x *RenameEntryRequest) GetText() string
func (*RenameEntryRequest) ProtoMessage ¶ added in v0.23.1
func (*RenameEntryRequest) ProtoMessage()
func (*RenameEntryRequest) ProtoReflect ¶ added in v0.23.1
func (x *RenameEntryRequest) ProtoReflect() protoreflect.Message
func (*RenameEntryRequest) Reset ¶ added in v0.23.1
func (x *RenameEntryRequest) Reset()
func (*RenameEntryRequest) String ¶ added in v0.23.1
func (x *RenameEntryRequest) String() string
type RenameEntryResponse ¶ added in v0.23.1
type RenameEntryResponse struct {
// contains filtered or unexported fields
}
func (*RenameEntryResponse) Descriptor
deprecated
added in
v0.23.1
func (*RenameEntryResponse) Descriptor() ([]byte, []int)
Deprecated: Use RenameEntryResponse.ProtoReflect.Descriptor instead.
func (*RenameEntryResponse) ProtoMessage ¶ added in v0.23.1
func (*RenameEntryResponse) ProtoMessage()
func (*RenameEntryResponse) ProtoReflect ¶ added in v0.23.1
func (x *RenameEntryResponse) ProtoReflect() protoreflect.Message
func (*RenameEntryResponse) Reset ¶ added in v0.23.1
func (x *RenameEntryResponse) Reset()
func (*RenameEntryResponse) String ¶ added in v0.23.1
func (x *RenameEntryResponse) String() string
type Rule ¶ added in v0.23.1
type Rule struct {
// ID is the sequential primary key of the rule. Zero when creating a new
// rule; the server assigns it.
Id int64 `protobuf:"varint,14,opt,name=id,proto3" json:"id,omitempty"`
// Language the rule is for.
Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"`
// Name is a human-readable label for the rule. It is not unique.
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
// Status of the rule, used for moderation.
Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
// Description shown to editors as context for the correction.
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
// Level to use when offering corrections. Optional, defaults to LEVEL_ERROR.
Level CorrectionLevel `protobuf:"varint,5,opt,name=level,proto3,enum=elephant.spell.CorrectionLevel" json:"level,omitempty"`
// Pattern to match, in the rule DSL (see the message documentation).
Pattern string `protobuf:"bytes,6,opt,name=pattern,proto3" json:"pattern,omitempty"`
// Replacement template for the suggestion, referencing captures as {1}, {2}, …
Replacement string `protobuf:"bytes,7,opt,name=replacement,proto3" json:"replacement,omitempty"`
// Before, when set, only matches when immediately preceded by one of these
// words.
Before []string `protobuf:"bytes,8,rep,name=before,proto3" json:"before,omitempty"`
// After, when set, only matches when immediately followed by one of these
// words.
After []string `protobuf:"bytes,9,rep,name=after,proto3" json:"after,omitempty"`
// NotBefore suppresses the match when preceded by one of these words.
NotBefore []string `protobuf:"bytes,10,rep,name=not_before,json=notBefore,proto3" json:"not_before,omitempty"`
// NotAfter suppresses the match when followed by one of these words.
NotAfter []string `protobuf:"bytes,11,rep,name=not_after,json=notAfter,proto3" json:"not_after,omitempty"`
// Updated is the last update time in RFC3339 format.
Updated string `protobuf:"bytes,12,opt,name=updated,proto3" json:"updated,omitempty"`
// UpdatedBy is the identity of the party that last updated the rule.
UpdatedBy string `protobuf:"bytes,13,opt,name=updated_by,json=updatedBy,proto3" json:"updated_by,omitempty"`
// CaseSensitive matches the pattern and guards with their exact casing when
// set. Defaults to case-insensitive matching.
CaseSensitive bool `protobuf:"varint,15,opt,name=case_sensitive,json=caseSensitive,proto3" json:"case_sensitive,omitempty"`
// contains filtered or unexported fields
}
Rule is a named pattern matcher. The pattern is matched against the text directly using a small DSL: "{digit}" matches a run of digits, "{word}" a run of letters, and "{gap}" / "{gap(N)}" up to 4 (or N) whitespace-separated words in between. Any other text is literal and, by default, matched case-insensitively. Whitespace is significant: a run of spaces means "one or more whitespace" and adjacency means none, so "{digit}-{digit}" matches "12-15" but not "12 - 15". The placeholders capture their match; reference them in the replacement template as {1}, {2}, … in order. For example "{digit}-{digit}" with replacement "{1}–{2}" turns "12-15" into "12–15".
func (*Rule) Descriptor
deprecated
added in
v0.23.1
func (*Rule) GetCaseSensitive ¶ added in v0.23.1
func (*Rule) GetDescription ¶ added in v0.23.1
func (*Rule) GetLanguage ¶ added in v0.23.1
func (*Rule) GetLevel ¶ added in v0.23.1
func (x *Rule) GetLevel() CorrectionLevel
func (*Rule) GetNotAfter ¶ added in v0.23.1
func (*Rule) GetNotBefore ¶ added in v0.23.1
func (*Rule) GetPattern ¶ added in v0.23.1
func (*Rule) GetReplacement ¶ added in v0.23.1
func (*Rule) GetUpdated ¶ added in v0.23.1
func (*Rule) GetUpdatedBy ¶ added in v0.23.1
func (*Rule) ProtoMessage ¶ added in v0.23.1
func (*Rule) ProtoMessage()
func (*Rule) ProtoReflect ¶ added in v0.23.1
func (x *Rule) ProtoReflect() protoreflect.Message
type Rules ¶ added in v0.23.1
type Rules interface {
// ListRules lists pattern rules.
ListRules(context.Context, *ListRulesRequest) (*ListRulesResponse, error)
// GetRule returns the details of a single rule.
GetRule(context.Context, *GetRuleRequest) (*GetRuleResponse, error)
// SetRule adds or updates a rule.
SetRule(context.Context, *SetRuleRequest) (*SetRuleResponse, error)
// SetRuleStatus updates only the moderation status of a rule.
SetRuleStatus(context.Context, *SetRuleStatusRequest) (*SetRuleStatusResponse, error)
// DeleteRule removes a rule.
DeleteRule(context.Context, *DeleteRuleRequest) (*DeleteRuleResponse, error)
}
Rules manages pattern rules, which match a text pattern with placeholders rather than fixed strings. They are a separate kind of entity from dictionary words.
func NewRulesJSONClient ¶ added in v0.23.1
func NewRulesJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Rules
NewRulesJSONClient creates a JSON client that implements the Rules interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewRulesProtobufClient ¶ added in v0.23.1
func NewRulesProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Rules
NewRulesProtobufClient creates a Protobuf client that implements the Rules interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type SetEntryRequest ¶
type SetEntryRequest struct {
// Entry to set.
Entry *CustomEntry `protobuf:"bytes,1,opt,name=entry,proto3" json:"entry,omitempty"`
// contains filtered or unexported fields
}
func (*SetEntryRequest) Descriptor
deprecated
func (*SetEntryRequest) Descriptor() ([]byte, []int)
Deprecated: Use SetEntryRequest.ProtoReflect.Descriptor instead.
func (*SetEntryRequest) GetEntry ¶
func (x *SetEntryRequest) GetEntry() *CustomEntry
func (*SetEntryRequest) ProtoMessage ¶
func (*SetEntryRequest) ProtoMessage()
func (*SetEntryRequest) ProtoReflect ¶
func (x *SetEntryRequest) ProtoReflect() protoreflect.Message
func (*SetEntryRequest) Reset ¶
func (x *SetEntryRequest) Reset()
func (*SetEntryRequest) String ¶
func (x *SetEntryRequest) String() string
type SetEntryResponse ¶
type SetEntryResponse struct {
// contains filtered or unexported fields
}
func (*SetEntryResponse) Descriptor
deprecated
func (*SetEntryResponse) Descriptor() ([]byte, []int)
Deprecated: Use SetEntryResponse.ProtoReflect.Descriptor instead.
func (*SetEntryResponse) ProtoMessage ¶
func (*SetEntryResponse) ProtoMessage()
func (*SetEntryResponse) ProtoReflect ¶
func (x *SetEntryResponse) ProtoReflect() protoreflect.Message
func (*SetEntryResponse) Reset ¶
func (x *SetEntryResponse) Reset()
func (*SetEntryResponse) String ¶
func (x *SetEntryResponse) String() string
type SetEntryStatusRequest ¶ added in v0.23.1
type SetEntryStatusRequest struct {
// Language the entry is for.
Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"`
// Text is the word or phrase to update.
Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
// Status to set, e.g. "accepted" or "pending".
Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
// contains filtered or unexported fields
}
func (*SetEntryStatusRequest) Descriptor
deprecated
added in
v0.23.1
func (*SetEntryStatusRequest) Descriptor() ([]byte, []int)
Deprecated: Use SetEntryStatusRequest.ProtoReflect.Descriptor instead.
func (*SetEntryStatusRequest) GetLanguage ¶ added in v0.23.1
func (x *SetEntryStatusRequest) GetLanguage() string
func (*SetEntryStatusRequest) GetStatus ¶ added in v0.23.1
func (x *SetEntryStatusRequest) GetStatus() string
func (*SetEntryStatusRequest) GetText ¶ added in v0.23.1
func (x *SetEntryStatusRequest) GetText() string
func (*SetEntryStatusRequest) ProtoMessage ¶ added in v0.23.1
func (*SetEntryStatusRequest) ProtoMessage()
func (*SetEntryStatusRequest) ProtoReflect ¶ added in v0.23.1
func (x *SetEntryStatusRequest) ProtoReflect() protoreflect.Message
func (*SetEntryStatusRequest) Reset ¶ added in v0.23.1
func (x *SetEntryStatusRequest) Reset()
func (*SetEntryStatusRequest) String ¶ added in v0.23.1
func (x *SetEntryStatusRequest) String() string
type SetEntryStatusResponse ¶ added in v0.23.1
type SetEntryStatusResponse struct {
// contains filtered or unexported fields
}
func (*SetEntryStatusResponse) Descriptor
deprecated
added in
v0.23.1
func (*SetEntryStatusResponse) Descriptor() ([]byte, []int)
Deprecated: Use SetEntryStatusResponse.ProtoReflect.Descriptor instead.
func (*SetEntryStatusResponse) ProtoMessage ¶ added in v0.23.1
func (*SetEntryStatusResponse) ProtoMessage()
func (*SetEntryStatusResponse) ProtoReflect ¶ added in v0.23.1
func (x *SetEntryStatusResponse) ProtoReflect() protoreflect.Message
func (*SetEntryStatusResponse) Reset ¶ added in v0.23.1
func (x *SetEntryStatusResponse) Reset()
func (*SetEntryStatusResponse) String ¶ added in v0.23.1
func (x *SetEntryStatusResponse) String() string
type SetRuleRequest ¶ added in v0.23.1
type SetRuleRequest struct {
// Rule to set. A zero id creates a new rule; a non-zero id updates the
// existing rule with that id.
Rule *Rule `protobuf:"bytes,1,opt,name=rule,proto3" json:"rule,omitempty"`
// contains filtered or unexported fields
}
func (*SetRuleRequest) Descriptor
deprecated
added in
v0.23.1
func (*SetRuleRequest) Descriptor() ([]byte, []int)
Deprecated: Use SetRuleRequest.ProtoReflect.Descriptor instead.
func (*SetRuleRequest) GetRule ¶ added in v0.23.1
func (x *SetRuleRequest) GetRule() *Rule
func (*SetRuleRequest) ProtoMessage ¶ added in v0.23.1
func (*SetRuleRequest) ProtoMessage()
func (*SetRuleRequest) ProtoReflect ¶ added in v0.23.1
func (x *SetRuleRequest) ProtoReflect() protoreflect.Message
func (*SetRuleRequest) Reset ¶ added in v0.23.1
func (x *SetRuleRequest) Reset()
func (*SetRuleRequest) String ¶ added in v0.23.1
func (x *SetRuleRequest) String() string
type SetRuleResponse ¶ added in v0.23.1
type SetRuleResponse struct {
// ID of the created or updated rule.
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// contains filtered or unexported fields
}
func (*SetRuleResponse) Descriptor
deprecated
added in
v0.23.1
func (*SetRuleResponse) Descriptor() ([]byte, []int)
Deprecated: Use SetRuleResponse.ProtoReflect.Descriptor instead.
func (*SetRuleResponse) GetId ¶ added in v0.23.1
func (x *SetRuleResponse) GetId() int64
func (*SetRuleResponse) ProtoMessage ¶ added in v0.23.1
func (*SetRuleResponse) ProtoMessage()
func (*SetRuleResponse) ProtoReflect ¶ added in v0.23.1
func (x *SetRuleResponse) ProtoReflect() protoreflect.Message
func (*SetRuleResponse) Reset ¶ added in v0.23.1
func (x *SetRuleResponse) Reset()
func (*SetRuleResponse) String ¶ added in v0.23.1
func (x *SetRuleResponse) String() string
type SetRuleStatusRequest ¶ added in v0.23.1
type SetRuleStatusRequest struct {
// ID of the rule to update.
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// Status to set, e.g. "accepted" or "pending".
Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
// contains filtered or unexported fields
}
func (*SetRuleStatusRequest) Descriptor
deprecated
added in
v0.23.1
func (*SetRuleStatusRequest) Descriptor() ([]byte, []int)
Deprecated: Use SetRuleStatusRequest.ProtoReflect.Descriptor instead.
func (*SetRuleStatusRequest) GetId ¶ added in v0.23.1
func (x *SetRuleStatusRequest) GetId() int64
func (*SetRuleStatusRequest) GetStatus ¶ added in v0.23.1
func (x *SetRuleStatusRequest) GetStatus() string
func (*SetRuleStatusRequest) ProtoMessage ¶ added in v0.23.1
func (*SetRuleStatusRequest) ProtoMessage()
func (*SetRuleStatusRequest) ProtoReflect ¶ added in v0.23.1
func (x *SetRuleStatusRequest) ProtoReflect() protoreflect.Message
func (*SetRuleStatusRequest) Reset ¶ added in v0.23.1
func (x *SetRuleStatusRequest) Reset()
func (*SetRuleStatusRequest) String ¶ added in v0.23.1
func (x *SetRuleStatusRequest) String() string
type SetRuleStatusResponse ¶ added in v0.23.1
type SetRuleStatusResponse struct {
// contains filtered or unexported fields
}
func (*SetRuleStatusResponse) Descriptor
deprecated
added in
v0.23.1
func (*SetRuleStatusResponse) Descriptor() ([]byte, []int)
Deprecated: Use SetRuleStatusResponse.ProtoReflect.Descriptor instead.
func (*SetRuleStatusResponse) ProtoMessage ¶ added in v0.23.1
func (*SetRuleStatusResponse) ProtoMessage()
func (*SetRuleStatusResponse) ProtoReflect ¶ added in v0.23.1
func (x *SetRuleStatusResponse) ProtoReflect() protoreflect.Message
func (*SetRuleStatusResponse) Reset ¶ added in v0.23.1
func (x *SetRuleStatusResponse) Reset()
func (*SetRuleStatusResponse) String ¶ added in v0.23.1
func (x *SetRuleStatusResponse) String() string
type Suggestion ¶
type Suggestion struct {
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
// contains filtered or unexported fields
}
func (*Suggestion) Descriptor
deprecated
func (*Suggestion) Descriptor() ([]byte, []int)
Deprecated: Use Suggestion.ProtoReflect.Descriptor instead.
func (*Suggestion) GetDescription ¶
func (x *Suggestion) GetDescription() string
func (*Suggestion) GetText ¶
func (x *Suggestion) GetText() string
func (*Suggestion) ProtoMessage ¶
func (*Suggestion) ProtoMessage()
func (*Suggestion) ProtoReflect ¶
func (x *Suggestion) ProtoReflect() protoreflect.Message
func (*Suggestion) Reset ¶
func (x *Suggestion) Reset()
func (*Suggestion) String ¶
func (x *Suggestion) String() string
type SuggestionsRequest ¶ added in v0.19.4
type SuggestionsRequest struct {
// Text is the word or phrase to get suggestions for.
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
// Language to get suggestions in.
Language string `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"`
// CustomOnly limits suggestions to the custom dictionary and rules, skipping
// the hunspell pass.
CustomOnly bool `protobuf:"varint,3,opt,name=custom_only,json=customOnly,proto3" json:"custom_only,omitempty"`
// contains filtered or unexported fields
}
func (*SuggestionsRequest) Descriptor
deprecated
added in
v0.19.4
func (*SuggestionsRequest) Descriptor() ([]byte, []int)
Deprecated: Use SuggestionsRequest.ProtoReflect.Descriptor instead.
func (*SuggestionsRequest) GetCustomOnly ¶ added in v0.22.4
func (x *SuggestionsRequest) GetCustomOnly() bool
func (*SuggestionsRequest) GetLanguage ¶ added in v0.19.4
func (x *SuggestionsRequest) GetLanguage() string
func (*SuggestionsRequest) GetText ¶ added in v0.19.4
func (x *SuggestionsRequest) GetText() string
func (*SuggestionsRequest) ProtoMessage ¶ added in v0.19.4
func (*SuggestionsRequest) ProtoMessage()
func (*SuggestionsRequest) ProtoReflect ¶ added in v0.19.4
func (x *SuggestionsRequest) ProtoReflect() protoreflect.Message
func (*SuggestionsRequest) Reset ¶ added in v0.19.4
func (x *SuggestionsRequest) Reset()
func (*SuggestionsRequest) String ¶ added in v0.19.4
func (x *SuggestionsRequest) String() string
type SuggestionsResponse ¶ added in v0.19.4
type SuggestionsResponse struct {
// Suggestions for replacements.
Suggestions []*Suggestion `protobuf:"bytes,1,rep,name=suggestions,proto3" json:"suggestions,omitempty"`
// contains filtered or unexported fields
}
func (*SuggestionsResponse) Descriptor
deprecated
added in
v0.19.4
func (*SuggestionsResponse) Descriptor() ([]byte, []int)
Deprecated: Use SuggestionsResponse.ProtoReflect.Descriptor instead.
func (*SuggestionsResponse) GetSuggestions ¶ added in v0.19.4
func (x *SuggestionsResponse) GetSuggestions() []*Suggestion
func (*SuggestionsResponse) ProtoMessage ¶ added in v0.19.4
func (*SuggestionsResponse) ProtoMessage()
func (*SuggestionsResponse) ProtoReflect ¶ added in v0.19.4
func (x *SuggestionsResponse) ProtoReflect() protoreflect.Message
func (*SuggestionsResponse) Reset ¶ added in v0.19.4
func (x *SuggestionsResponse) Reset()
func (*SuggestionsResponse) String ¶ added in v0.19.4
func (x *SuggestionsResponse) String() string
type SupportedLanguagesRequest ¶ added in v0.17.5
type SupportedLanguagesRequest struct {
// contains filtered or unexported fields
}
func (*SupportedLanguagesRequest) Descriptor
deprecated
added in
v0.17.5
func (*SupportedLanguagesRequest) Descriptor() ([]byte, []int)
Deprecated: Use SupportedLanguagesRequest.ProtoReflect.Descriptor instead.
func (*SupportedLanguagesRequest) ProtoMessage ¶ added in v0.17.5
func (*SupportedLanguagesRequest) ProtoMessage()
func (*SupportedLanguagesRequest) ProtoReflect ¶ added in v0.17.5
func (x *SupportedLanguagesRequest) ProtoReflect() protoreflect.Message
func (*SupportedLanguagesRequest) Reset ¶ added in v0.17.5
func (x *SupportedLanguagesRequest) Reset()
func (*SupportedLanguagesRequest) String ¶ added in v0.17.5
func (x *SupportedLanguagesRequest) String() string
type SupportedLanguagesResponse ¶ added in v0.17.5
type SupportedLanguagesResponse struct {
// Languages that can be used for spellchecking.
Languages []*Language `protobuf:"bytes,1,rep,name=languages,proto3" json:"languages,omitempty"`
// contains filtered or unexported fields
}
func (*SupportedLanguagesResponse) Descriptor
deprecated
added in
v0.17.5
func (*SupportedLanguagesResponse) Descriptor() ([]byte, []int)
Deprecated: Use SupportedLanguagesResponse.ProtoReflect.Descriptor instead.
func (*SupportedLanguagesResponse) GetLanguages ¶ added in v0.17.5
func (x *SupportedLanguagesResponse) GetLanguages() []*Language
func (*SupportedLanguagesResponse) ProtoMessage ¶ added in v0.17.5
func (*SupportedLanguagesResponse) ProtoMessage()
func (*SupportedLanguagesResponse) ProtoReflect ¶ added in v0.17.5
func (x *SupportedLanguagesResponse) ProtoReflect() protoreflect.Message
func (*SupportedLanguagesResponse) Reset ¶ added in v0.17.5
func (x *SupportedLanguagesResponse) Reset()
func (*SupportedLanguagesResponse) String ¶ added in v0.17.5
func (x *SupportedLanguagesResponse) String() string
type TextRequest ¶
type TextRequest struct {
// Text to spellcheck.
Text []string `protobuf:"bytes,1,rep,name=text,proto3" json:"text,omitempty"`
// Language to check the text for.
Language string `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"`
// Suggestions enables generation of suggestions for misspelled words. In
// interactive applications this should normally be done by calling the
// Suggestions method on demand.
Suggestions bool `protobuf:"varint,3,opt,name=suggestions,proto3" json:"suggestions,omitempty"`
// CustomOnly limits checks to the custom dictionary and rules, skipping the
// hunspell pass. Useful when you only want to surface custom corrections
// without the noise of hunspell results.
CustomOnly bool `protobuf:"varint,4,opt,name=custom_only,json=customOnly,proto3" json:"custom_only,omitempty"`
// contains filtered or unexported fields
}
func (*TextRequest) Descriptor
deprecated
func (*TextRequest) Descriptor() ([]byte, []int)
Deprecated: Use TextRequest.ProtoReflect.Descriptor instead.
func (*TextRequest) GetCustomOnly ¶ added in v0.22.4
func (x *TextRequest) GetCustomOnly() bool
func (*TextRequest) GetLanguage ¶
func (x *TextRequest) GetLanguage() string
func (*TextRequest) GetSuggestions ¶ added in v0.19.4
func (x *TextRequest) GetSuggestions() 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 {
Misspelled []*Misspelled `protobuf:"bytes,1,rep,name=misspelled,proto3" json:"misspelled,omitempty"`
// contains filtered or unexported fields
}
func (*TextResponse) Descriptor
deprecated
func (*TextResponse) Descriptor() ([]byte, []int)
Deprecated: Use TextResponse.ProtoReflect.Descriptor instead.
func (*TextResponse) GetMisspelled ¶
func (x *TextResponse) GetMisspelled() []*Misspelled
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 TextSpan ¶ added in v0.23.1
type TextSpan struct {
// Start is the character offset of the match in the source text.
Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"`
// End is the character offset just past the match.
End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"`
// contains filtered or unexported fields
}
TextSpan is a half-open range [start, end) into a source text, counted in Unicode characters (code points / runes), not bytes. For text within the Basic Multilingual Plane this matches JavaScript/UTF-16 string offsets.
func (*TextSpan) Descriptor
deprecated
added in
v0.23.1
func (*TextSpan) ProtoMessage ¶ added in v0.23.1
func (*TextSpan) ProtoMessage()
func (*TextSpan) ProtoReflect ¶ added in v0.23.1
func (x *TextSpan) ProtoReflect() protoreflect.Message
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 NewCheckServer ¶
func NewCheckServer(svc Check, opts ...interface{}) TwirpServer
NewCheckServer 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).
func NewDictionariesServer ¶
func NewDictionariesServer(svc Dictionaries, opts ...interface{}) TwirpServer
NewDictionariesServer 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).
func NewRulesServer ¶ added in v0.23.1
func NewRulesServer(svc Rules, opts ...interface{}) TwirpServer
NewRulesServer 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).