// MessageReactionsRemoveAll deletes all reactions from a message
// channelID : The channel ID
// messageID : The message ID.
160522
func (s *Session) MessageReactionsRemoveAll(channelID, messageID string) error {

	_, err := s.RequestWithBucketID("DELETE", EndpointMessageReactionsAll(channelID, messageID), nil, EndpointMessageReactionsAll(channelID, messageID))

	return err
}
1106910
func (c *Context) DeleteMessagesWithEventID(eventID string) (deleted int, err error) {
	var messages []OutgoingMessage
	f := bson.M{"botid": c.Bot().ID, "eventid": eventID}

	//update MAX_MSGS_TO_UPDATE_WITH_EVENTID last bot messages
	c.db.C("messages").Find(f).Sort("-_id").Limit(MaxMsgsToUpdateWithEventID).All(&messages)
	for _, message := range messages {
		err = c.DeleteMessage(&message)
		if err != nil {
			c.Log().WithError(err).WithField("eventid", eventID).Error("DeleteMessagesWithEventID")
		} else {
			deleted++
		}
	}
	return deleted, err
}
935975
func (sys *NotificationSys) RemoveAllRemoteTargets() {
	for _, targetMap := range sys.bucketRemoteTargetRulesMap {
		for targetID := range targetMap {
			sys.targetList.Remove(targetID)
		}
	}
}
47593
func (c *Collection) DeleteAll() (int, error) {
	t := c.pool.NewTransaction()
	count := 0
	t.DeleteAll(c, &count)
	if err := t.Exec(); err != nil {
		return count, err
	}
	return count, nil
}
480788
func (d *ProtobufDecoder) DecodeHistoryRemove(data []byte) (*HistoryRemoveRequest, error) {
	var p HistoryRemoveRequest
	err := p.Unmarshal(data)
	if err != nil {
		return nil, err
	}
	return &p, nil
}
185982
func NewRemoveInstrumentationBreakpointArgs(eventName string) *RemoveInstrumentationBreakpointArgs {
	args := new(RemoveInstrumentationBreakpointArgs)
	args.EventName = eventName
	return args
}
886225
func NewRemoveBreakpointArgs(breakpointID BreakpointID) *RemoveBreakpointArgs {
	args := new(RemoveBreakpointArgs)
	args.BreakpointID = breakpointID
	return args
}
947734
func (t *basicSupersedesTransform) transformDelete(msg chat1.MessageUnboxed, superMsg chat1.MessageUnboxed) *chat1.MessageUnboxed {
	mvalid := msg.Valid()
	if !mvalid.IsEphemeral() {
		return nil
	}
	explodedBy := superMsg.Valid().SenderUsername
	mvalid.ClientHeader.EphemeralMetadata.ExplodedBy = &explodedBy
	newMsg := chat1.NewMessageUnboxedWithValid(mvalid)
	return &newMsg
}
528299
func (c *InstancesClient) DeleteAllMetadata(ctx context.Context, input *DeleteAllMetadataInput) error {
	fullPath := path.Join("/", c.client.AccountName, "machines", input.ID, "metadata")
	reqInputs := client.RequestInput{
		Method: http.MethodDelete,
		Path:   fullPath,
	}
	respReader, err := c.client.ExecuteRequest(ctx, reqInputs)
	if err != nil {
		return pkgerrors.Wrap(err, "unable to delete all machine metadata")
	}
	if respReader != nil {
		defer respReader.Close()
	}

	return nil
}
1197435
func (mm *MessageManager) removeHandler(messageType string, handlerID MessageHandlerId) {
	indexOfHandler := -1
	for i, activeHandler := range mm.listeners[messageType] {
		if activeHandler.MessageHandlerId == handlerID {
			indexOfHandler = i
			break
		}
	}
	// A handler might have already been removed during a previous Dispatch(), no action necessary
	if indexOfHandler == -1 {
		return
	}
	mm.listeners[messageType] = append(mm.listeners[messageType][:indexOfHandler], mm.listeners[messageType][indexOfHandler+1:]...)
}
1134508
func (s *Server) UnsubscribeAll(ctx context.Context, clientID string) error {
	s.mtx.RLock()
	_, ok := s.subscriptions[clientID]
	s.mtx.RUnlock()
	if !ok {
		return ErrSubscriptionNotFound
	}

	select {
	case s.cmds <- cmd{op: unsub, clientID: clientID}:
		s.mtx.Lock()
		delete(s.subscriptions, clientID)
		s.mtx.Unlock()
		return nil
	case <-ctx.Done():
		return ctx.Err()
	case <-s.Quit():
		return nil
	}
}
1347713
func (s *StanServer) processDeleteChannel(channel string) {
	cs := s.channels
	cs.Lock()
	defer cs.Unlock()
	c := cs.channels[channel]
	if c == nil {
		s.log.Errorf("Error deleting channel %q: not found", channel)
		return
	}
	if c.activity != nil && c.activity.preventDelete {
		s.log.Errorf("The channel %q cannot be deleted at this time since a subscription has been created", channel)
		return
	}
	// Delete from store
	if err := cs.store.DeleteChannel(channel); err != nil {
		s.log.Errorf("Error deleting channel %q: %v", channel, err)
		if c.activity != nil {
			c.activity.deleteInProgress = false
			c.startDeleteTimer()
		}
		return
	}
	delete(s.channels.channels, channel)
	s.log.Noticef("Channel %q has been deleted", channel)
}
600020
func (call *Call) Delete(client *messagebird.Client) error {
	return client.Request(nil, http.MethodDelete, apiRoot+"/calls/"+call.ID, nil)
}
493541
func (r *ControllerExpectations) DeleteExpectations(controllerKey string) {
	if exp, exists, err := r.GetByKey(controllerKey); err == nil && exists {
		if err := r.Delete(exp); err != nil {
			klog.V(2).Infof("Error deleting expectations for controller %v: %v", controllerKey, err)
		}
	}
}
1277756
func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opt *ListOptions) ([]*Reaction, *Response, error) {
	u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber)
	u, err := addOptions(u, opt)
	if err != nil {
		return nil, nil, err
	}

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	req.Header.Set("Accept", mediaTypeReactionsPreview)

	var m []*Reaction
	resp, err := s.client.Do(ctx, req, &m)
	if err != nil {
		return nil, resp, err
	}

	return m, resp, nil
}
836250
func (s *Storage) purgeMessage(mvalid chat1.MessageUnboxedValid) (chat1.MessageUnboxed, []chat1.Asset) {
	assets := utils.AssetsForMessage(s.G(), mvalid.MessageBody)
	var emptyBody chat1.MessageBody
	mvalid.MessageBody = emptyBody
	var emptyReactions chat1.ReactionMap
	mvalid.Reactions = emptyReactions
	return chat1.NewMessageUnboxedWithValid(mvalid), assets
}
433494
func (m Message) Delete() (err error) {
	return m.q.DeleteMessage(m.Id)
}