lib

package
v0.0.0-...-d0c33e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTPStatusOk       = 200
	HTTPStatusCreated  = 201
	HTTPStatusNoChange = 204
	HTTPRedirectOk     = 300
)
View Source
const (
	TeleflowURL     = "https://api.teleflow.khulnasoft.com"
	TeleflowVersion = "v1"
)
View Source
const Version = "v1"

Variables

This section is empty.

Functions

func MustParseURL

func MustParseURL(rawURL string) *url.URL

Types

type APIClient

type APIClient struct {

	// Api Service
	BlueprintApi     *BlueprintService
	ChangesApi       *ChangesService
	SubscriberApi    *SubscriberService
	EventApi         *EventService
	ExecutionsApi    *ExecutionsService
	MessagesApi      *MessagesService
	FeedsApi         *FeedsService
	TopicsApi        *TopicService
	IntegrationsApi  *IntegrationService
	InboundParserApi *InboundParserService
	LayoutApi        *LayoutService
	TenantApi        *TenantService
	// contains filtered or unexported fields
}

func NewAPIClient

func NewAPIClient(apiKey string, cfg *Config) *APIClient

type Base64Payload

type Base64Payload struct {
	Payload string `queryKey:"payload"`
}

type BlueprintByTemplateIdResponse

type BlueprintByTemplateIdResponse struct {
	Id                  string        `json:"_id,omitempty"`
	Name                string        `json:"name,omitempty"`
	Description         string        `json:"description,omitempty"`
	Active              bool          `json:"active,omitempty"`
	Draft               bool          `json:"draft,omitempty"`
	PreferenceSettings  interface{}   `json:"preferenceSettings,omitempty"`
	Critical            bool          `json:"critical,omitempty"`
	Tags                []string      `json:"tags,omitempty"`
	Steps               []interface{} `json:"steps,omitempty"`
	OrganizationID      string        `json:"_organizationId,omitempty"`
	CreatorID           string        `json:"_creatorId,omitempty"`
	EnvironmentID       string        `json:"_environmentId,omitempty"`
	Triggers            []interface{} `json:"triggers,omitempty"`
	NotificationGroupID string        `json:"_notificationGroupId,omitempty"`
	ParentId            string        `json:"_parentId,omitempty"`
	Deleted             bool          `json:"deleted,omitempty"`
	DeletedAt           string        `json:"deletedAt,omitempty"`
	DeletedBy           string        `json:"deletedBy,omitempty"`
	CreatedAt           string        `json:"createdAt,omitempty"`
	UpdatedAt           string        `json:"updatedAt,omitempty"`
	NotificationGroup   interface{}   `json:"notificationGroup,omitempty"`
	IsBlueprint         bool          `json:"isBlueprint,omitempty"`
	BlueprintID         string        `json:"blueprintId,omitempty"`
}

type BlueprintGroupByCategoryResponse

type BlueprintGroupByCategoryResponse struct {
	General []interface{} `json:"general,omitempty"`
	Popular interface{}   `json:"popular,omitempty"`
}

type BlueprintService

type BlueprintService service

func (*BlueprintService) GetByTemplateID

func (b *BlueprintService) GetByTemplateID(ctx context.Context, templateID string) (BlueprintByTemplateIdResponse, error)

func (*BlueprintService) GetGroupByCategory

type BroadcastEventToAll

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

type BulkTriggerEvent struct {
	Events []BulkTriggerOptions `json:"events"`
}

type BulkTriggerOptions

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

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 ChangesApplyResponse

type ChangesApplyResponse struct {
	Data []ChangesGetResponseData `json:"data,omitempty"`
}

type ChangesBulkApplyPayload

type ChangesBulkApplyPayload struct {
	ChangeIds []string `json:"changeIds"`
}

type ChangesCountResponse

type ChangesCountResponse struct {
	Data int `json:"data"`
}

type ChangesGetQuery

type ChangesGetQuery struct {
	Page     int    `json:"page,omitempty"`
	Limit    int    `json:"limit,omitempty"`
	Promoted string `json:"promoted,omitempty"`
}

func (*ChangesGetQuery) BuildQuery

func (c *ChangesGetQuery) BuildQuery() string

type ChangesGetResponse

