func (s State) GetItem(msgID gregor.MsgID) (gregor.Item, bool) { for _, i := range s.Items_ { if i.Metadata().MsgID().String() == msgID.String() { return i, true } } return nil, false }
func (g *gregorHandler) DismissItem(id gregor.MsgID) error { if id == nil { return nil } var err error defer g.G().Trace(fmt.Sprintf("gregorHandler.DismissItem(%s)", id.String()), func() error { return err }, )() dismissal, err := g.templateMessage() if err != nil { return err } dismissal.Ibm_.StateUpdate_.Dismissal_ = &gregor1.Dismissal{ MsgIDs_: []gregor1.MsgID{gregor1.MsgID(id.Bytes())}, } incomingClient := gregor1.IncomingClient{Cli: g.cli} // TODO: Should the interface take a context from the caller? err = incomingClient.ConsumeMessage(context.TODO(), *dismissal) return err }