Documentation
¶
Index ¶
- Constants
- func GetChatMetadata(appMetadata []byte) *intentpb.ChatMetadata
- func GetContactDmPayment(appMetadata []byte) *intentpb.ChatMetadata_ContactDmPayment
- func GetDmPaymentVerb(appMetadata []byte) messagingpb.CashContent_Verb
- func GetTipDmPayment(appMetadata []byte) *intentpb.ChatMetadata_TipDmPayment
- func NewIntegration(accounts account.Store, profiles profile.Store) ocp_integration.SubmitIntent
- func NewSendContactDmPaymentMessageTask(intentRecord *ocp_intent.Record) *ocp_task.Record
- func NewSendTipDmPaymentMessageTask(intentRecord *ocp_intent.Record) *ocp_task.Record
- type Integration
- func (i *Integration) AllowCreation(ctx context.Context, intentRecord *ocp_intent.Record, ...) error
- func (i *Integration) GetTasksToSchedule(ctx context.Context, intentRecord *ocp_intent.Record) ([]*ocp_task.Record, error)
- func (i *Integration) OnSuccess(ctx context.Context, intentRecord *ocp_intent.Record) error
Constants ¶
const ( // TaskTypeSendContactDmPaymentMessage is the task that injects the cash // message into the sender and recipient's DM after a contact DM payment. TaskTypeSendContactDmPaymentMessage uint32 = 1 // TaskTypeSendTipDmPaymentMessage is the task that injects the cash message // into the sender and recipient's tip DM after a tip DM payment. TaskTypeSendTipDmPaymentMessage uint32 = 2 )
The OCP task system treats the type as an opaque app-owned namespace, so values must be globally unique across the app and stable forever — pending tasks in the DB reference them. Type 0 is reserved as invalid by the base system.
Variables ¶
This section is empty.
Functions ¶
func GetChatMetadata ¶ added in v1.15.0
func GetChatMetadata(appMetadata []byte) *intentpb.ChatMetadata
GetChatMetadata extracts the chat metadata from an intent's additional app metadata, if present. It returns nil when there is no app metadata, the metadata fails to decode, or it is not chat metadata.
This and the accessors below take the blob rather than the intent it came from, because the intent is not the only thing that carries it: a transaction history record passes the same bytes through unmodified, and decodes to the same metadata the intent was submitted with.
func GetContactDmPayment ¶ added in v1.15.0
func GetContactDmPayment(appMetadata []byte) *intentpb.ChatMetadata_ContactDmPayment
GetContactDmPayment extracts the contact DM payment from app metadata, if present. It returns nil when there is no app metadata, the metadata fails to decode, or it is not a contact DM payment.
func GetDmPaymentVerb ¶ added in v1.26.0
func GetDmPaymentVerb(appMetadata []byte) messagingpb.CashContent_Verb
GetDmPaymentVerb reports how a DM payment should be rendered. A tip DM payment is only a tip when it was sent from the recipient's tip card — the same DM also carries ordinary payments sent from within the chat itself. Everything else, contact DM payments included, is a plain send.
Both the cash message injected into the DM and the sender's activity feed entry render off this, so they cannot disagree about what a payment was.
func GetTipDmPayment ¶ added in v1.23.0
func GetTipDmPayment(appMetadata []byte) *intentpb.ChatMetadata_TipDmPayment
GetTipDmPayment extracts the tip DM payment from app metadata, if present. It returns nil when there is no app metadata, the metadata fails to decode, or it is not a tip DM payment.
func NewIntegration ¶
func NewIntegration( accounts account.Store, profiles profile.Store, ) ocp_integration.SubmitIntent
func NewSendContactDmPaymentMessageTask ¶ added in v1.15.0
func NewSendContactDmPaymentMessageTask(intentRecord *ocp_intent.Record) *ocp_task.Record
NewSendContactDmPaymentMessageTask creates the task that injects the cash message into the sender and recipient's DM after a contact DM payment. Only the intent ID is carried, via the reference ID; the executor reloads the authoritative intent record at execution time.
func NewSendTipDmPaymentMessageTask ¶ added in v1.23.0
func NewSendTipDmPaymentMessageTask(intentRecord *ocp_intent.Record) *ocp_task.Record
NewSendTipDmPaymentMessageTask creates the task that injects the cash message into the sender and recipient's tip DM after a tip DM payment. Only the intent ID is carried, via the reference ID; the executor reloads the authoritative intent record at execution time.
Types ¶
type Integration ¶
type Integration struct {
// contains filtered or unexported fields
}
func (*Integration) AllowCreation ¶
func (i *Integration) AllowCreation(ctx context.Context, intentRecord *ocp_intent.Record, metadata *ocp_transactionpb.Metadata, actions []*ocp_transactionpb.Action) error
func (*Integration) GetTasksToSchedule ¶ added in v1.15.0
func (i *Integration) GetTasksToSchedule(ctx context.Context, intentRecord *ocp_intent.Record) ([]*ocp_task.Record, error)
GetTasksToSchedule returns the guaranteed work derived from a submitted intent. A DM payment (contact or tip) schedules the cash message injected into the DM between the sender and recipient; execution is handled by task.Executor.
func (*Integration) OnSuccess ¶
func (i *Integration) OnSuccess(ctx context.Context, intentRecord *ocp_intent.Record) error