type ChangesGetResponse struct {
	TotalCount int                      `json:"totalCount,omitempty"`
	Data       []ChangesGetResponseData `json:"data"`
	PageSize   int                      `json:"pageSize,omitempty"`
	Page       int                      `json:"page,omitempty"`
}

type ChangesGetResponseData

type ChangesGetResponseData struct {
	Id             string      `json:"_id,omitempty"`
	CreatorId      string      `json:"_creatorId,omitempty"`
	EnvironmentId  string      `json:"_environmentId,omitempty"`
	OrganizationId string      `json:"_organizationId,omitempty"`
	EntityId       string      `json:"_entityId,omitempty"`
	Enabled        bool        `json:"enabled,omitempty"`
	Type           string      `json:"type,omitempty"`
	Change         interface{} `json:"change,omitempty"`
	CreatedAt      string      `json:"createdAt,omitempty"`
	ParentId       string      `json:"_parentId,omitempty"`
}

type ChangesService

type ChangesService service

func (*ChangesService) ApplyBulkChanges

func (c *ChangesService) ApplyBulkChanges(ctx context.Context, payload ChangesBulkApplyPayload) (ChangesApplyResponse, error)

func (*ChangesService) ApplyChange

func (c *ChangesService) ApplyChange(ctx context.Context, changeId string) (ChangesApplyResponse, error)

func (*ChangesService) GetChanges

func (*ChangesService) GetChangesCount

func (c *ChangesService) GetChangesCount(ctx context.Context) (ChangesCountResponse, error)

type Channel

type Channel struct {
	Email bool `json:"email"`
	Sms   bool `json:"sms"`
	Chat  bool `json:"chat"`
	InApp bool `json:"in_app"`
	Push  bool `json:"push"`
}

type ChannelType

type ChannelType string
const (
	EMAIL  ChannelType = "EMAIL"
	SMS    ChannelType = "SMS"
	DIRECT ChannelType = "DIRECT"
)

type CheckTopicSubscriberResponse

type CheckTopicSubscriberResponse struct {
	OrganizationId       string `json:"_organizationId"`
	EnvironmentId        string `json:"_environmentId"`
	SubsriberId          string `json:"_subscriberId"`
	Id                   string `json:"_topicId"`
	Key                  string `json:"topicKey"`
	ExternalSubscriberId string `json:"externalSubscriberId"`
}

type Config

type Config struct {
	BackendURL  *url.URL
	HttpClient  *http.Client
	RetryConfig *RetryConfigType
}

type CreateIntegrationRequest

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 CreateLayoutRequest

type CreateLayoutRequest struct {
	Name        string        `json:"name"`
	Identifier  string        `json:"identifier"`
	Description string        `json:"description"`
	Content     string        `json:"content"`
	Variables   []interface{} `json:"variables,omitempty"`
	IsDefault   bool          `json:"isDefault,omitempty"`
}

type CreateLayoutResponse

type CreateLayoutResponse struct {
	Data struct {
		Id string `json:"_id"`
	} `json:"data"`
}

type CreateTopicRequest

type CreateTopicRequest struct {
	Name string `json:"name"`
	Key  string `json:"key"`
}

type Credentials

type Credentials struct {
	WebhookUrl   string   `json:"webhookUrl,omitempty"`
	Channel      string   `json:"channel,omitempty"`
	DeviceTokens []string `json:"deviceTokens,omitempty"`
}

type Data

type Data struct {
	Acknowledged bool   `json:"acknowledged"`
	Status       string `json:"status"`
}

type EventRequest

type EventRequest struct {
	Name          string      `json:"name"`
	To            interface{} `json:"to"`
	Payload       interface{} `json:"payload"`
	Overrides     interface{} `json:"overrides,omitempty"`
	TransactionId string      `json:"transactionId,omitempty"`
	Actor         interface{} `json:"actor,omitempty"`
}

type EventResponse

type EventResponse struct {
	JsonResponse
}

type EventService

type EventService service

func (*EventService) BroadcastToAll

func (e *EventService) BroadcastToAll(ctx context.Context, data BroadcastEventToAll) (EventResponse, error)

func (*EventService) CancelTrigger

func (e *EventService) CancelTrigger(ctx context.Context, transactionId string) (bool, error)

func (*EventService) Trigger

func (e *EventService) Trigger(ctx context.Context, eventId string, data ITriggerPayloadOptions) (EventResponse, error)

func (*EventService) TriggerBulk

