Documentation ¶
Index ¶
- Constants
- func AuthToContext(parent context.Context, au *Auth) context.Context
- type AppKey
- type AppKeyCreateParam
- type AppKeyDeleteParam
- type AppKeyFilter
- type Auth
- type AuthFilter
- type AuthLevel
- type Core
- func (c *Core) ActiveDevice(deviceID string)
- func (c *Core) AppKey(f AppKeyFilter) (*AppKey, error)
- func (c *Core) AppKeyAuthFrom(token string) (*Auth, error)
- func (c *Core) AppKeys(f *AppKeyFilter) ([]*AppKey, error)
- func (c *Core) Auth(f AuthFilter) (*Auth, error)
- func (c *Core) AuthByRefreshToken(refreshToken string) (*Auth, error)
- func (c *Core) Auths(f *AuthFilter) ([]*Auth, error)
- func (c Core) CreateAppKey(p AppKeyCreateParam) (*AppKey, error)
- func (c *Core) CreateAuth(p authCreateParam) (*Auth, error)
- func (c *Core) CreateDevice(p DeviceCreateParam) (*Device, error)
- func (c *Core) CreateMessage(p MessageCreateParam) (*Message, error)
- func (c *Core) CreateUser(p UserCreateParam) (*User, error)
- func (c Core) CreateWebhook(p WebhookCreateParam) (*Webhook, error)
- func (c *Core) DeleteAppKey(p AppKeyDeleteParam) error
- func (c *Core) DeleteWebhook(p WebhookDeleteParam) error
- func (c *Core) Device(f DeviceFilter) (*Device, error)
- func (c *Core) DeviceByID(id ID) (*Device, error)
- func (c *Core) Devices(f *DeviceFilter) ([]*Device, error)
- func (c *Core) LoginAuth(p LoginParams) (*Auth, error)
- func (c *Core) Message(f MessageFilter) (*Message, error)
- func (c *Core) MessageByID(id ID) (*Message, error)
- func (c *Core) MessageGraph(dateScope string, filter *MessageFilter) ([]MessageStatsData, error)
- func (c *Core) MessageScore(dateScope string, filter *MessageFilter) (MessageStats, error)
- func (c *Core) Messages(f *MessageFilter) ([]*Message, error)
- func (c *Core) OutboxGraph(dateScope string, filter *MessageFilter) ([]OutboxStatsData, error)
- func (c *Core) PushInbox(p MessageCreateParam) (*Message, error)
- func (c *Core) RegisterAccount(p RegisterAccountParam) (*Auth, error)
- func (c *Core) RevokeRefreshToken(refreshToken string) error
- func (c *Core) SearchAppKeys(opts *SearchOpts) ([]*AppKey, *SearchMetadata, error)
- func (c *Core) SearchDevices(opts *SearchOpts) ([]*Device, *SearchMetadata, error)
- func (c *Core) SearchMessages(opts *SearchOpts) ([]*Message, *SearchMetadata, error)
- func (c *Core) SearchUsers(opts *SearchOpts) ([]*User, *SearchMetadata, error)
- func (c *Core) SearchWebhooks(opts *SearchOpts) ([]*Webhook, *SearchMetadata, error)
- func (c *Core) SendOutbox(p MessageCreateParam) (*Message, error)
- func (c *Core) SendSMSGuard(p SMSGuardCreateParam) (code string, expr time.Time, err error)
- func (c *Core) UpdateDevice(p DeviceUpdateParam) (*Device, error)
- func (c *Core) UpdateOutbox(p OutboxUpdateParam) (*Message, error)
- func (c *Core) UpdateWebhook(p WebhookUpdateParam) (*Webhook, error)
- func (c *Core) User(id ID) (*User, error)
- func (c *Core) Users(f *UserFilter) ([]*User, error)
- func (c *Core) VerifyAuth(p VerifyParams) (*Auth, error)
- func (c *Core) Webhook(f WebhookFilter) (*Webhook, error)
- func (c *Core) Webhooks(f *WebhookFilter) ([]*Webhook, error)
- type DataStoreUtil
- type Datastore
- type DatastoreCRUD
- type DatastoreSearch
- type Device
- type DeviceCmd
- type DeviceCreateParam
- type DeviceFilter
- type DeviceStatus
- type DeviceUpdateParam
- type Errors
- type ID
- type LoginParams
- type Mailer
- type Message
- type MessageCreateParam
- type MessageFilter
- type MessageKind
- type MessageStats
- type MessageStatsData
- type MessageStatus
- type OutboxStatsData
- type OutboxUpdateParam
- type Poster
- type RegisterAccountParam
- type SMSGuardCreateParam
- type SearchMetadata
- type SearchOpts
- type StatsScope
- type StatsScopeUnit
- type User
- type UserCreateParam
- type UserFilter
- type VerifyParams
- type Webhook
- type WebhookCreateParam
- type WebhookDeleteParam
- type WebhookFilter
- type WebhookPayload
- type WebhookUpdateParam
Constants ¶
const (
AppKeyPrefix = "ak_"
)
const SMSGuardDefaultDuration = time.Minute * 10
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppKey ¶
type AppKey struct { ID ID `json:"id" gorm:"primaryKey;type:CHAR(20)"` UserID ID `json:"user_id"` Token string `json:"token"` Note string `json:"note"` LastUsed *time.Time `json:"last_used"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
AppKey represents a limited but long-lived access token. Primary used for mobile app client and server applications.
type AppKeyCreateParam ¶
AppKeyCreateParam represents parameters to create app-key.
type AppKeyDeleteParam ¶
AppKeyDeleteParam represents parameters to delete app-keys.
type AppKeyFilter ¶
type AppKeyFilter struct { ID ID `db:"id,omitempty"` UserID ID `db:"user_id,omitempty"` Token string `db:"token,omitempty"` Note string `db:"note,omitempty"` }
AppKeyFilter represents app-keys query filter.
type Auth ¶
type Auth struct { ID ID `json:"id" gorm:"primaryKey;type:CHAR(20)"` UserID ID `json:"user_id"` Username string `json:"username"` Password string `json:"-"` RefreshToken string `json:"refresh_token"` Level AuthLevel `json:"level"` VerificationCode string `json:"-"` VerifiedAt *time.Time `json:"verified_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Auth represents user account access information.
func AuthFromContext ¶
AuthFromContext returns an auth details from the given context if one is present. Return nil if auth detail cannot be found.
type AuthFilter ¶
type AuthFilter struct { ID ID `db:"id,omitempty"` UserID ID `db:"user_id,omitempty"` Username string `db:"username,omitempty"` Password string `db:"password,omitempty"` RefreshToken string `db:"refresh_token,omitempty"` Level AuthLevel `db:"level,omitempty"` VerificationCode string `db:"verification_code,omitempty"` }
type AuthLevel ¶
type AuthLevel uint
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core represents ratatxt core service.
func NewCore ¶
func NewCore(ds Datastore, mail Mailer, devCmd DeviceCmd, webhook Poster, log *logrus.Logger) (*Core, error)
NewCore create new instance of ratatxt core.
func (*Core) ActiveDevice ¶
ActiveDevice updates its last active date by device id.
func (*Core) AppKey ¶
func (c *Core) AppKey(f AppKeyFilter) (*AppKey, error)
AppKey returns appKey details by filter and returns error if no result.
func (*Core) AppKeyAuthFrom ¶
AppKeyAuthFrom returns auth details from app-key token.
It will also update app-key last used field.
func (*Core) AppKeys ¶
func (c *Core) AppKeys(f *AppKeyFilter) ([]*AppKey, error)
AppKeys returns a list of app-keys by filter.
func (*Core) Auth ¶
func (c *Core) Auth(f AuthFilter) (*Auth, error)
Auth returns auth details base on filter.
func (*Core) AuthByRefreshToken ¶
AuthByRefreshToken returns auth details by refresh token.
Invalid token or empty token returns AuthErrInvalidRefreshToken error.
func (*Core) Auths ¶
func (c *Core) Auths(f *AuthFilter) ([]*Auth, error)
Auths returns a list of auths base on filter.
func (Core) CreateAppKey ¶
func (c Core) CreateAppKey(p AppKeyCreateParam) (*AppKey, error)
CreateAppKey create new app-keys to datastore.
func (*Core) CreateAuth ¶
CreateAuth creates new authentication access.
func (*Core) CreateDevice ¶
func (c *Core) CreateDevice(p DeviceCreateParam) (*Device, error)
CreateDevice creates new device to datastore.
func (*Core) CreateMessage ¶
func (c *Core) CreateMessage(p MessageCreateParam) (*Message, error)
CreateMessage creates new message to datastore.
func (*Core) CreateUser ¶
func (c *Core) CreateUser(p UserCreateParam) (*User, error)
CreateUser creates new user to datastore.
func (Core) CreateWebhook ¶
func (c Core) CreateWebhook(p WebhookCreateParam) (*Webhook, error)
CreateWebhook create new webhook to datastore.
func (*Core) DeleteAppKey ¶
func (c *Core) DeleteAppKey(p AppKeyDeleteParam) error
DeleteAppKey permanently deletes existing app-keys on datastore.
func (*Core) DeleteWebhook ¶
func (c *Core) DeleteWebhook(p WebhookDeleteParam) error
DeleteWebhook permanently deletes existing webhook on datastore.
func (*Core) Device ¶
func (c *Core) Device(f DeviceFilter) (*Device, error)
Device returns device details by filter and returns error if no result.
func (*Core) DeviceByID ¶
DeviceByID returns device details by id.
func (*Core) Devices ¶
func (c *Core) Devices(f *DeviceFilter) ([]*Device, error)
Devices returns a list of devices by filter.
func (*Core) LoginAuth ¶
func (c *Core) LoginAuth(p LoginParams) (*Auth, error)
LoginAuth validates username and password and returns auth details.
func (*Core) Message ¶
func (c *Core) Message(f MessageFilter) (*Message, error)
Message returns message details by filter and returns error if no result.
func (*Core) MessageByID ¶
MessageByID returns message details by id.
func (*Core) MessageGraph ¶
func (c *Core) MessageGraph(dateScope string, filter *MessageFilter) ([]MessageStatsData, error)
MessageGraph returns message stats graph by scope and filter.
func (*Core) MessageScore ¶
func (c *Core) MessageScore(dateScope string, filter *MessageFilter) (MessageStats, error)
MessageScore returns message stats score by scope and filter.
func (*Core) Messages ¶
func (c *Core) Messages(f *MessageFilter) ([]*Message, error)
Messages returns a list of messages by filter.
func (*Core) OutboxGraph ¶
func (c *Core) OutboxGraph(dateScope string, filter *MessageFilter) ([]OutboxStatsData, error)
OutboxGraph returns outbox stats graph by scope and filter.
func (*Core) PushInbox ¶
func (c *Core) PushInbox(p MessageCreateParam) (*Message, error)
PushInbox creates new inbox kind message and notifies device owners registered webhooks.
func (*Core) RegisterAccount ¶
func (c *Core) RegisterAccount(p RegisterAccountParam) (*Auth, error)
RegisterAccount creates new user account and access data.
func (*Core) RevokeRefreshToken ¶
RevokeRefreshToken invalidates refresh token and generates a new one.
func (*Core) SearchAppKeys ¶
func (c *Core) SearchAppKeys(opts *SearchOpts) ([]*AppKey, *SearchMetadata, error)
SearchAppKeys returns a list of app-Keys and metadata base on search options.
func (*Core) SearchDevices ¶
func (c *Core) SearchDevices(opts *SearchOpts) ([]*Device, *SearchMetadata, error)
SearchDevices returns a list of devices and metadata base on search options.
func (*Core) SearchMessages ¶
func (c *Core) SearchMessages(opts *SearchOpts) ([]*Message, *SearchMetadata, error)
SearchMessages returns a list of messages and metadata base on search options.
func (*Core) SearchUsers ¶
func (c *Core) SearchUsers(opts *SearchOpts) ([]*User, *SearchMetadata, error)
SearchUsers returns a list of users and metadata base on search options.
func (*Core) SearchWebhooks ¶
func (c *Core) SearchWebhooks(opts *SearchOpts) ([]*Webhook, *SearchMetadata, error)
SearchWebhooks returns a list of webhooks and metadata base on search options.
func (*Core) SendOutbox ¶
func (c *Core) SendOutbox(p MessageCreateParam) (*Message, error)
SendOutbox creates new outbox kind message and send command to device to send SMS.
func (*Core) SendSMSGuard ¶
SendSMSGuard generates code and send to address.
func (*Core) UpdateDevice ¶
func (c *Core) UpdateDevice(p DeviceUpdateParam) (*Device, error)
UpdateDevice updates existing device to datastore.
func (*Core) UpdateOutbox ¶
func (c *Core) UpdateOutbox(p OutboxUpdateParam) (*Message, error)
UpdateOutbox updates existing message outbox to datastore.
func (*Core) UpdateWebhook ¶
func (c *Core) UpdateWebhook(p WebhookUpdateParam) (*Webhook, error)
UpdateWebhook updates existing webhook to datastore.
func (*Core) Users ¶
func (c *Core) Users(f *UserFilter) ([]*User, error)
Users returns a list of users base on user filter.
func (*Core) VerifyAuth ¶
func (c *Core) VerifyAuth(p VerifyParams) (*Auth, error)
VerifyAuth verifies account ownership by code.
type DataStoreUtil ¶
type DataStoreUtil interface {
AutoMigrate(obj ...interface{}) error
}
type Datastore ¶
type Datastore interface { DatastoreSearch DatastoreCRUD DataStoreUtil // MessageStats Custom operations MessageStats(dst interface{}, scope StatsScope, filter *MessageFilter) error MessageGraph(dst interface{}, scope StatsScope, filter *MessageFilter) error OutboxGraph(dst interface{}, scope StatsScope, filter *MessageFilter) error }
Datastore provides basic and search datastore operations.
type DatastoreCRUD ¶
type DatastoreCRUD interface { List(rows, filter interface{}) error Get(row interface{}, id ID) error Create(input interface{}) error Update(input interface{}) error Delete(input interface{}) error }
DatastoreCRUD provides basic datastore operation.
type DatastoreSearch ¶
type DatastoreSearch interface { Search(data interface{}, opts *SearchOpts) (*SearchMetadata, error) Count(model interface{}, opts *SearchOpts) (int, error) }
DatastoreSearch provides search datastore operation.
type Device ¶
type Device struct { ID ID `json:"id" gorm:"primaryKey;type:CHAR(20)"` UserID ID `json:"user_id"` Name string `json:"name"` Address string `json:"address"` Status DeviceStatus `json:"status"` LastActive *time.Time `json:"last_active"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Device represents user device information.
type DeviceCmd ¶
type DeviceCmd interface { // Forward commands device to send an outgoing message. Forward(topic, msgID, targetAddr, text string) error // Ping sends a ping message for testing device connection to service. Ping(topic string) error // ActiveHandler callback triggers when device is connected and responded on ping. ActiveHandler(func(clientID string)) }
DeviceCmd issue send commands on connected devices.
type DeviceCreateParam ¶
type DeviceCreateParam struct { UserID ID `json:"user_id"` Name string `json:"name"` Address string `json:"address"` }
DeviceCreateParam represents parameters to create a device.
type DeviceFilter ¶
type DeviceFilter struct { ID ID `db:"id,omitempty"` UserID ID `db:"user_id,omitempty"` Name string `db:"name,omitempty"` Address string `db:"address,omitempty"` Status DeviceStatus `db:"status,omitempty"` }
DeviceFilter represents device filter.
type DeviceStatus ¶
type DeviceStatus uint
DeviceStatus represents device status.
const ( DeviceStatusActive DeviceStatus = 20 // Default device status DeviceStatusDisabled DeviceStatus = 40 // Disables device and stop all process. )
Device statuses.
func (DeviceStatus) String ¶
func (s DeviceStatus) String() string
String returns string value of DeviceStatus.
type DeviceUpdateParam ¶
type DeviceUpdateParam struct { ID ID `json:"id"` UserID ID `json:"user_id"` Name string `json:"name"` Address string `json:"address"` Status DeviceStatus `json:"status"` LastActive *time.Time `json:"last_active"` }
DeviceUpdateParam represents parameters to update a device.
type Errors ¶
type Errors uint
Errors represents error.
const ( AppKeyErrNotFound Errors = iota + 2100 AppKeyErrRequiredID AppKeyErrRequiredUserID AppKeyErrLimit )
AppKey errors types.
const ( AuthErrNoAccess Errors = iota + 2000 AuthErrNotFound AuthErrRequiredID AuthErrRequiredUserID AuthErrVerificationReqFields AuthErrLoginReqFields AuthErrNotUsernameUsed AuthErrInvalidRefreshToken AuthErrInvalidLogin )
Auth errors types.
const ( DeviceErrNotFound Errors = iota + 3000 DeviceErrRequiredID DeviceErrRequiredUserID DeviceErrRequiredFields DeviceErrDupName )
Device errors types.
const ( SMSGuardErrNotFound Errors = iota + 9000 SMSGuardErrRequiredID SMSGuardErrRequiredUserID SMSGuardErrReqFields )
SMSGuard errors types.
const ( StatsErrNotFound Errors = iota + 6000 StatsErrScopeStringRequired StatsErrScopeNotParsable )
Stats errors types.
User errors types.
type LoginParams ¶
LoginParams represents parameters for authenticating access.
type Mailer ¶
type Mailer interface { // Send a simple text email. Send(to []string, subject, text string) error // SendHTML sends an email with HTML header. SendHTML(to []string, subject, tmpl string, data map[string]interface{}) error }
Mailer represents mail interface.
type Message ¶
type Message struct { ID ID `json:"id" gorm:"primaryKey;type:CHAR(20)"` UserID ID `json:"user_id"` DeviceID ID `json:"device_id"` Kind MessageKind `json:"kind"` Status MessageStatus `json:"status"` Address string `json:"address"` Text string `json:"text"` Timestamp int64 `json:"timestamp"` RetryCount int `json:"retry_count"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Device *Device `json:"device,omitempty" gorm:"-"` }
Message represents user's message information.
type MessageCreateParam ¶
type MessageCreateParam struct { UserID ID `json:"user_id"` DeviceID ID `json:"device_id"` Kind MessageKind `json:"kind"` Status MessageStatus `json:"status"` Address string `json:"address"` Text string `json:"text"` Timestamp int64 `json:"timestamp"` }
MessageCreateParam represents parameters to create a message.
type MessageFilter ¶
type MessageFilter struct { ID ID `db:"id,omitempty"` UserID ID `db:"user_id,omitempty"` DeviceID ID `db:"device_id,omitempty"` Kind MessageKind `db:"kind,omitempty"` Status MessageStatus `db:"status,omitempty"` Address string `db:"address,omitempty"` }
MessageFilter represents message filter.
type MessageKind ¶
type MessageKind uint
MessageKind represents message kind.
const ( MessageKindInbox MessageKind = 10 MessageKindOutbox MessageKind = 20 )
type MessageStats ¶
type MessageStats struct { MessageStatsData OutboxStatsData }
MessageStats represents messages counters.
type MessageStatsData ¶
type MessageStatsData struct { Scope string `json:"scope"` Total int `json:"total"` Inbox int `json:"inbox"` Outbox int `json:"outbox"` }
MessageStatsData represents message aggregation overtime.
type MessageStatus ¶
type MessageStatus uint
MessageStatus represents message status.
const ( MessageStatusInboxNew MessageStatus = 110 MessageStatusInboxRead MessageStatus = 120 MessageStatusInboxFailed MessageStatus = 140 MessageStatusInboxError MessageStatus = 150 )
Inbox message statuses.
const ( MessageStatusOutboxQueued MessageStatus = 200 MessageStatusOutboxSending MessageStatus = 210 MessageStatusOutboxSent MessageStatus = 220 MessageStatusOutboxFailed MessageStatus = 240 MessageStatusOutboxError MessageStatus = 250 )
Outbox message statuses.
type OutboxStatsData ¶
type OutboxStatsData struct { Scope string `json:"scope"` OutboxQueued int `json:"outbox_queued"` OutboxSending int `json:"outbox_sending"` OutboxSent int `json:"outbox_sent"` OutboxFailed int `json:"outbox_failed"` OutboxError int `json:"outbox_error"` }
OutboxStatsData represents outbox aggregation overtime.
type OutboxUpdateParam ¶
type OutboxUpdateParam struct { ID ID `json:"id"` UserID ID `json:"user_id"` Status MessageStatus `json:"status"` }
OutboxUpdateParam represents parameters to update an outbox message.
type Poster ¶
type Poster interface { // Post sends a POST request with application/json content-type. Post(payloadURL string, payload interface{}) (statusCode int, err error) }
Poster sends post request to payload url.
type RegisterAccountParam ¶
type RegisterAccountParam struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` Email string `json:"email"` Password string `json:"password"` }
RegisterAccountParam represents parameters to create operation.
type SMSGuardCreateParam ¶
type SMSGuardCreateParam struct { UserID ID `json:"user_id"` DeviceID ID `json:"device_id"` Address string `json:"address"` From string `json:"from"` Minutes int `json:"duration_min"` }
SMSGuardCreateParam represents parameters to create a sms-guard code.
type SearchMetadata ¶
SearchMetadata represents search metadata.
type SearchOpts ¶
type SearchOpts struct { Keyword string KeywordFields []string Filter interface{} UserID ID Page int Limit int IndexSorting bool Sort string Desc bool }
SearchOpts represent search options.
type StatsScope ¶
type StatsScope struct {
From, To time.Time
Unit StatsScopeUnit
All bool
}
StatsScope represents stats scope result.
func StatsScopeParse ¶
func StatsScopeParse(scopeStr string) (scope *StatsScope, err error)
StatsScopeParse parses scope string like 20200226-20200229-d as custom range and support scope templates like "last-8-h" and "last-7-d".
use "all" to get everything.
type StatsScopeUnit ¶
type StatsScopeUnit uint
StatsScopeUnit represents stats scope time unit.
const ( StatsScopeUnitHour StatsScopeUnit = iota StatsScopeUnitDay )
Stats scope time unit.
func (StatsScopeUnit) DateFormat ¶
func (u StatsScopeUnit) DateFormat() string
DateFormat returns date layout format of a scope unit.
func (StatsScopeUnit) SQLDateFormat ¶
func (u StatsScopeUnit) SQLDateFormat() string
SQLDateFormat returns date SQL format of a scope unit.
type User ¶
type User struct { ID ID `json:"id" gorm:"primaryKey;type:CHAR(20)"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Email string `json:"email"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
User represents user account information.
type UserCreateParam ¶
type UserCreateParam struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` Email string `json:"email"` }
UserCreateParam represents user params for create operation.
type UserFilter ¶
type UserFilter struct { ID ID `db:"id,omitempty"` FirstName string `db:"first_name,omitempty"` LastName string `db:"last_name,omitempty"` Email string `db:"email,omitempty"` }
UserFilter represents search filter for user list.
type VerifyParams ¶
VerifyParams represents parameters to verify an account.
type Webhook ¶
type Webhook struct { ID ID `json:"id" gorm:"primaryKey;type:CHAR(20)"` UserID ID `json:"user_id"` PayloadURL string `json:"payload_url"` Secret string `json:"secret"` Active *bool `json:"active"` LastRespCode int `json:"last_resp_code"` LastUsed *time.Time `json:"last_used"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Webhook represents user webhook for message updates. Sends POST request to registered payload url.
type WebhookCreateParam ¶
type WebhookCreateParam struct { UserID ID `json:"user_id"` PayloadURL string `json:"payload_url"` Secret string `json:"secret"` Active *bool `json:"active,omitempty"` }
WebhookCreateParam represents parameters to create webhook.
type WebhookDeleteParam ¶
WebhookDeleteParam represents parameters to delete webhook.
type WebhookFilter ¶
type WebhookFilter struct { ID ID `db:"id,omitempty"` UserID ID `db:"user_id,omitempty"` PayloadURL string `db:"payload_url,omitempty"` Secret string `db:"secret,omitempty"` Active *bool `db:"active,omitempty"` LastRespCode int `db:"last_resp_code,omitempty"` }
WebhookFilter represents webhook query filter.