messages

package
v3.1.8+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APNSMessage

type APNSMessage struct {
	DeviceToken string                 `json:"DeviceToken"`
	Payload     APNSPayloadContent     `json:"Payload"`
	PushExpiry  int64                  `json:"push_expiry"`
	Metadata    map[string]interface{} `json:"metadata"`
}

APNSMessage might need to update the json encoding if we change to snake case For more info on APNS payload building, refer to this document: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW1

func NewAPNSMessage

func NewAPNSMessage(deviceToken string, pushExpiry int64, aps, messageMetadata map[string]interface{}, pushMetadata map[string]interface{}, templateName string) *APNSMessage

NewAPNSMessage builds an APNSMessage

func (*APNSMessage) ToJSON

func (m *APNSMessage) ToJSON() (string, error)

ToJSON returns the serialized message

type APNSPayloadContent

type APNSPayloadContent struct {
	Aps          map[string]interface{} `json:"aps"`
	M            map[string]interface{} `json:"m,omitempty"`
	TemplateName string                 `json:"templateName"`
}

APNSPayloadContent stores payload content of apns message

type GCMMessage

type GCMMessage struct {
	To                     string                 `json:"to"`
	Data                   map[string]interface{} `json:"data"`
	TimeToLive             int64                  `json:"time_to_live,omitempty"`
	DelayWhileIdle         bool                   `json:"delay_while_idle,omitempty"`
	DeliveryReceiptRequest bool                   `json:"delivery_receipt_requested,omitempty"`
	DryRun                 bool                   `json:"dry_run"`
	MessageID              string                 `json:"message_id"`
	Metadata               map[string]interface{} `json:"metadata"`
}

GCMMessage is the struct to store a gcm message For more info on the GCM Message Data attribute refer to: https://developers.google.com/cloud-messaging/concept-options

func NewGCMMessage

func NewGCMMessage(to string, data, messageMetadata map[string]interface{}, pushMetadata map[string]interface{}, timeToLive int64, templateName string) *GCMMessage

NewGCMMessage builds a new GCM Message

func (*GCMMessage) ToJSON

func (m *GCMMessage) ToJSON() (string, error)

ToJSON returns the serialized message

type KafkaMessage

type KafkaMessage struct {
	Topic   string
	Message string
}

KafkaMessage is the message to be sent to Kafka

func NewKafkaMessage

func NewKafkaMessage(topic, message string) *KafkaMessage

NewKafkaMessage returns a new configured kafka message

Jump to

Keyboard shortcuts

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