func (e *EventService) TriggerBulk(ctx context.Context, data []BulkTriggerOptions) ([]EventResponse, error)

type ExecutionsQueryParams

type ExecutionsQueryParams struct {
	NotificationId string
	SubscriberId   string
}

func (ExecutionsQueryParams) BuildQuery

func (q ExecutionsQueryParams) BuildQuery() string

type ExecutionsService

type ExecutionsService service

func (*ExecutionsService) GetExecutions

func (e *ExecutionsService) GetExecutions(ctx context.Context, q QueryBuilder) (JsonResponse, error)

type FeedsService

type FeedsService service

func (*FeedsService) CreateFeed

func (e *FeedsService) CreateFeed(ctx context.Context, name string) (JsonResponse, error)

func (*FeedsService) DeleteFeed

func (e *FeedsService) DeleteFeed(ctx context.Context, feedId string) (JsonResponse, error)

func (*FeedsService) GetFeeds

func (e *FeedsService) GetFeeds(ctx context.Context) (JsonResponse, error)

type GeneralError

type GeneralError error

type GetIntegrationsResponse

type GetIntegrationsResponse struct {
	Data []Integration `json:"data"`
}

type GetTopicResponse

type GetTopicResponse struct {
	Id             string   `json:"_id"`
	OrganizationId string   `json:"_organizationId"`
	EnvironmentId  string   `json:"_environmentId"`
	Key            string   `json:"key"`
	Name           string   `json:"name"`
	Subscribers    []string `json:"subscribers"`
}

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 IInboundParser

type IInboundParser interface {
	Get(ctx context.Context) bool
}

type IIntegration

type IIntegration interface {
	Create(ctx context.Context, request CreateIntegrationRequest) (*IntegrationResponse, error)
	GetAll(ctx context.Context) (*GetIntegrationsResponse, error)
	GetActive(ctx context.Context) (*GetIntegrationsResponse, error)
	GetWebhookSupportStatus(ctx context.Context, providerId string) (bool, error)
	Update(ctx context.Context, integrationId string, request UpdateIntegrationRequest) (*IntegrationResponse, error)
	Delete(ctx context.Context, integrationId string) (*IntegrationResponse, error)
	SetIntegrationAsPrimary(ctx context.Context, integrationId string) (*SetIntegrationAsPrimaryResponse, error)
	GetChannelLimit(ctx context.Context, channelType string) (*IntegrationChannelLimitResponse, error)
}

type ISubscribers

