Documentation ¶
Index ¶
- Constants
- Variables
- func IsValidPeriod(period string) bool
- func IsValidPointer(i interface{}) bool
- type APIKey
- type APIKeyRepository
- type AlertConfiguration
- type ApiKey
- type AppMap
- type AppMetadata
- type Application
- type ApplicationRepository
- type BasicAuth
- type Configuration
- type ConfigurationRepository
- type DatabaseClient
- type DeliveryAttempt
- type DocumentStatus
- type EncodingType
- type Endpoint
- type EndpointMap
- type Event
- type EventDelivery
- type EventDeliveryRepository
- type EventDeliveryStatus
- type EventInterval
- type EventIntervalData
- type EventMap
- type EventRepository
- type EventType
- type Filter
- type FilterConfiguration
- type Group
- type GroupConfig
- type GroupFilter
- type GroupRepository
- type GroupStatistics
- type GroupType
- type HMac
- type HttpHeader
- type InviteStatus
- type KeyType
- type Metadata
- type Organisation
- type OrganisationInvite
- type OrganisationInviteRepository
- type OrganisationMember
- type OrganisationMemberRepository
- type OrganisationRepository
- type Pageable
- type PaginationData
- type Password
- type Period
- type RateLimitConfiguration
- type RetryConfiguration
- type SearchParams
- type SignatureConfiguration
- type SignatureValues
- type Source
- type SourceFilter
- type SourceMap
- type SourceProvider
- type SourceRepository
- type SourceType
- type Store
- type StrategyConfiguration
- type StrategyProvider
- type Subscription
- type SubscriptionRepository
- type SubscriptionStatus
- type User
- type UserMetadata
- type UserRepository
- type VerifierConfig
- type VerifierType
Constants ¶
View Source
const ( DefaultStrategyProvider = LinearStrategyProvider LinearStrategyProvider = "linear" ExponentialStrategyProvider = "exponential" )
Variables ¶
View Source
var ( DefaultStrategyConfig = StrategyConfiguration{ Type: "linear", Duration: 100, RetryCount: 10, } DefaultSignatureConfig = SignatureConfiguration{ Header: "X-Convoy-Signature", Hash: "SHA256", } DefaultRateLimitConfig = RateLimitConfiguration{ Count: 1000, Duration: "1m", } DefaultRetryConfig = RetryConfiguration{ Type: LinearStrategyProvider, Duration: "10s", RetryCount: 3, } DefaultAlertConfig = AlertConfiguration{ Count: 4, Threshold: "1h", } )
View Source
var ( ErrUserNotFound = errors.New("user not found") ErrSourceNotFound = errors.New("source not found") ErrEventNotFound = errors.New("event not found") ErrGroupNotFound = errors.New("group not found") ErrAPIKeyNotFound = errors.New("api key not found") ErrEndpointNotFound = errors.New("endpoint not found") ErrApplicationNotFound = errors.New("application not found") ErrSubscriptionNotFound = errors.New("subscription not found") ErrEventDeliveryNotFound = errors.New("event delivery not found") ErrEventDeliveryAttemptNotFound = errors.New("event delivery attempt not found") ErrDuplicateAppName = errors.New("an application with this name exists") ErrNotAuthorisedToAccessDocument = errors.New("your credentials cannot access or modify this resource") ErrConfigNotFound = errors.New("config not found") ErrDuplicateGroupName = errors.New("a group with this name already exists") )
View Source
var (
ErrInvalidPtr = errors.New("out param is not a valid pointer")
)
View Source
var ErrOrgInviteNotFound = errors.New("organisation invite not found")
View Source
var ErrOrgMemberNotFound = errors.New("organisation member not found")
View Source
var ErrOrgNotFound = errors.New("organisation not found")
Functions ¶
func IsValidPeriod ¶
func IsValidPointer ¶ added in v0.6.0
func IsValidPointer(i interface{}) bool
Types ¶
type APIKey ¶
type APIKey struct { ID primitive.ObjectID `json:"-" bson:"_id"` UID string `json:"uid" bson:"uid"` MaskID string `json:"mask_id,omitempty" bson:"mask_id"` Name string `json:"name" bson:"name"` Role auth.Role `json:"role" bson:"role"` Hash string `json:"hash,omitempty" bson:"hash"` Salt string `json:"salt,omitempty" bson:"salt"` Type KeyType `json:"key_type" bson:"key_type"` ExpiresAt primitive.DateTime `json:"expires_at,omitempty" bson:"expires_at,omitempty"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at"` DocumentStatus DocumentStatus `json:"-" bson:"document_status"` }
type APIKeyRepository ¶
type APIKeyRepository interface { CreateAPIKey(context.Context, *APIKey) error UpdateAPIKey(context.Context, *APIKey) error FindAPIKeyByID(context.Context, string) (*APIKey, error) FindAPIKeyByMaskID(context.Context, string) (*APIKey, error) FindAPIKeyByHash(context.Context, string) (*APIKey, error) RevokeAPIKeys(context.Context, []string) error LoadAPIKeysPaged(context.Context, *Pageable) ([]APIKey, PaginationData, error) }
type AlertConfiguration ¶ added in v0.6.0
type AppMap ¶ added in v0.6.0
type AppMap map[string]*Application
type AppMetadata ¶
type Application ¶
type Application struct { ID primitive.ObjectID `json:"-" bson:"_id"` UID string `json:"uid" bson:"uid"` GroupID string `json:"group_id" bson:"group_id"` Title string `json:"name" bson:"title"` SupportEmail string `json:"support_email" bson:"support_email"` SlackWebhookURL string `json:"slack_webhook_url,omitempty" bson:"slack_webhook_url"` IsDisabled bool `json:"is_disabled,omitempty" bson:"is_disabled"` Endpoints []Endpoint `json:"endpoints,omitempty" bson:"endpoints"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty" swaggertype:"string"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at,omitempty" swaggertype:"string"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at,omitempty" swaggertype:"string"` Events int64 `json:"events,omitempty" bson:"-"` DocumentStatus DocumentStatus `json:"-" bson:"document_status"` }
type ApplicationRepository ¶
type ApplicationRepository interface { CreateApplication(context.Context, *Application, string) error LoadApplicationsPaged(context.Context, string, string, Pageable) ([]Application, PaginationData, error) FindApplicationByID(context.Context, string) (*Application, error) UpdateApplication(context.Context, *Application, string) error DeleteApplication(context.Context, *Application) error CountGroupApplications(ctx context.Context, groupID string) (int64, error) DeleteGroupApps(context.Context, string) error LoadApplicationsPagedByGroupId(context.Context, string, Pageable) ([]Application, PaginationData, error) SearchApplicationsByGroupId(context.Context, string, SearchParams) ([]Application, error) FindApplicationEndpointByID(context.Context, string, string) (*Endpoint, error) CreateApplicationEndpoint(context.Context, string, string, *Endpoint) error }
type Configuration ¶ added in v0.6.0
type Configuration struct { ID primitive.ObjectID `json:"-" bson:"_id"` UID string `json:"uid" bson:"uid"` IsAnalyticsEnabled bool `json:"is_analytics_enabled" bson:"is_analytics_enabled"` DocumentStatus DocumentStatus `json:"-" bson:"document_status"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty" swaggertype:"string"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at,omitempty" swaggertype:"string"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at,omitempty" swaggertype:"string"` }
type ConfigurationRepository ¶ added in v0.6.0
type ConfigurationRepository interface { CreateConfiguration(context.Context, *Configuration) error LoadConfiguration(context.Context) (*Configuration, error) UpdateConfiguration(context.Context, *Configuration) error }
type DatabaseClient ¶
type DatabaseClient interface { GetName() string Client() interface{} Disconnect(context.Context) error APIRepo() APIKeyRepository GroupRepo() GroupRepository EventRepo() EventRepository AppRepo() ApplicationRepository SubRepo() SubscriptionRepository EventDeliveryRepo() EventDeliveryRepository SourceRepo() SourceRepository OrganisationRepo() OrganisationRepository OrganisationMemberRepo() OrganisationMemberRepository OrganisationInviteRepo() OrganisationInviteRepository UserRepo() UserRepository ConfigurationRepo() ConfigurationRepository }
type DeliveryAttempt ¶
type DeliveryAttempt struct { ID primitive.ObjectID `json:"-" bson:"_id"` UID string `json:"uid" bson:"uid"` MsgID string `json:"msg_id" bson:"msg_id"` URL string `json:"url" bson:"url"` Method string `json:"method" bson:"method"` EndpointID string `json:"endpoint_id" bson:"endpoint_id"` APIVersion string `json:"api_version" bson:"api_version"` IPAddress string `json:"ip_address,omitempty" bson:"ip_address,omitempty"` RequestHeader HttpHeader `json:"request_http_header,omitempty" bson:"request_http_header,omitempty"` ResponseHeader HttpHeader `json:"response_http_header,omitempty" bson:"response_http_header,omitempty"` HttpResponseCode string `json:"http_status,omitempty" bson:"http_status,omitempty"` ResponseData string `json:"response_data,omitempty" bson:"response_data,omitempty"` Error string `json:"error,omitempty" bson:"error,omitempty"` Status bool `json:"status,omitempty" bson:"status,omitempty"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty" swaggertype:"string"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at,omitempty" swaggertype:"string"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at,omitempty" swaggertype:"string"` }
type DocumentStatus ¶
type DocumentStatus string
const ( ActiveDocumentStatus DocumentStatus = "Active" InactiveDocumentStatus DocumentStatus = "Inactive" DeletedDocumentStatus DocumentStatus = "Deleted" )
type EncodingType ¶ added in v0.6.0
type EncodingType string
const ( Base64Encoding EncodingType = "base64" HexEncoding EncodingType = "hex" )
type Endpoint ¶
type Endpoint struct { UID string `json:"uid" bson:"uid"` TargetURL string `json:"target_url" bson:"target_url"` Description string `json:"description" bson:"description"` Secret string `json:"secret" bson:"secret"` HttpTimeout string `json:"http_timeout" bson:"http_timeout"` RateLimit int `json:"rate_limit" bson:"rate_limit"` RateLimitDuration string `json:"rate_limit_duration" bson:"rate_limit_duration"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty" swaggertype:"string"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at,omitempty" swaggertype:"string"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at,omitempty" swaggertype:"string"` DocumentStatus DocumentStatus `json:"-" bson:"document_status"` }
type EndpointMap ¶ added in v0.6.0
type Event ¶
type Event struct { ID primitive.ObjectID `json:"-" bson:"_id"` UID string `json:"uid" bson:"uid"` EventType EventType `json:"event_type" bson:"event_type"` MatchedEndpoints int `json:"matched_endpoints" bson:"matched_enpoints"` // TODO(all) remove this field // ProviderID is a custom ID that can be used to reconcile this Event // with your internal systems. // This is optional // If not provided, we will generate one for you ProviderID string `json:"provider_id,omitempty" bson:"provider_id"` SourceID string `json:"source_id,omitempty" bson:"source_id"` GroupID string `json:"group_id,omitempty" bson:"group_id"` AppID string `json:"app_id,omitempty" bson:"app_id"` App *Application `json:"app_metadata,omitempty" bson:"-"` // Data is an arbitrary JSON value that gets sent as the body of the // webhook to the endpoints Data json.RawMessage `json:"data,omitempty" bson:"data"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty" swaggertype:"string"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at,omitempty" swaggertype:"string"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at,omitempty" swaggertype:"string"` DocumentStatus DocumentStatus `json:"-" bson:"document_status"` }
Event defines a payload to be sent to an application
type EventDelivery ¶
type EventDelivery struct { ID primitive.ObjectID `json:"-" bson:"_id"` UID string `json:"uid" bson:"uid"` AppID string `json:"app_id,omitempty" bson:"app_id"` GroupID string `json:"group_id,omitempty" bson:"group_id"` EventID string `json:"event_id,omitempty" bson:"event_id"` EndpointID string `json:"endpoint_id,omitempty" bson:"endpoint_id"` SubscriptionID string `json:"subscription_id,omitempty" bson:"subscription_id"` Event *Event `json:"event_metadata,omitempty" bson:"-"` Endpoint *Endpoint `json:"endpoint_metadata,omitempty" bson:"-"` App *Application `json:"app_metadata,omitempty" bson:"-"` DeliveryAttempts []DeliveryAttempt `json:"-" bson:"attempts"` Status EventDeliveryStatus `json:"status" bson:"status"` Metadata *Metadata `json:"metadata" bson:"metadata"` Description string `json:"description,omitempty" bson:"description"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty" swaggertype:"string"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at,omitempty" swaggertype:"string"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at,omitempty" swaggertype:"string"` DocumentStatus DocumentStatus `json:"-" bson:"document_status"` }
Event defines a payload to be sent to an application
type EventDeliveryRepository ¶
type EventDeliveryRepository interface { CreateEventDelivery(context.Context, *EventDelivery) error FindEventDeliveryByID(context.Context, string) (*EventDelivery, error) FindEventDeliveriesByIDs(context.Context, []string) ([]EventDelivery, error) FindEventDeliveriesByEventID(context.Context, string) ([]EventDelivery, error) CountDeliveriesByStatus(context.Context, EventDeliveryStatus, SearchParams) (int64, error) UpdateStatusOfEventDelivery(context.Context, EventDelivery, EventDeliveryStatus) error UpdateStatusOfEventDeliveries(context.Context, []string, EventDeliveryStatus) error UpdateEventDeliveryWithAttempt(context.Context, EventDelivery, DeliveryAttempt) error CountEventDeliveries(context.Context, string, string, string, []EventDeliveryStatus, SearchParams) (int64, error) LoadEventDeliveriesPaged(context.Context, string, string, string, []EventDeliveryStatus, SearchParams, Pageable) ([]EventDelivery, PaginationData, error) }
type EventDeliveryStatus ¶
type EventDeliveryStatus string
const ( // ScheduledEventStatus : when a Event has been scheduled for delivery ScheduledEventStatus EventDeliveryStatus = "Scheduled" ProcessingEventStatus EventDeliveryStatus = "Processing" DiscardedEventStatus EventDeliveryStatus = "Discarded" FailureEventStatus EventDeliveryStatus = "Failure" SuccessEventStatus EventDeliveryStatus = "Success" RetryEventStatus EventDeliveryStatus = "Retry" )
func (EventDeliveryStatus) IsValid ¶ added in v0.4.10
func (e EventDeliveryStatus) IsValid() bool
type EventInterval ¶
type EventInterval struct { Data EventIntervalData `json:"data" bson:"_id"` Count uint64 `json:"count" bson:"count"` }
type EventIntervalData ¶
type EventRepository ¶
type EventRepository interface { CreateEvent(context.Context, *Event) error LoadEventIntervals(context.Context, string, SearchParams, Period, int) ([]EventInterval, error) FindEventByID(ctx context.Context, id string) (*Event, error) FindEventsByIDs(context.Context, []string) ([]Event, error) CountGroupMessages(ctx context.Context, groupID string) (int64, error) LoadEventsPaged(context.Context, string, string, SearchParams, Pageable) ([]Event, PaginationData, error) DeleteGroupEvents(context.Context, string) error }
type EventType ¶
type EventType string
EventType is used to identify an specific event. This could be "user.new" This will be used for data indexing Makes it easy to filter by a list of events
type Filter ¶ added in v0.5.0
type Filter struct { Query string Group *Group AppID string EventID string Pageable Pageable Status []EventDeliveryStatus SearchParams SearchParams }
type FilterConfiguration ¶ added in v0.6.0
type FilterConfiguration struct {
EventTypes []string `json:"event_types" bson:"event_types,omitempty"`
}
type Group ¶
type Group struct { ID primitive.ObjectID `json:"-" bson:"_id"` UID string `json:"uid" bson:"uid"` Name string `json:"name" bson:"name"` LogoURL string `json:"logo_url" bson:"logo_url"` OrganisationID string `json:"organisation_id" bson:"organisation_id"` Type GroupType `json:"type" bson:"type"` Config *GroupConfig `json:"config" bson:"config"` Statistics *GroupStatistics `json:"statistics" bson:"-"` // TODO(subomi): refactor this into the Instance API. RateLimit int `json:"rate_limit" bson:"rate_limit"` RateLimitDuration string `json:"rate_limit_duration" bson:"rate_limit_duration"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty" swaggertype:"string"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at,omitempty" swaggertype:"string"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at,omitempty" swaggertype:"string"` DocumentStatus DocumentStatus `json:"-" bson:"document_status"` }
func (*Group) IsOwner ¶
func (o *Group) IsOwner(a *Application) bool
type GroupConfig ¶
type GroupConfig struct { RateLimit *RateLimitConfiguration `json:"ratelimit"` Strategy *StrategyConfiguration `json:"strategy"` Signature *SignatureConfiguration `json:"signature"` DisableEndpoint bool `json:"disable_endpoint" bson:"disable_endpoint"` ReplayAttacks bool `json:"replay_attacks" bson:"replay_attacks"` }
type GroupFilter ¶
type GroupFilter struct { OrgID string `json:"org_id" bson:"org_id"` Names []string `json:"name" bson:"name"` }
func (*GroupFilter) ToGenericMap ¶ added in v0.6.0
func (g *GroupFilter) ToGenericMap() map[string]interface{}
func (*GroupFilter) WithNamesTrimmed ¶ added in v0.5.3
func (g *GroupFilter) WithNamesTrimmed() *GroupFilter
type GroupRepository ¶
type GroupRepository interface { LoadGroups(context.Context, *GroupFilter) ([]*Group, error) CreateGroup(context.Context, *Group) error UpdateGroup(context.Context, *Group) error DeleteGroup(ctx context.Context, uid string) error FetchGroupByID(context.Context, string) (*Group, error) FetchGroupsByIDs(context.Context, []string) ([]Group, error) FillGroupsStatistics(ctx context.Context, groups []*Group) error }
type GroupStatistics ¶
type HMac ¶ added in v0.6.0
type HMac struct { Header string `json:"header" bson:"header" valid:"required"` Hash string `json:"hash" bson:"hash" valid:"supported_hash,required"` Secret string `json:"secret" bson:"secret" valid:"required"` Encoding EncodingType `json:"encoding" bson:"encoding" valid:"supported_encoding~please provide a valid encoding type,required"` }
type HttpHeader ¶
type InviteStatus ¶ added in v0.6.0
type InviteStatus string
const ( InviteStatusAccepted InviteStatus = "accepted" InviteStatusDeclined InviteStatus = "declined" InviteStatusPending InviteStatus = "pending" InviteStatusCancelled InviteStatus = "cancelled" )
func (InviteStatus) String ¶ added in v0.6.0
func (i InviteStatus) String() string
type Metadata ¶
type Metadata struct { // Data to be sent to endpoint. Data json.RawMessage `json:"data" bson:"data"` Strategy StrategyProvider `json:"strategy" bson:"strategy"` // NextSendTime denotes the next time a Event will be published in // case it failed the first time NextSendTime primitive.DateTime `json:"next_send_time" bson:"next_send_time"` // NumTrials: number of times we have tried to deliver this Event to // an application NumTrials uint64 `json:"num_trials" bson:"num_trials"` IntervalSeconds uint64 `json:"interval_seconds" bson:"interval_seconds"` RetryLimit uint64 `json:"retry_limit" bson:"retry_limit"` }
type Organisation ¶ added in v0.6.0
type Organisation struct { ID primitive.ObjectID `json:"-" bson:"_id"` UID string `json:"uid" bson:"uid"` OwnerID string `json:"-" bson:"owner_id"` Name string `json:"name" bson:"name"` DocumentStatus DocumentStatus `json:"-" bson:"document_status"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty" swaggertype:"string"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at,omitempty" swaggertype:"string"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at,omitempty" swaggertype:"string"` }
type OrganisationInvite ¶ added in v0.6.0
type OrganisationInvite struct { ID primitive.ObjectID `json:"-" bson:"_id"` UID string `json:"uid" bson:"uid"` OrganisationID string `json:"organisation_id" bson:"organisation_id"` InviteeEmail string `json:"invitee_email" bson:"invitee_email"` Token string `json:"token" bson:"token"` Role auth.Role `json:"role" bson:"role"` Status InviteStatus `json:"status" bson:"status"` DocumentStatus DocumentStatus `json:"-" bson:"document_status"` ExpiresAt primitive.DateTime `json:"-" bson:"expires_at"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty" swaggertype:"string"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at,omitempty" swaggertype:"string"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at,omitempty" swaggertype:"string"` }
type OrganisationInviteRepository ¶ added in v0.6.0
type OrganisationInviteRepository interface { LoadOrganisationsInvitesPaged(ctx context.Context, orgID string, inviteStatus InviteStatus, pageable Pageable) ([]OrganisationInvite, PaginationData, error) CreateOrganisationInvite(ctx context.Context, iv *OrganisationInvite) error UpdateOrganisationInvite(ctx context.Context, iv *OrganisationInvite) error DeleteOrganisationInvite(ctx context.Context, uid string) error FetchOrganisationInviteByID(ctx context.Context, uid string) (*OrganisationInvite, error) FetchOrganisationInviteByToken(ctx context.Context, token string) (*OrganisationInvite, error) }
type OrganisationMember ¶ added in v0.6.0
type OrganisationMember struct { ID primitive.ObjectID `json:"-" bson:"_id"` UID string `json:"uid" bson:"uid"` OrganisationID string `json:"organisation_id" bson:"organisation_id"` UserID string `json:"user_id" bson:"user_id"` Role auth.Role `json:"role" bson:"role"` UserMetadata *UserMetadata `json:"user_metadata" bson:"-"` DocumentStatus DocumentStatus `json:"-" bson:"document_status"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty" swaggertype:"string"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at,omitempty" swaggertype:"string"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at,omitempty" swaggertype:"string"` }
type OrganisationMemberRepository ¶ added in v0.6.0
type OrganisationMemberRepository interface { LoadOrganisationMembersPaged(ctx context.Context, organisationID string, pageable Pageable) ([]*OrganisationMember, PaginationData, error) LoadUserOrganisationsPaged(ctx context.Context, userID string, pageable Pageable) ([]Organisation, PaginationData, error) CreateOrganisationMember(ctx context.Context, member *OrganisationMember) error UpdateOrganisationMember(ctx context.Context, member *OrganisationMember) error DeleteOrganisationMember(ctx context.Context, memberID string, orgID string) error FetchOrganisationMemberByID(ctx context.Context, memberID string, organisationID string) (*OrganisationMember, error) FetchOrganisationMemberByUserID(ctx context.Context, userID string, organisationID string) (*OrganisationMember, error) }
type OrganisationRepository ¶ added in v0.6.0
type OrganisationRepository interface { LoadOrganisationsPaged(context.Context, Pageable) ([]Organisation, PaginationData, error) CreateOrganisation(context.Context, *Organisation) error UpdateOrganisation(context.Context, *Organisation) error DeleteOrganisation(context.Context, string) error FetchOrganisationByID(context.Context, string) (*Organisation, error) }
type PaginationData ¶
type Password ¶ added in v0.6.0
func (*Password) GenerateHash ¶ added in v0.6.0
type RateLimitConfiguration ¶ added in v0.6.0
type RetryConfiguration ¶ added in v0.6.0
type RetryConfiguration struct { Type config.StrategyProvider `json:"type,omitempty" bson:"type,omitempty" valid:"supported_retry_strategy~please provide a valid retry strategy type"` Duration string `json:"duration,omitempty" bson:"duration,omitempty" valid:"duration~please provide a valid time duration"` RetryCount int `json:"retry_count" bson:"retry_count" valid:"int~please provide a valid retry count"` }
type SearchParams ¶
type SignatureConfiguration ¶
type SignatureConfiguration struct { Header config.SignatureHeaderProvider `json:"header,omitempty" valid:"required~please provide a valid signature header"` Hash string `json:"hash,omitempty" valid:"required~please provide a valid hash,supported_hash~unsupported hash type"` }
type SignatureValues ¶ added in v0.5.3
type SignatureValues struct { Header config.SignatureHeaderProvider `json:"header" valid:"required~please provide a valid signature header"` Hash string `json:"hash" valid:"required~please provide a valid hash,supported_hash~unsupported hash type"` }
type Source ¶ added in v0.6.0
type Source struct { ID primitive.ObjectID `json:"-" bson:"_id"` UID string `json:"uid" bson:"uid"` GroupID string `json:"group_id" bson:"group_id"` MaskID string `json:"mask_id" bson:"mask_id"` Name string `json:"name" bson:"name"` Type SourceType `json:"type" bson:"type"` Provider SourceProvider `json:"provider" bson:"provider"` IsDisabled bool `json:"is_disabled" bson:"is_disabled"` Verifier *VerifierConfig `json:"verifier" bson:"verifier"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at" swaggertype:"string"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at" swaggertype:"string"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at" swaggertype:"string"` DocumentStatus DocumentStatus `json:"-" bson:"document_status"` }
type SourceFilter ¶ added in v0.6.0
type SourceFilter struct {
Type string
}
type SourceProvider ¶ added in v0.6.0
type SourceProvider string
const (
GithubSourceProvider SourceProvider = "github"
)
type SourceRepository ¶ added in v0.6.0
type SourceRepository interface { CreateSource(context.Context, *Source) error UpdateSource(ctx context.Context, groupID string, source *Source) error FindSourceByID(ctx context.Context, groupID string, id string) (*Source, error) FindSourceByMaskID(ctx context.Context, maskID string) (*Source, error) DeleteSourceByID(ctx context.Context, groupID string, id string) error LoadSourcesPaged(ctx context.Context, groupID string, filter *SourceFilter, pageable Pageable) ([]Source, PaginationData, error) }
type SourceType ¶ added in v0.6.0
type SourceType string
const ( HTTPSource SourceType = "http" RestApiSource SourceType = "rest_api" PubSubSource SourceType = "pub_sub" DBChangeStream SourceType = "db_change_stream" )
type Store ¶ added in v0.6.0
type Store interface { Save(ctx context.Context, payload interface{}, result interface{}) error SaveMany(ctx context.Context, payload []interface{}) error FindByID(ctx context.Context, id string, projection bson.M, result interface{}) error FindOne(ctx context.Context, filter, projection bson.M, result interface{}) error FindMany(ctx context.Context, filter, projection bson.M, sort interface{}, limit, skip int64, results interface{}) error FindManyWithDeletedAt(ctx context.Context, filter, projection bson.M, sort interface{}, limit, skip int64, results interface{}) error FindAll(ctx context.Context, filter bson.M, sort interface{}, projection, results interface{}) error UpdateByID(ctx context.Context, id string, payload interface{}) error UpdateOne(ctx context.Context, filter bson.M, payload interface{}) error UpdateMany(ctx context.Context, filter, payload bson.M) error Inc(ctx context.Context, filter bson.M, payload interface{}) error DeleteByID(ctx context.Context, id string) error DeleteOne(ctx context.Context, filter bson.M) error Count(ctx context.Context, filter map[string]interface{}) (int64, error) Aggregate(ctx context.Context, pipeline mongo.Pipeline, result interface{}, allowDiskUse bool) error }
type StrategyConfiguration ¶
type StrategyConfiguration struct { Type StrategyProvider `json:"type" valid:"required~please provide a valid strategy type, in(linear|exponential)~unsupported strategy type"` Duration uint64 `json:"duration" valid:"required~please provide a valid duration in seconds,int"` RetryCount uint64 `json:"retry_count" valid:"required~please provide a valid retry count,int"` }
type StrategyProvider ¶ added in v0.6.0
type StrategyProvider string
type Subscription ¶ added in v0.6.0
type Subscription struct { ID primitive.ObjectID `json:"-" bson:"_id"` UID string `json:"uid" bson:"uid"` Name string `json:"name" bson:"name"` Type string `json:"type" bson:"type"` Status SubscriptionStatus `json:"status" bson:"status"` AppID string `json:"-" bson:"app_id"` GroupID string `json:"-" bson:"group_id"` SourceID string `json:"-" bson:"source_id"` EndpointID string `json:"-" bson:"endpoint_id"` Source *Source `json:"source_metadata,omitempty" bson:"-"` Endpoint *Endpoint `json:"endpoint_metadata,omitempty" bson:"-"` App *Application `json:"app_metadata,omitempty" bson:"-"` // subscription config AlertConfig *AlertConfiguration `json:"alert_config,omitempty" bson:"alert_config,omitempty"` RetryConfig *RetryConfiguration `json:"retry_config,omitempty" bson:"retry_config,omitempty"` FilterConfig *FilterConfiguration `json:"filter_config,omitempty" bson:"filter_config,omitempty"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at" swaggertype:"string"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at" swaggertype:"string"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at" swaggertype:"string"` DocumentStatus DocumentStatus `json:"-" bson:"document_status"` }
type SubscriptionRepository ¶ added in v0.6.0
type SubscriptionRepository interface { CreateSubscription(context.Context, string, *Subscription) error UpdateSubscription(context.Context, string, *Subscription) error LoadSubscriptionsPaged(context.Context, string, Pageable) ([]Subscription, PaginationData, error) DeleteSubscription(context.Context, string, *Subscription) error FindSubscriptionByID(context.Context, string, string) (*Subscription, error) FindSubscriptionsByEventType(context.Context, string, string, EventType) ([]Subscription, error) FindSubscriptionsBySourceIDs(context.Context, string, string) ([]Subscription, error) FindSubscriptionsByAppID(ctx context.Context, groupId string, appID string) ([]Subscription, error) UpdateSubscriptionStatus(context.Context, string, string, SubscriptionStatus) error }
type SubscriptionStatus ¶ added in v0.6.0
type SubscriptionStatus string
const ( ActiveSubscriptionStatus SubscriptionStatus = "active" InactiveSubscriptionStatus SubscriptionStatus = "inactive" PendingSubscriptionStatus SubscriptionStatus = "pending" )
type User ¶ added in v0.6.0
type User struct { ID primitive.ObjectID `json:"-" bson:"_id"` UID string `json:"uid" bson:"uid"` FirstName string `json:"first_name" bson:"first_name"` LastName string `json:"last_name" bson:"last_name"` Email string `json:"email" bson:"email"` Password string `json:"-" bson:"password"` Role auth.Role `json:"role" bson:"role"` ResetPasswordToken string `json:"-" bson:"reset_password_token"` CreatedAt primitive.DateTime `json:"created_at,omitempty" bson:"created_at,omitempty" swaggertype:"string"` UpdatedAt primitive.DateTime `json:"updated_at,omitempty" bson:"updated_at,omitempty" swaggertype:"string"` DeletedAt primitive.DateTime `json:"deleted_at,omitempty" bson:"deleted_at,omitempty" swaggertype:"string"` ResetPasswordExpiresAt primitive.DateTime `json:"reset_password_expires_at,omitempty" bson:"reset_password_expires_at,omitempty" swaggertype:"string"` DocumentStatus DocumentStatus `json:"-" bson:"document_status"` }
type UserMetadata ¶ added in v0.6.0
type UserRepository ¶ added in v0.6.0
type UserRepository interface { CreateUser(context.Context, *User) error UpdateUser(ctx context.Context, user *User) error FindUserByEmail(context.Context, string) (*User, error) FindUserByID(context.Context, string) (*User, error) FindUserByToken(context.Context, string) (*User, error) LoadUsersPaged(context.Context, Pageable) ([]User, PaginationData, error) }
type VerifierConfig ¶ added in v0.6.0
type VerifierConfig struct { Type VerifierType `json:"type,omitempty" bson:"type" valid:"supported_verifier~please provide a valid verifier type,required"` HMac *HMac `json:"hmac" bson:"hmac"` BasicAuth *BasicAuth `json:"basic_auth" bson:"basic_auth"` ApiKey *ApiKey `json:"api_key" bson:"api_key"` }
type VerifierType ¶ added in v0.6.0
type VerifierType string
const ( HMacVerifier VerifierType = "hmac" BasicAuthVerifier VerifierType = "basic_auth" APIKeyVerifier VerifierType = "api_key" )
Click to show internal directories.
Click to hide internal directories.