// Type sends a typing message and simulates delay (max 2000ms) based on message size.
544392
func (b *Bot) Type(evt *slack.MessageEvent, msg interface{}) {
	msgLen := msgLen(msg)

	sleepDuration := time.Minute * time.Duration(msgLen) / 3000
	if sleepDuration > maxTypingSleepMs {
		sleepDuration = maxTypingSleepMs
	}

	b.RTM.SendMessage(b.RTM.NewTypingMessage(evt.Channel))
	time.Sleep(sleepDuration)
}
720946
func (self *Commands) Type(input interface{}, args *TypeArgs) (string, error) {
	if args == nil {
		args = &TypeArgs{}
	}

	text := typeutil.V(input).String()
	defaults.SetDefaults(args)

	args.KeyDownTime = utils.FudgeDuration(args.KeyDownTime)
	args.KeyDownJitter = utils.FudgeDuration(args.KeyDownJitter)
	args.Delay = utils.FudgeDuration(args.Delay)
	args.DelayJitter = utils.FudgeDuration(args.DelayJitter)

	for _, char := range text {
		// send the keyDown event
		if _, err := self.browser.Tab().RPC(`Input`, `dispatchKeyEvent`, map[string]interface{}{
			`type`:     `keyDown`,
			`text`:     string(char),
			`isKeypad`: args.IsKeypad,
		}); err == nil {
			if args.KeyDownTime > 0 {
				time.Sleep(
					args.KeyDownTime + (time.Duration(float64(args.KeyDownJitter)*rand.Float64()) * time.Millisecond),
				)
			}
		} else {
			return ``, err
		}

		// send the keyUp event
		if _, err := self.browser.Tab().RPC(`Input`, `dispatchKeyEvent`, map[string]interface{}{
			`type`: `keyUp`,
		}); err != nil {
			return ``, err
		}

		// simulate the time between key presses
		if args.Delay > 0 {
			time.Sleep(
				args.Delay + (time.Duration(float64(args.DelayJitter)*rand.Float64()) * time.Millisecond),
			)
		}
	}

	return text, nil
}
349128
func (s *IndicesExistsTypeService) Type(typ ...string) *IndicesExistsTypeService {
	s.typ = append(s.typ, typ...)
	return s
}
434783
func (s *TermvectorsService) Type(typ string) *TermvectorsService {
	s.typ = typ
	return s
}
436758
func Type(opts ...*TypeOpts) fibre.MiddlewareFunc {
	return func(h fibre.HandlerFunc) fibre.HandlerFunc {
		return func(c *fibre.Context) error {

			var config *TypeOpts

			switch len(opts) {
			case 0:
				return h(c)
			default:
				config = opts[0]
			}

			// This is a socket
			if c.IsSocket() {
				return h(c)
			}

			// No config has been set
			if len(config.AllowedContent) == 0 {
				return h(c)
			}

			// Content type is within allowed types
			if _, ok := config.AllowedContent[c.Type()]; ok {
				return h(c)
			}

			return fibre.NewHTTPError(415)

		}
	}
}
1004615
func (s *ScanService) Type(typ string) *ScanService {
	if s.types == nil {
		s.types = make([]string, 0)
	}
	s.types = append(s.types, typ)
	return s
}
378844
func (s *UpdateByQueryService) Type(typ ...string) *UpdateByQueryService {
	s.typ = append(s.typ, typ...)
	return s
}
700792
func (s *IndicesGetFieldMappingService) Type(types ...string) *IndicesGetFieldMappingService {
	s.typ = append(s.typ, types...)
	return s
}
200912
func (t *Token) Type() string {
	if strings.EqualFold(t.TokenType, "bearer") {
		return "Bearer"
	}
	if strings.EqualFold(t.TokenType, "mac") {
		return "MAC"
	}
	if strings.EqualFold(t.TokenType, "basic") {
		return "Basic"
	}
	if t.TokenType != "" {
		return t.TokenType
	}
	return "Bearer"
}
259663
func (d *driver) Type(ctx types.Context) (types.StorageType, error) {
	return types.Object, nil
}
917018
func (r *Request) Type(name string) *Request {
	r.Use(bodytype.Set(name))
	return r
}
1339502
func (s *IndicesGetMappingService) Type(types ...string) *IndicesGetMappingService {
	s.typ = append(s.typ, types...)
	return s
}
941691
func (r *Request) Type() string {
	if r.Req == nil {
		return ""
	}
	if len(r.Req.Question) == 0 {
		return ""
	}

	return dns.Type(r.Req.Question[0].Qtype).String()
}
1149502
func (s *DeleteByQueryService) Type(typ ...string) *DeleteByQueryService {
	s.typ = append(s.typ, typ...)
	return s
}
541471
func (s *ExplainService) Type(typ string) *ExplainService {
	s.typ = typ
	return s
}
1279910
func (s *IndicesStatsService) Types(types ...string) *IndicesStatsService {
	s.types = append(s.types, types...)
	return s
}
563101
func (s *SnapshotCreateRepositoryService) Type(typ string) *SnapshotCreateRepositoryService {
	s.typ = typ
	return s
}