type ISubscribers interface {
	Identify(ctx context.Context, subscriberID string, data interface{}) (SubscriberResponse, error)
	BulkCreate(ctx context.Context, subscribers SubscriberBulkPayload) (SubscriberBulkCreateResponse, error)
	Get(ctx context.Context, subscriberID string) (SubscriberResponse, error)
	Update(ctx context.Context, subscriberID string, data interface{}) (SubscriberResponse, error)
	UpdateCredentials(ctx context.Context, subscriberID string, payload SubscriberCredentialPayload) (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

type ITopic interface {
	Create(ctx context.Context, key string, name string) error
	List(ctx context.Context, options *ListTopicsOptions) (*ListTopicsResponse, error)
	CheckTopicSubscriber(ctx context.Context, key string, externalsubscriber string) (*CheckTopicSubscriberResponse, 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)
	Delete(ctx context.Context, key string) 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 InboundParserResponse

type InboundParserResponse struct {
	Data MxRecordConfiguredStatus `json:"data"`
}

type InboundParserService

type InboundParserService service

func (InboundParserService) Get

type Integration

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 IntegrationChannelLimitResponse

type IntegrationChannelLimitResponse struct {
	Data struct {
		Limit int `json:"limit"`
		Count int `json:"count"`
	} `json:"data"`
}

type IntegrationCredentials

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

type IntegrationResponse struct {
	Data Integration `json:"data"`
}

type IntegrationService

type IntegrationService service

func (IntegrationService) Create

func (IntegrationService) Delete

func (i IntegrationService) Delete(ctx context.Context, integrationId string) (*IntegrationResponse, error)

func (IntegrationService) GetActive

func (IntegrationService) GetAll

func (IntegrationService) GetChannelLimit

func (i IntegrationService) GetChannelLimit(ctx context.Context, channelType string) (*IntegrationChannelLimitResponse, error)

func (IntegrationService) GetWebhookSupportStatus

func (i IntegrationService) GetWebhookSupportStatus(ctx context.Context, providerId string) (bool, error)

func (IntegrationService) SetIntegrationAsPrimary

func (i IntegrationService) SetIntegrationAsPrimary(ctx context.Context, integrationId string) (*SetIntegrationAsPrimaryResponse, error)

func (IntegrationService) Update

type JsonResponse

type JsonResponse struct {
	Data interface{} `json:"data"`
}

type LayoutRequestOptions

type LayoutRequestOptions struct {
	Page     *int    `json:"page,omitempty"`
	PageSize *int    `json:"pageSize,omitempty"`
	Key      *string `json:"key,omitempty"`
	OrderBy  *int    `json:"orderBy,omitempty"`
}

type LayoutResponse

type LayoutResponse struct {
	Id             string        `json:"_id"`
	OrganizationId string        `json:"_organizationId"`
	EnvironmentId  string        `json:"_environmentId"`
	CreatorId      string        `json:"_creatorId"`
	Name           string        `json:"name"`
	Identifier     string        `json:"identifier"`
	Description    string        `json:"description"`
	Channel        string        `json:"channel"`
	Content        string        `json:"content"`
	ContentType    string        `json:"contentType"`
	Variables      []interface{} `json:"variables"`
	IsDefault      bool          `json:"isDefault"`
	IsDeleted      bool          `json:"isDeleted"`
	CreatedAt      string        `json:"createdAt"`
	UpdatedAt      string        `json:"updatedAt"`
	ParentId       string        `json:"_parentId"`
}

type LayoutService

type LayoutService service

func (*LayoutService) Create

func (*LayoutService) Delete

func (l *LayoutService) Delete(ctx context.Context, key string) error

func (*LayoutService) Get

func (l *LayoutService) Get(ctx context.Context, key string) (*LayoutResponse, error)

func (*LayoutService) List

func (*LayoutService) SetDefault

func (l *LayoutService) SetDefault(ctx context.Context, key string) error

func (*LayoutService) Update

func (l *LayoutService) Update(ctx context.Context, key string, request CreateLayoutRequest) (*LayoutResponse, error)

type LayoutsResponse

type LayoutsResponse struct {
	TotalCount int              `json:"totalCount"`
	Data       []LayoutResponse `json:"data"`
	PageSize   int              `json:"pageSize"`
	Page       int              `json:"page"`
}

type ListTopicsOptions

type ListTopicsOptions struct {
	Page     *int    `json:"page,omitempty"`
	PageSize *int    `json:"pageSize,omitempty"`
	Key      *string `json:"key,omitempty"`
}

type ListTopicsResponse

type ListTopicsResponse struct {
	Page       int                `json:"name"`
	PageSize   int                `json:"pageSize"`
	TotalCount int                `json:"totalCount"`
	Data       []GetTopicResponse `json:"data"`
}

type MessagesQueryParams

type MessagesQueryParams struct {
	Channel       string
	SubscriberId  string
	TransactionId []string
	Page          int
	Limit         int
}

func (MessagesQueryParams) BuildQuery

func (q MessagesQueryParams) BuildQuery() string

type MessagesService

type MessagesService service

func (*MessagesService) DeleteMessage

func (e *MessagesService) DeleteMessage(ctx context.Context, messageId string) (JsonResponse, error)

func (*MessagesService) GetMessages

func (e *MessagesService) GetMessages(ctx context.Context, q QueryBuilder) (JsonResponse, error)

type MxRecordConfiguredStatus

type MxRecordConfiguredStatus struct {
	MxRecordConfigured bool `json:"mxRecordConfigured"`
}

type NotificationFeedData

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

type Preference struct {
	Enabled  bool    `json:"enabled"`
	Channels Channel `json:"channels"`
}

type ProviderIdType

type ProviderIdType string

type QueryBuilder

type QueryBuilder interface {
	BuildQuery() string
}

QueryBuilder gives us an interface to pass as arg to our API methods. See messages.go for an example of implementing this interface

type QueryParam

type QueryParam struct {
	Key   string
	Value string
}

func GenerateQueryParamsFromStruct

func GenerateQueryParamsFromStruct[T interface{}](queryParamsStruct T) ([]QueryParam, error)

type RenameTopicRequest

type RenameTopicRequest struct {
	Name string `json:"name"`
}

type Response

type Response struct {
	Data Data `json:"data"`
}

type RetryConfigType

type RetryConfigType struct {
	InitialDelay time.Duration // inital delay
	WaitMin      time.Duration // Minimum time to wait
	WaitMax      time.Duration // Maximum time to wait
	RetryMax     int           // Maximum number of retries
}

type SetIntegrationAsPrimaryResponse

type SetIntegrationAsPrimaryResponse struct {
	Data struct {
		ID             string                 `json:"_id"`
		EnvironmentID  string                 `json:"_environmentId"`
		OrganizationID string                 `json:"_organizationId"`
		Name           string                 `json:"name"`
		Identifier     string                 `json:"identifier"`
		ProviderID     string                 `json:"providerId"`
		Channel        string                 `json:"channel"`
		Credentials    IntegrationCredentials `json:"credentials"`
		Active         bool                   `json:"active"`
		Deleted        bool                   `json:"deleted"`
		DeletedAt      string                 `json:"deletedAt"`
		DeletedBy      string                 `json:"deletedBy"`
		Primary        bool                   `json:"primary"`
	} `json:"data"`
}

type SubscriberBulkCreateResponse

type SubscriberBulkCreateResponse struct {
	Data struct {
		Updated []struct {
			SubscriberId string `json:"subscriberId"`
		} `json:"updated"`
		Created []struct {
			SubscriberId string `json:"subscriberId"`
		} `json:"created"`
		Failed []interface{} `json:"failed"`
	} `json:"data"`
}

type SubscriberBulkPayload

type SubscriberBulkPayload struct {
	Subscribers []SubscriberPayload `json:"subscribers"`
}

type SubscriberCredentialPayload

type SubscriberCredentialPayload struct {
	Credentials           Credentials    `json:"credentials"`
	IntegrationIdentifier string         `json:"integrationIdentifier,omitempty"`
	ProviderId            ProviderIdType `json:"providerId"`
}

type SubscriberMarkMessageSeenOptions

type SubscriberMarkMessageSeenOptions struct {
	MessageID string `json:"messageId"`
	Seen      bool   `json:"seen"`
	Read      bool   `json:"read"`
}

type SubscriberNotificationFeedOptions

type SubscriberNotificationFeedOptions struct {
	Page           int         `queryKey:"page"`
	FeedIdentifier string      `queryKey:"feedIdentifier"`
	Seen           bool        `queryKey:"seen"`
	Payload        interface{} `queryKey:"payload"`
}

type SubscriberNotificationFeedResponse

type SubscriberNotificationFeedResponse struct {
	TotalCount int                    `json:"totalCount"`
	Data       []NotificationFeedData `json:"data"`
	PageSize   int                    `json:"pageSize"`
	Page       int                    `json:"page"`
}

type SubscriberPayload

type SubscriberPayload struct {
	FirstName    string                 `json:"firstName,omitempty"`
	LastName     string                 `json:"lastName,omitempty"`
	Email        string                 `json:"email,omitempty"`
	Phone        string                 `json:"phone,omitempty"`
	Avatar       string                 `json:"avatar,omitempty"`
	Locale       string                 `json:"locale,omitempty"`
	Data         map[string]interface{} `json:"data,omitempty"`
	SubscriberId string                 `json:"subscriberId"`
}

type SubscriberPreferencesResponse

type SubscriberPreferencesResponse struct {
	Data []struct {
		Template   Template   `json:"template"`
		Preference Preference `json:"preference"`
	} `json:"data"`
}

type SubscriberResponse

type SubscriberResponse struct {
	JsonResponse
}

type SubscriberService

type SubscriberService service

func (*SubscriberService) BulkCreate

func (*SubscriberService) Delete

func (s *SubscriberService) Delete(ctx context.Context, subscriberID string) (SubscriberResponse, error)

func (*SubscriberService) Get

func (s *SubscriberService) Get(ctx context.Context, subscriberID string) (SubscriberResponse, error)

func (*SubscriberService) GetNotificationFeed

func (*SubscriberService) GetPreferences

func (s *SubscriberService) GetPreferences(ctx context.Context, subscriberID string) (*SubscriberPreferencesResponse, error)

func (*SubscriberService) GetUnseenCount

func (*SubscriberService) Identify

func (s *SubscriberService) Identify(ctx context.Context, subscriberID string, data interface{}) (SubscriberResponse, error)

func (*SubscriberService) MarkMessageSeen

func (*SubscriberService) Update

func (s *SubscriberService) Update(ctx context.Context, subscriberID string, data interface{}) (SubscriberResponse, error)

func (*SubscriberService) UpdateCredentials

func (s *SubscriberService) UpdateCredentials(ctx context.Context, subscriberID string, data SubscriberCredentialPayload) (SubscriberResponse, error)

func (*SubscriberService) UpdatePreferences

func (s *SubscriberService) UpdatePreferences(ctx context.Context, subscriberID string, templateId string, opts *UpdateSubscriberPreferencesOptions) (*SubscriberPreferencesResponse, error)

type SubscriberUnseenCountOptions

type SubscriberUnseenCountOptions struct {
	Seen *bool `json:"seen"`
}

type SubscriberUnseenCountResponse

type SubscriberUnseenCountResponse struct {
	Data struct {
		Count int `json:"count"`
	} `json:"data"`
}

type SubscribersTopicRequest

type SubscribersTopicRequest struct {
	Subscribers []string `json:"subscribers"`
}

type Template

type Template struct {
	ID       string `json:"_id"`
	Name     string `json:"name"`
	Critical bool   `json:"critical"`
}

type TenantService

type TenantService service

func (*TenantService) CreateTenant

func (e *TenantService) CreateTenant(ctx context.Context, name string, identifier string) (JsonResponse, error)

func (*TenantService) DeleteTenant

func (e *TenantService) DeleteTenant(ctx context.Context, identifier string) (JsonResponse, error)

func (*TenantService) GetTenant

func (e *TenantService) GetTenant(ctx context.Context, identifier string) (JsonResponse, error)

func (*TenantService) GetTenants

func (e *TenantService) GetTenants(ctx context.Context, page string, limit string) (JsonResponse, error)

func (*TenantService) UpdateTenant

func (e *TenantService) UpdateTenant(ctx context.Context, identifier string, updateTenantObject *UpdateTenantRequest) (JsonResponse, error)

type TopicService

type TopicService service

func (*TopicService) AddSubscribers

func (t *TopicService) AddSubscribers(ctx context.Context, key string, subscribers []string) error

func (*TopicService) CheckTopicSubscriber

func (t *TopicService) CheckTopicSubscriber(ctx context.Context, key string, externalsubscriber string) (*CheckTopicSubscriberResponse, error)

func (*TopicService) Create

func (t *TopicService) Create(ctx context.Context, key string, name string) error

func (*TopicService) Delete

func (t *TopicService) Delete(ctx context.Context, key string) error

func (*TopicService) Get

func (*TopicService) List

func (*TopicService) RemoveSubscribers

func (t *TopicService) RemoveSubscribers(ctx context.Context, key string, subscribers []string) error

func (*TopicService) Rename

func (t *TopicService) Rename(ctx context.Context, key string, name string) (*GetTopicResponse, error)

type TriggerRecipientsTypeArray

type TriggerRecipientsTypeArray interface {
	[]string | []SubscriberPayload
}

type TriggerRecipientsTypeSingle

type TriggerRecipientsTypeSingle interface {
	string | SubscriberPayload
}

type TriggerTopicRecipientsTypeSingle

type TriggerTopicRecipientsTypeSingle struct {
	TopicKey string `json:"topicKey,omitempty"`
	Type     string `json:"type,omitempty"`
}

type UpdateIntegrationRequest

type UpdateIntegrationRequest struct {
	Credentials IntegrationCredentials `json:"credentials"`
	Active      bool                   `json:"active"`
	Check       bool                   `json:"check"`
}

type UpdateSubscriberPreferencesChannel

type UpdateSubscriberPreferencesChannel struct {
	Type    ChannelType `json:"type"`
	Enabled bool        `json:"enabled"`
}

type UpdateSubscriberPreferencesOptions

type UpdateSubscriberPreferencesOptions struct {
	Channel []UpdateSubscriberPreferencesChannel `json:"channel,omitempty"`
	Enabled bool                                 `json:"enabled,omitempty"`
}

type UpdateTenantRequest

type UpdateTenantRequest struct {
	Name       string                 `json:"name"`
	Data       map[string]interface{} `json:"data"`
	Identifier string                 `json:"identifier"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL