Documentation ¶
Index ¶
- Constants
- func MustParseURL(rawURL string) *url.URL
- type APIClient
- type BroadcastEventToAll
- type BulkTriggerEvent
- type BulkTriggerOptions
- type CTA
- type Channel
- type ChannelType
- type Config
- type CreateIntegrationRequest
- type CreateTopicRequest
- type Data
- type EventRequest
- type EventResponse
- type EventService
- func (e *EventService) BroadcastToAll(ctx context.Context, data BroadcastEventToAll) (EventResponse, error)
- func (e *EventService) CancelTrigger(ctx context.Context, transactionId string) (bool, error)
- func (e *EventService) Trigger(ctx context.Context, eventId string, data ITriggerPayloadOptions) (EventResponse, error)
- func (e *EventService) TriggerBulk(ctx context.Context, data []BulkTriggerOptions) ([]EventResponse, error)
- type GeneralError
- type GetIntegrationsResponse
- type GetTopicResponse
- type IAttachmentOptions
- type IEvent
- type IIntegration
- type ISubscribers
- type ITopic
- type ITriggerPayload
- type ITriggerPayloadOptions
- type Integration
- type IntegrationCredentials
- type IntegrationResponse
- type IntegrationService
- func (i IntegrationService) Create(ctx context.Context, request CreateIntegrationRequest) (*IntegrationResponse, error)
- func (i IntegrationService) Delete(ctx context.Context, integrationId string) (*IntegrationResponse, error)
- func (i IntegrationService) GetActive(ctx context.Context) (*GetIntegrationsResponse, error)
- func (i IntegrationService) GetAll(ctx context.Context) (*GetIntegrationsResponse, error)
- func (i IntegrationService) Update(ctx context.Context, integrationId string, request UpdateIntegrationRequest) (*IntegrationResponse, error)
- type ListTopicsOptions
- type ListTopicsResponse
- type NotificationFeedData
- type Preference
- type QueryParam
- type RenameTopicRequest
- type Response
- type SubscriberMarkMessageSeenOptions
- type SubscriberNotificationFeedOptions
- type SubscriberNotificationFeedResponse
- type SubscriberPayload
- type SubscriberPreferencesResponse
- type SubscriberResponse
- type SubscriberService
- func (s *SubscriberService) Delete(ctx context.Context, subscriberID string) (SubscriberResponse, error)
- func (s *SubscriberService) Get(ctx context.Context, subscriberID string) (SubscriberResponse, error)
- func (s *SubscriberService) GetNotificationFeed(ctx context.Context, subscriberID string, ...) (*SubscriberNotificationFeedResponse, error)
- func (s *SubscriberService) GetPreferences(ctx context.Context, subscriberID string) (*SubscriberPreferencesResponse, error)
- func (s *SubscriberService) GetUnseenCount(ctx context.Context, subscriberID string, opts *SubscriberUnseenCountOptions) (*SubscriberUnseenCountResponse, error)
- func (s *SubscriberService) Identify(ctx context.Context, subscriberID string, data interface{}) (SubscriberResponse, error)
- func (s *SubscriberService) MarkMessageSeen(ctx context.Context, subscriberID string, ...) (*SubscriberNotificationFeedResponse, error)
- func (s *SubscriberService) Update(ctx context.Context, subscriberID string, data interface{}) (SubscriberResponse, error)
- func (s *SubscriberService) UpdatePreferences(ctx context.Context, subscriberID string, templateId string, ...) (*SubscriberPreferencesResponse, error)
- type SubscriberUnseenCountOptions
- type SubscriberUnseenCountResponse
- type SubscribersTopicRequest
- type Template
- type TopicService
- func (t *TopicService) AddSubscribers(ctx context.Context, key string, subscribers []string) error
- func (t *TopicService) Create(ctx context.Context, key string, name string) error
- func (t *TopicService) Get(ctx context.Context, key string) (*GetTopicResponse, error)
- func (t *TopicService) List(ctx context.Context, options *ListTopicsOptions) (*ListTopicsResponse, error)
- func (t *TopicService) RemoveSubscribers(ctx context.Context, key string, subscribers []string) error
- func (t *TopicService) Rename(ctx context.Context, key string, name string) (*GetTopicResponse, error)
- type TriggerRecipientsType
- type TriggerRecipientsTypeArray
- type TriggerRecipientsTypeSingle
- type TriggerTopicRecipientsTypeSingle
- type UpdateIntegrationRequest
- type UpdateSubscriberPreferencesChannel
- type UpdateSubscriberPreferencesOptions
Constants ¶
View Source
const ( HTTPStatusOk = 200 HTTPStatusCreated = 201 HTTPStatusNoChange = 204 HTTPRedirectOk = 300 )
View Source
const ( NovuURL = "https://api.novu.co" NovuVersion = "v1" )
View Source
const Version = "v1"
Variables ¶
This section is empty.
Functions ¶
func MustParseURL ¶ added in v0.1.2
Types ¶
type APIClient ¶
type APIClient struct { // Api Service SubscriberApi *SubscriberService EventApi *EventService TopicsApi *TopicService IntegrationsApi *IntegrationService // contains filtered or unexported fields }
func NewAPIClient ¶
type BroadcastEventToAll ¶ added in v0.1.2
type BroadcastEventToAll struct { Name interface{} `json:"name,omitempty"` Payload interface{} `json:"payload,omitempty"` Overrides interface{} `json:"overrides,omitempty"` TransactionId string `json:"transactionId,omitempty"` Actor interface{} `json:"actor,omitempty"` }
type BulkTriggerEvent ¶ added in v0.1.2
type BulkTriggerEvent struct {
Events []BulkTriggerOptions `json:"events"`
}
type BulkTriggerOptions ¶ added in v0.1.2
type BulkTriggerOptions struct { Name interface{} `json:"name,omitempty"` To interface{} `json:"to,omitempty"` Payload interface{} `json:"payload,omitempty"` Overrides interface{} `json:"overrides,omitempty"` TransactionId string `json:"transactionId,omitempty"` Actor interface{} `json:"actor,omitempty"` }
type CTA ¶ added in v0.1.2
type CTA struct { Type string `json:"type"` Action struct { Status string `json:"status"` Buttons struct { Type string `json:"type"` Content string `json:"content"` ResultContent string `json:"resultContent"` } `json:"buttons"` Result struct { Payload map[string]interface{} `json:"payload"` Type string `json:"type"` } `json:"result"` } }
type ChannelType ¶
type ChannelType string
const ( EMAIL ChannelType = "EMAIL" SMS ChannelType = "SMS" DIRECT ChannelType = "DIRECT" )
type CreateIntegrationRequest ¶ added in v0.1.2
type CreateIntegrationRequest struct { ProviderID string `json:"providerId"` Channel ChannelType `json:"channel"` Credentials IntegrationCredentials `json:"credentials,omitempty"` Active bool `json:"active"` Check bool `json:"check"` }
type CreateTopicRequest ¶ added in v0.1.2
type EventRequest ¶
type EventResponse ¶
type EventResponse struct {
Data interface{} `json:"data"`
}
type EventService ¶
type EventService service
func (*EventService) BroadcastToAll ¶ added in v0.1.2
func (e *EventService) BroadcastToAll(ctx context.Context, data BroadcastEventToAll) (EventResponse, error)
func (*EventService) CancelTrigger ¶ added in v0.1.2
func (*EventService) Trigger ¶
func (e *EventService) Trigger(ctx context.Context, eventId string, data ITriggerPayloadOptions) (EventResponse, error)
func (*EventService) TriggerBulk ¶ added in v0.1.2
func (e *EventService) TriggerBulk(ctx context.Context, data []BulkTriggerOptions) ([]EventResponse, error)
type GeneralError ¶
type GeneralError error
type GetIntegrationsResponse ¶ added in v0.1.2
type GetIntegrationsResponse struct {
Data []Integration `json:"data"`
}
type GetTopicResponse ¶ added in v0.1.2
type IAttachmentOptions ¶
type IAttachmentOptions struct { Mime string `json:"mime,omitempty"` File io.Reader `json:"file,omitempty"` Name string `json:"name,omitempty"` Channels []ChannelType `json:"channels,omitempty"` }
type IEvent ¶
type IEvent interface { Trigger(ctx context.Context, eventId string, data ITriggerPayloadOptions) (EventResponse, error) TriggerBulk(ctx context.Context, data []BulkTriggerOptions) ([]EventResponse, error) BroadcastToAll(ctx context.Context, data BroadcastEventToAll) (EventResponse, error) CancelTrigger(ctx context.Context, transactionId string) (bool, error) }
type IIntegration ¶ added in v0.1.2
type IIntegration interface { Create(ctx context.Context, request CreateIntegrationRequest) (*IntegrationResponse, error) GetAll(ctx context.Context) (*GetIntegrationsResponse, error) GetActive(ctx context.Context) (*GetIntegrationsResponse, error) Update(ctx context.Context, integrationId string, request UpdateIntegrationRequest) (*IntegrationResponse, error) Delete(ctx context.Context, integrationId string) (*IntegrationResponse, error) }
type ISubscribers ¶
type ISubscribers interface { Identify(ctx context.Context, subscriberID string, data interface{}) (SubscriberResponse, error) Get(ctx context.Context, subscriberID string) (SubscriberResponse, error) Update(ctx context.Context, subscriberID string, data interface{}) (SubscriberResponse, error) Delete(ctx context.Context, subscriberID string) (SubscriberResponse, error) GetNotificationFeed(ctx context.Context, subscriberID string, opts *SubscriberNotificationFeedOptions) (*SubscriberNotificationFeedResponse, error) GetUnseenCount(ctx context.Context, subscriberID string, opts *SubscriberUnseenCountOptions) (*SubscriberUnseenCountResponse, error) MarkMessageSeen(ctx context.Context, subscriberID string, opts SubscriberMarkMessageSeenOptions) (*SubscriberNotificationFeedResponse, error) GetPreferences(ctx context.Context, subscriberID string) (*SubscriberPreferencesResponse, error) UpdatePreferences(ctx context.Context, subscriberID string, templateId string, opts *UpdateSubscriberPreferencesOptions) (*SubscriberPreferencesResponse, error) }
type ITopic ¶ added in v0.1.2
type ITopic interface { Create(ctx context.Context, key string, name string) error List(ctx context.Context, options *ListTopicsOptions) (*ListTopicsResponse, error) AddSubscribers(ctx context.Context, key string, subscribers []string) error RemoveSubscribers(ctx context.Context, key string, subscribers []string) error Get(ctx context.Context, key string) (*GetTopicResponse, error) Rename(ctx context.Context, key string, name string) (*GetTopicResponse, error) }
type ITriggerPayload ¶
type ITriggerPayload interface { string | []string | bool | int64 | IAttachmentOptions | []IAttachmentOptions }
type ITriggerPayloadOptions ¶
type ITriggerPayloadOptions struct { To interface{} `json:"to,omitempty"` Payload interface{} `json:"payload,omitempty"` Overrides interface{} `json:"overrides,omitempty"` TransactionId string `json:"transactionId,omitempty"` Actor interface{} `json:"actor,omitempty"` }
type Integration ¶ added in v0.1.2
type Integration struct { Id string `json:"_id"` EnvironmentID string `json:"_environmentId"` OrganizationID string `json:"_organizationId"` ProviderID string `json:"providerId"` Channel ChannelType `json:"channel"` Credentials IntegrationCredentials `json:"credentials"` Active bool `json:"active"` Deleted bool `json:"deleted"` UpdatedAt string `json:"updatedAt"` DeletedAt string `json:"deletedAt"` DeletedBy string `json:"deletedBy"` }
type IntegrationCredentials ¶ added in v0.1.2
type IntegrationCredentials struct { ApiKey string `json:"apiKey,omitempty"` User string `json:"user,omitempty"` SecretKey string `json:"secretKey,omitempty"` Domain string `json:"domain,omitempty"` Password string `json:"password,omitempty"` Host string `json:"host,omitempty"` Port string `json:"port,omitempty"` Secure bool `json:"secure,omitempty"` Region string `json:"region,omitempty"` AccountSID string `json:"accountSid,omitempty"` MessageProfileID string `json:"messageProfileId,omitempty"` Token string `json:"token,omitempty"` From string `json:"from,omitempty"` SenderName string `json:"senderName,omitempty"` ProjectName string `json:"projectName,omitempty"` ApplicationID string `json:"applicationId,omitempty"` ClientID string `json:"clientId,omitempty"` RequireTls bool `json:"requireTls,omitempty"` IgnoreTls bool `json:"ignoreTls,omitempty"` TlsOptions map[string]interface{} `json:"tlsOptions,omitempty"` }
type IntegrationResponse ¶ added in v0.1.2
type IntegrationResponse struct {
Data Integration `json:"data"`
}
type IntegrationService ¶ added in v0.1.2
type IntegrationService service
func (IntegrationService) Create ¶ added in v0.1.2
func (i IntegrationService) Create(ctx context.Context, request CreateIntegrationRequest) (*IntegrationResponse, error)
func (IntegrationService) Delete ¶ added in v0.1.2
func (i IntegrationService) Delete(ctx context.Context, integrationId string) (*IntegrationResponse, error)
func (IntegrationService) GetActive ¶ added in v0.1.2
func (i IntegrationService) GetActive(ctx context.Context) (*GetIntegrationsResponse, error)
func (IntegrationService) GetAll ¶ added in v0.1.2
func (i IntegrationService) GetAll(ctx context.Context) (*GetIntegrationsResponse, error)
func (IntegrationService) Update ¶ added in v0.1.2
func (i IntegrationService) Update(ctx context.Context, integrationId string, request UpdateIntegrationRequest) (*IntegrationResponse, error)
type ListTopicsOptions ¶ added in v0.1.2
type ListTopicsResponse ¶ added in v0.1.2
type ListTopicsResponse struct { Page int `json:"name"` PageSize int `json:"pageSize"` TotalCount int `json:"totalCount"` Data []GetTopicResponse `json:"data"` }
type NotificationFeedData ¶ added in v0.1.2
type NotificationFeedData struct { CTA CTA `json:"cta"` Channel string `json:"channel"` Content string `json:"content"` CreatedAt time.Time `json:"createdAt"` Deleted bool `json:"deleted"` DeviceTokens []string `json:"deviceTokens"` DirectWebhookURL string `json:"directWebhookUrl"` EnvironmentID string `json:"_environmentId"` ErrorID string `json:"errorId"` ErrorText string `json:"errorText"` FeedID string `json:"_feedId"` ID string `json:"_id"` JobID string `json:"_jobId"` LastReadDate time.Time `json:"lastReadDate"` LastSeenDate time.Time `json:"lastSeenDate"` MessageTemplate string `json:"_messageTemplateId"` NotificationID string `json:"_notificationId"` OrganizationID string `json:"_organizationId"` Payload struct { UpdateMessage string `json:"updateMessage"` } `json:"payload"` ProviderID string `json:"providerId"` Read bool `json:"read"` ResponseID string `json:"id"` Seen bool `json:"seen"` Status string `json:"status"` Subscriber struct { ID string `json:"_id"` SubscriberID string `json:"subscriberId"` } `json:"subscriber"` SubscriberID string `json:"_subscriberId"` TemplateID string `json:"_templateId"` TemplateIdentifier string `json:"templateIdentifier"` TransactionID string `json:"transactionId"` UpdatedAt time.Time `json:"updatedAt"` }
type Preference ¶ added in v0.1.2
type QueryParam ¶ added in v0.1.2
func GenerateQueryParamsFromStruct ¶ added in v0.1.2
func GenerateQueryParamsFromStruct[T interface{}](queryParamsStruct T) ([]QueryParam, error)
type RenameTopicRequest ¶ added in v0.1.2
type RenameTopicRequest struct {
Name string `json:"name"`
}
type SubscriberMarkMessageSeenOptions ¶ added in v0.1.2
type SubscriberNotificationFeedOptions ¶ added in v0.1.2
type SubscriberNotificationFeedResponse ¶ added in v0.1.2
type SubscriberNotificationFeedResponse struct { TotalCount int `json:"totalCount"` Data []NotificationFeedData `json:"data"` PageSize int `json:"pageSize"` Page int `json:"page"` }
type SubscriberPayload ¶
type SubscriberPreferencesResponse ¶ added in v0.1.2
type SubscriberPreferencesResponse struct { Data []struct { Template Template `json:"template"` Preference Preference `json:"preference"` } `json:"data"` }
type SubscriberResponse ¶
type SubscriberResponse struct {
Data interface{} `json:"data"`
}
type SubscriberService ¶
type SubscriberService service
func (*SubscriberService) Delete ¶
func (s *SubscriberService) Delete(ctx context.Context, subscriberID string) (SubscriberResponse, error)
func (*SubscriberService) Get ¶ added in v0.1.2
func (s *SubscriberService) Get(ctx context.Context, subscriberID string) (SubscriberResponse, error)
func (*SubscriberService) GetNotificationFeed ¶ added in v0.1.2
func (s *SubscriberService) GetNotificationFeed(ctx context.Context, subscriberID string, opts *SubscriberNotificationFeedOptions) (*SubscriberNotificationFeedResponse, error)
func (*SubscriberService) GetPreferences ¶ added in v0.1.2
func (s *SubscriberService) GetPreferences(ctx context.Context, subscriberID string) (*SubscriberPreferencesResponse, error)
func (*SubscriberService) GetUnseenCount ¶ added in v0.1.2
func (s *SubscriberService) GetUnseenCount(ctx context.Context, subscriberID string, opts *SubscriberUnseenCountOptions) (*SubscriberUnseenCountResponse, error)
func (*SubscriberService) Identify ¶
func (s *SubscriberService) Identify(ctx context.Context, subscriberID string, data interface{}) (SubscriberResponse, error)
func (*SubscriberService) MarkMessageSeen ¶ added in v0.1.2
func (s *SubscriberService) MarkMessageSeen(ctx context.Context, subscriberID string, opts SubscriberMarkMessageSeenOptions) (*SubscriberNotificationFeedResponse, error)
func (*SubscriberService) Update ¶
func (s *SubscriberService) Update(ctx context.Context, subscriberID string, data interface{}) (SubscriberResponse, error)
func (*SubscriberService) UpdatePreferences ¶ added in v0.1.2
func (s *SubscriberService) UpdatePreferences(ctx context.Context, subscriberID string, templateId string, opts *UpdateSubscriberPreferencesOptions) (*SubscriberPreferencesResponse, error)
type SubscriberUnseenCountOptions ¶ added in v0.1.2
type SubscriberUnseenCountOptions struct {
Seen *bool `json:"seen"`
}
type SubscriberUnseenCountResponse ¶ added in v0.1.2
type SubscriberUnseenCountResponse struct { Data struct { Count int `json:"count"` } `json:"data"` }
type SubscribersTopicRequest ¶ added in v0.1.2
type SubscribersTopicRequest struct {
Subscribers []string `json:"subscribers"`
}
type TopicService ¶ added in v0.1.2
type TopicService service
func (*TopicService) AddSubscribers ¶ added in v0.1.2
func (*TopicService) Get ¶ added in v0.1.2
func (t *TopicService) Get(ctx context.Context, key string) (*GetTopicResponse, error)
func (*TopicService) List ¶ added in v0.1.2
func (t *TopicService) List(ctx context.Context, options *ListTopicsOptions) (*ListTopicsResponse, error)
func (*TopicService) RemoveSubscribers ¶ added in v0.1.2
func (*TopicService) Rename ¶ added in v0.1.2
func (t *TopicService) Rename(ctx context.Context, key string, name string) (*GetTopicResponse, error)
type TriggerRecipientsType ¶
type TriggerRecipientsType interface { TriggerRecipientsTypeSingle | TriggerRecipientsTypeArray | TriggerTopicRecipientsTypeSingle | []TriggerTopicRecipientsTypeSingle }
type TriggerRecipientsTypeArray ¶
type TriggerRecipientsTypeArray interface { []string | []SubscriberPayload }
type TriggerRecipientsTypeSingle ¶
type TriggerRecipientsTypeSingle interface { string | SubscriberPayload }
type TriggerTopicRecipientsTypeSingle ¶ added in v0.1.2
type UpdateIntegrationRequest ¶ added in v0.1.2
type UpdateIntegrationRequest struct { Credentials IntegrationCredentials `json:"credentials"` Active bool `json:"active"` Check bool `json:"check"` }
type UpdateSubscriberPreferencesChannel ¶ added in v0.1.2
type UpdateSubscriberPreferencesChannel struct { Type ChannelType `json:"type"` Enabled bool `json:"enabled"` }
type UpdateSubscriberPreferencesOptions ¶ added in v0.1.2
type UpdateSubscriberPreferencesOptions struct { Channel []UpdateSubscriberPreferencesChannel `json:"channel,omitempty"` Enabled bool `json:"enabled,omitempty"` }
Click to show internal directories.
Click to hide internal directories.