// CountSMSHistorySince counts the amount of sms sent to a phone number since a specific time
168194
func (m *Manager) CountSMSHistorySince(phonenumber string, since time.Time) (int, error) {
	return m.collection.Find(bson.M{"createdat": bson.M{"$gte": since}}).Count()
}
939277
func (c *GroupsHistoryCall) Count(count int) *GroupsHistoryCall {
	c.count = count
	return c
}
520843
func AddHistory(s string) {
	n := HistorySize()
	if n == 0 || s != GetHistory(n-1) {
		C.add_history(C.CString(s))
	}
}
800628
func (s *sequenceDecs) mergeHistory(hist *sequenceDecs) (*sequenceDecs, error) {
	for i := uint(0); i < 3; i++ {
		var sNew, sHist *sequenceDec
		switch i {
		default:
			// same as "case 0":
			sNew = &s.litLengths
			sHist = &hist.litLengths
		case 1:
			sNew = &s.offsets
			sHist = &hist.offsets
		case 2:
			sNew = &s.matchLengths
			sHist = &hist.matchLengths
		}
		if sNew.repeat {
			if sHist.fse == nil {
				return nil, fmt.Errorf("sequence stream %d, repeat requested, but no history", i)
			}
			continue
		}
		if sNew.fse == nil {
			return nil, fmt.Errorf("sequence stream %d, no fse found", i)
		}
		if sHist.fse != nil && !sHist.fse.preDefined {
			fseDecoderPool.Put(sHist.fse)
		}
		sHist.fse = sNew.fse
	}
	return hist, nil
}
683945
func (c *CandleService) HistoryWithQuery(
	symbol string,
	resolution bitfinex.CandleResolution,
	start bitfinex.Mts,
	end bitfinex.Mts,
	limit bitfinex.QueryLimit,
	sort bitfinex.SortOrder,
	) (*bitfinex.CandleSnapshot, error) {

		if symbol == "" {
		return nil, fmt.Errorf("symbol cannot be empty")
	}

	segments := []string{ "trade", string(resolution), symbol }

	req := NewRequestWithMethod(path.Join("candles", strings.Join(segments,":"), "HIST"), "GET")
	req.Params = make(url.Values)

	//req.Params.Add("end", strconv.FormatInt(start, 10))
	//req.Params.Add("end", strconv.FormatInt(start, 10))
	req.Params.Add("end", string(end))
	req.Params.Add("start", string(start))
	req.Params.Add("limit", string(limit))
	req.Params.Add("sort", string(sort))

	raw, err := c.Request(req)

	if err != nil {
		return nil, err
	}

	data := make([][]float64, 0, len(raw))
	for _, ifacearr := range raw {
		if arr, ok := ifacearr.([]interface{}); ok {
			sub := make([]float64, 0, len(arr))
			for _, iface := range arr {
				if flt, ok := iface.(float64); ok {
					sub = append(sub, flt)
				}
			}
			data = append(data, sub)
		}
	}

	cs, err := bitfinex.NewCandleSnapshotFromRaw(symbol, resolution, data)

	if err != nil {
		return nil, err
	}

	return cs, nil
}
930614
func AddHistory(line string) error { // int linenoiseHistoryAdd(const char *line);
	lineCString := C.CString(line)
	res := C.linenoiseHistoryAdd(lineCString)
	C.free(unsafe.Pointer(lineCString))
	if res != 1 {
		return errors.New("Could not add line to history.")
	}
	return nil
}
1262200
func (t *tmNodeSeq) Count() int {
	if t.cnt < 0 {
		return sequtil.SeqCount(t)
	}
	return t.cnt
}
183015
func (s *GroupsService) History(channel string) *GroupsHistoryCall {
	var call GroupsHistoryCall
	call.service = s
	call.channel = channel
	return &call
}
1027187
func (h *DeviceHandler) DeviceHistoryList(nctx context.Context, sessionID int) ([]keybase1.DeviceDetail, error) {
	uis := libkb.UIs{
		LogUI:     h.getLogUI(sessionID),
		SessionID: sessionID,
	}
	eng := engine.NewDeviceHistorySelf(h.G())
	m := libkb.NewMetaContext(nctx, h.G()).WithUIs(uis)
	if err := engine.RunEngine2(m, eng); err != nil {
		return nil, err
	}
	return eng.Devices(), nil
}
209034
func (m *metadataTracker) Counts(dev protocol.DeviceID, flag uint32) Counts {
	if bits.OnesCount32(flag) > 1 {
		panic("incorrect usage: set at most one bit in flag")
	}

	m.mut.RLock()
	defer m.mut.RUnlock()

	idx, ok := m.indexes[metaKey{dev, flag}]
	if !ok {
		return Counts{}
	}

	return m.counts.Counts[idx]
}
585861
func (twilio *Twilio) GetSMS(sid string) (smsResponse *SmsResponse, exception *Exception, err error) {
	twilioUrl := twilio.BaseUrl + "/Accounts/" + twilio.AccountSid + "/SMS/Messages/" + sid + ".json"

	res, err := twilio.get(twilioUrl)
	if err != nil {
		return smsResponse, exception, err
	}
	defer res.Body.Close()

	responseBody, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return smsResponse, exception, err
	}

	if res.StatusCode != http.StatusOK {
		exception = new(Exception)
		err = json.Unmarshal(responseBody, exception)

		// We aren't checking the error because we don't actually care.
		// It's going to be passed to the client either way.
		return smsResponse, exception, err
	}

	smsResponse = new(SmsResponse)
	err = json.Unmarshal(responseBody, smsResponse)
	return smsResponse, exception, err
}
133584
func (twilio *Twilio) SendSMS(from, to, body, statusCallback, applicationSid string) (smsResponse *SmsResponse, exception *Exception, err error) {
	formValues := initFormValues(to, body, "", statusCallback, applicationSid)
	formValues.Set("From", from)

	smsResponse, exception, err = twilio.sendMessage(formValues)
	return
}
834779
func (s *ChannelsService) History(channel string) *ChannelsHistoryCall {
	var call ChannelsHistoryCall
	call.service = s
	call.channel = channel
	return &call
}
706164
func _baseHistory(fname string, size int) (*history, error) {
	file, err := os.OpenFile(fname, os.O_CREATE|os.O_RDWR, HistoryPerm)
	if err != nil {
		return nil, err
	}

	h := new(history)
	h.Cap = size
	h.filename = fname
	h.file = file
	h.li = list.New()

	return h, nil
}
5338
func (s *AlarmHistoryItem) SetHistorySummary(v string) *AlarmHistoryItem {
	s.HistorySummary = &v
	return s
}
87740
func MillisecondsSince(t time.Time) int {
	return int(time.Since(t) / time.Millisecond)
}
700855
func (s *GetMetricDataInput) SetHistoricalMetrics(v []*HistoricalMetric) *GetMetricDataInput {
	s.HistoricalMetrics = v
	return s
}