Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIVersion ¶
type APIVersion string
APIVersion defines the current API version
const ( // CurrentAPIVersion specify the lastest API version CurrentAPIVersion APIVersion = "1.2.0" )
type App ¶
type App struct { // ID defines the application id that is provided by the publisher ID string `bson:"id" json:"id"` // Version defines the application version which the event was triggered Version string `bson:"version" json:"version"` // Name holds the name of the app. It helps us add more context to the payload Name string `bson:"name" json:"name"` // IsBundle defines if the app is a group of apps. IsBundle bool `bson:"isBundle" json:"isBundle"` BundledAppIDs []string `bson:"bundledAppIds,omitempty" json:"bundledAppIds,omitempty"` BundledIn []BundleInfo `bson:"bundledIn,omitempty" json:"bundledIn,omitempty"` // BundledIn only includes id and name }
App holds information about the application which the event was triggered
type BundleInfo ¶
type BundleInfo struct { ID string `bson:"id" json:"id,omitempty"` Name string `bson:"name" json:"name,omitempty"` }
BundleInfo defines information about a bundle when the app is included in a bundle. This way we can identify the bundle and the app is included in it
type Event ¶
type Event struct { // unique generated id ID string `bson:"_id,omitempty" json:"id"` // Type defines an unique string key that identifies an event // E.g: application.purchased Type EventType `bson:"type" json:"type"` // Event definition version. We can use this field handle the event definition schema evolution // E.g: 1.0 APIVersion `bson:"apiVersion" json:"apiVersion"` // Defines a UTC timestamp within the time when an event was created // E.g: 1651772844 When time.Time `bson:"when" json:"when"` // Data has the event specific payload Data json.RawMessage `bson:"data" json:"data"` }
Event represent something that happened An event is always related to an app. We will always have the application info at the root of the event
type EventObjectType ¶
type EventObjectType string
EventObjectType holds the event type we are working.
const ( // SubscriptionDataType describes the type of the data we are holding. // It allow us easily map data from the database to a struct SubscriptionDataType EventObjectType = "subscription" // PurchaseDataType describes the type of the data we are holding. // It allow us easily map data from the database to a struct PurchaseDataType EventObjectType = "purchase" )
type EventType ¶
type EventType string
EventType is a unique key defined by event
const ( // AppSubscribedEventType defines the string constant name for the event that happens when // a user subscribes to a plan AppSubscribedEventType EventType = "app.subscription.created" // AppSubscriptionCancelledEventType defines the string constant name for the event that happens when // a user cancels a subscription AppSubscriptionCancelledEventType EventType = "app.subscription.cancelled" // AppSubscriptionModifiedEventType defines the string constant name for the event that happens when // a subscription is modified AppSubscriptionModifiedEventType EventType = "app.subscription.modified" // AppSubscriptionMigratedEventType defines the event related to when a subscription is migrate to use the bundle AppSubscriptionMigratedEventType EventType = "app.subscription.migrated" // AppPurchasedEventType indicates which type the struct is. Could make it easier for us data map this event from the database AppPurchasedEventType EventType = "app.purchase.created" )
Click to show internal directories.
Click to hide internal directories.