Versions in this module Expand all Collapse all v1 v1.5.1 Mar 3, 2020 Changes in this version + const ActionNotAllowed + const BatchSizeTooLarge + const HeaderStatus + const HeaderStatusMessage + const InvalidCallbackURL + const InvalidTokenError + const MultipleSourceNameErr + const NotFoundError + const ServerError + const TableLoginSession + const TableModes + const TableRetries + const TableRoles + const TableSources + const TableSubscriptions + const TableUser + const TableWebhooks + const UserIsInvalidErr + const WrongInputFormatError + const WrongIntegerFormat + const WrongLength + func GetAllSessionTokens(db *dbhelper.DBhelper) ([]string, error) + func GetDefaultConfig() string + func InsertUser(db *dbhelper.DBhelper, username, password, ip string) error + func LogError(err error, context ...map[string]interface{}) bool + func LoginQuery(db *dbhelper.DBhelper, username, password, ip string) (string, bool, error) + func NotifyAllSubscriber(db *dbhelper.DBhelper, config *ConfigStruct, webhook *Webhook, source *Source, ...) + func RemoveSubscriptionByPK(db *dbhelper.DBhelper, pk uint32) error + func SubscriptionExists(db *dbhelper.DBhelper, sourceID uint32, callbackURL string) (bool, error) + func UserExists(db *dbhelper.DBhelper, username string) (bool, error) + type ConfigStruct struct + Server configServer + Webserver struct{ ... } + func InitConfig(confFile string, createMode bool) (*ConfigStruct, bool) + func (config *ConfigStruct) Check() bool + func (config *ConfigStruct) LoadInfo() + type CredentialRequest struct + Password string + Username string + type ListSourcesResponse struct + Sources []Source + type LoginResponse struct + Token string + type LoginSession struct + Created time.Time + IsValid bool + LastAccessed time.Time + PkID uint32 + Token string + User User + UserID uint32 + func (session *LoginSession) Insert(db *dbhelper.DBhelper) error + func (session LoginSession) UpdateLastAccessedByToken(db *dbhelper.DBhelper) + type NotifyCallback interface + OnError func(Subscription, Source, Webhook) + OnSuccess func(Subscription) + OnUnsubscribe func(Subscription) + type ResponseStatus uint8 + const ResponseError + const ResponseSuccess + type Retry struct + NextRetry time.Time + PKid uint32 + SourcePK uint32 + TryNr uint8 + WebhookPK uint32 + func NewRetry(db *dbhelper.DBhelper, sourcePK, webhookPk uint32, nextRetryTime time.Time) (*Retry, error) + func (retry *Retry) UpdateNext(db *dbhelper.DBhelper) error + func (retry Retry) Delete(db *dbhelper.DBhelper) error + type Role struct + IsAdmin bool + MaxHookCalls int + MaxPrivSources int + MaxPubSources int + MaxSubscriptions int + MaxTraffic int + Name string + PkID uint32 + type Source struct + CreationTime time.Time + Creator User + CreatorID uint32 + Description string + IsPrivate bool + Mode uint8 + Name string + PkID uint32 + Secret string + SourceID string + func GetSourceByPK(db *dbhelper.DBhelper, pkID uint32) (*Source, error) + func GetSourceFromSourceID(db *dbhelper.DBhelper, sourceID string) (*Source, error) + func GetSourcesForUser(db *dbhelper.DBhelper, userID uint32) ([]Source, error) + func (source *Source) Delete(db *dbhelper.DBhelper) error + func (source *Source) Insert(db *dbhelper.DBhelper) error + func (source *Source) Update(db *dbhelper.DBhelper, field, newText string, arg ...bool) error + type SourceAddRequest struct + Description string + Mode uint8 + Name string + Private bool + type SourceAddResponse struct + Secret string + SourceID string + type SourceRequest struct + Content string + SourceID string + type SubscriberNotifyCallback interface + OnWebhookReceive func(*Webhook, *Source) + type Subscription struct + CallbackURL string + IsValid bool + LastTrigger string + PkID uint32 + Source uint32 + SubscriptionID string + Time time.Time + UserID uint32 + func GetSubscriptionByPK(db *dbhelper.DBhelper, pkID uint32) (*Subscription, error) + func GetSubscriptionBySubsID(db *dbhelper.DBhelper, subscriptionID string) (*Subscription, error) + func (subscription *Subscription) Insert(db *dbhelper.DBhelper) error + func (subscription *Subscription) Notify(db *dbhelper.DBhelper, webhook *Webhook, source *Source, ...) (*http.Response, error) + func (subscription *Subscription) Trigger(db *dbhelper.DBhelper) + func (subscription *Subscription) TriggerAndValidate(db *dbhelper.DBhelper) error + func (subscription *Subscription) UpdateCallback(db *dbhelper.DBhelper, newCallback string) error + func (subscription Subscription) Remove(db *dbhelper.DBhelper) error + type SubscriptionRequest struct + CallbackURL string + SourceID string + type SubscriptionResponse struct + Message string + Mode uint8 + Name string + SubscriptionID string + type SubscriptionUpdateCallbackRequest struct + CallbackURL string + SubscriptionID string + type UnsubscribeRequest struct + SubscriptionID string + type User struct + CreatedAt time.Time + HookCalls uint32 + IP string + IsValid bool + Password string + Pkid uint32 + ResetIndex uint16 + Role Role + RoleID uint32 + Traffic uint32 + Username string + func GetUserByPK(db *dbhelper.DBhelper, pkID uint32) (*User, error) + func GetUserBySession(db *dbhelper.DBhelper, token string) (*User, error) + func (user *User) AddHookCall(db *dbhelper.DBhelper, addTraffic uint32) error + func (user *User) GetSourceCount(db *dbhelper.DBhelper, private bool) (uint, error) + func (user *User) GetSubscriptionCount(db *dbhelper.DBhelper) (uint32, error) + func (user *User) HasSourceWithName(db *dbhelper.DBhelper, name string) (bool, error) + func (user *User) IsSubscribedTo(db *dbhelper.DBhelper, sourceID uint32) (bool, error) + func (user *User) UpdateIP(db *dbhelper.DBhelper, ip string) error + func (user User) CanCreateSource(private bool) bool + func (user User) CanShareWebhooks() bool + func (user User) CanSubscribe() bool + func (user User) HasUnlimitedHookCalls() bool + func (user User) IsAdmin() bool + func (user User) IsSourceLimitReached(db *dbhelper.DBhelper, private bool) (bool, error) + func (user User) IsSubscriptionLimitReached(db *dbhelper.DBhelper) (bool, error) + type Webhook struct + Headers string + Payload string + PkID uint32 + Received time.Time + SourceID uint32 + func GetWebhookByPK(db *dbhelper.DBhelper, webhookID uint32) (*Webhook, error) + func (webhook *Webhook) Insert(db *dbhelper.DBhelper) error