// PercolateType is the type to percolate document into. Defaults to type.
358041
func (s *PercolateService) PercolateType(percolateType string) *PercolateService {
	s.percolateType = percolateType
	return s
}
1057552
func (q MultiMatchQuery) Type(matchQueryType string) MultiMatchQuery {
	zero := float32(0.0)
	one := float32(1.0)

	switch strings.ToLower(matchQueryType) {
	default: // best_fields / boolean
		q.matchQueryType = "best_fields"
		q.tieBreaker = &zero
	case "most_fields":
		q.matchQueryType = "most_fields"
		q.tieBreaker = &one
	case "cross_fields":
		q.matchQueryType = "cross_fields"
		q.tieBreaker = &zero
	case "phrase":
		q.matchQueryType = "phrase"
		q.tieBreaker = &zero
	case "phrase_prefix":
		q.matchQueryType = "phrase_prefix"
		q.tieBreaker = &zero
	}
	return q
}
806340
func (s *PercolateService) PercolateRouting(percolateRouting string) *PercolateService {
	s.percolateRouting = percolateRouting
	return s
}
700792
func (s *IndicesGetFieldMappingService) Type(types ...string) *IndicesGetFieldMappingService {
	s.typ = append(s.typ, types...)
	return s
}
658565
func (c *Cursor) Type() string {
	if c == nil {
		return "Cursor"
	}

	c.mu.RLock()
	defer c.mu.RUnlock()

	return c.cursorType
}
703117
func (ctx *Context) Type(str string) {
	ctx.Res.Set(HeaderContentType, str)
}
437230
func (s *ScriptSort) Type(typ string) *ScriptSort {
	s.typ = typ
	return s
}
1208956
func (v *Type) GetMapType() (o *TypePair) {
	if v != nil && v.MapType != nil {
		return v.MapType
	}

	return
}
170100
func (s SeriesIDTyped) Type() models.FieldType {
	return models.FieldType((s.ID & seriesIDTypeMask) >> seriesIDTypeShift)
}
24511
func (builder *StoreBucketTypePropsCommandBuilder) WithBucketType(bucketType string) *StoreBucketTypePropsCommandBuilder {
	builder.protobuf.Type = []byte(bucketType)
	return builder
}
775224
func (q *MultiMatchQuery) Type(typ string) *MultiMatchQuery {
	var zero = float64(0.0)
	var one = float64(1.0)

	switch strings.ToLower(typ) {
	default: // best_fields / boolean
		q.typ = "best_fields"
		q.tieBreaker = &zero
	case "most_fields":
		q.typ = "most_fields"
		q.tieBreaker = &one
	case "cross_fields":
		q.typ = "cross_fields"
		q.tieBreaker = &zero
	case "phrase":
		q.typ = "phrase"
		q.tieBreaker = &zero
	case "phrase_prefix":
		q.typ = "phrase_prefix"
		q.tieBreaker = &zero
	}
	return q
}
86812
func NewType(t string) (*Type, error) {
	if strings.ContainsAny(t, " \t\n\r") {
		return nil, fmt.Errorf("node.NewType(%q) does not allow spaces", t)
	}
	if !strings.HasPrefix(t, "/") || strings.HasSuffix(t, "/") {
		return nil, fmt.Errorf("node.NewType(%q) should start with a '/' and do not end with '/'", t)
	}
	if t == "" {
		return nil, fmt.Errorf("node.NewType(%q) cannot create empty types", t)
	}
	nt := Type(t)
	return &nt, nil
}
198022
func NewPercolateService(client *Client) *PercolateService {
	return &PercolateService{
		client:  client,
		routing: make([]string, 0),
	}
}
543702
func (p *parser) parseType() ast.Expr {
	if p.trace {
		defer un(trace(p, "Type"))
	}

	typ := p.tryType()

	if typ == nil {
		pos := p.pos
		p.errorExpected(pos, "type")
		p.next() // make progress
		return &ast.BadExpr{pos, p.pos}
	}

	return typ
}
1016777
func (c *Context) Type() string {
	head := c.Request().Header().Get("Content-Type")
	cont, _, _ := mime.ParseMediaType(head)
	return cont
}
518139
func (builder *FetchSetCommandBuilder) WithBucketType(bucketType string) *FetchSetCommandBuilder {
	builder.protobuf.Type = []byte(bucketType)
	return builder
}
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)

		}
	}
}