// DjangoContentType returns the DjangoContentType associated with the DjangoAdminLog's ContentTypeID (content_type_id).
//
// Generated from foreign key 'django_admin_log_content_type_id_fkey'.
483415
func (dal *DjangoAdminLog) DjangoContentType(db XODB) (*DjangoContentType, error) {
	return DjangoContentTypeByID(db, int(dal.ContentTypeID.Int64))
}
37648
func (s *CreateModelInput) SetContentType(v string) *CreateModelInput {
	s.ContentType = &v
	return s
}
939540
func (si SignerInfo) GetContentTypeAttribute() (asn1.ObjectIdentifier, error) {
	rv, err := si.SignedAttrs.GetOnlyAttributeValueBytes(oid.AttributeContentType)
	if err != nil {
		return nil, err
	}

	var ct asn1.ObjectIdentifier
	if rest, err := asn1.Unmarshal(rv.FullBytes, &ct); err != nil {
		return nil, err
	} else if len(rest) > 0 {
		return nil, ErrTrailingData
	}

	return ct, nil
}
739194
func (h *Header) ContentType() (t string, params map[string]string, err error) {
	v := h.Get("Content-Type")
	if v == "" {
		return "text/plain", nil, nil
	}
	return parseHeaderWithParams(v)
}
279581
func (s *CreateMultipartUploadInput) SetContentType(v string) *CreateMultipartUploadInput {
	s.ContentType = &v
	return s
}
973249
func DjangoAdminLogsByContentTypeID(db XODB, contentTypeID sql.NullInt64) ([]*DjangoAdminLog, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`id, action_time, object_id, object_repr, action_flag, change_message, content_type_id, user_id ` +
		`FROM public.django_admin_log ` +
		`WHERE content_type_id = $1`

	// run query
	XOLog(sqlstr, contentTypeID)
	q, err := db.Query(sqlstr, contentTypeID)
	if err != nil {
		return nil, err
	}
	defer q.Close()

	// load results
	res := []*DjangoAdminLog{}
	for q.Next() {
		dal := DjangoAdminLog{
			_exists: true,
		}

		// scan
		err = q.Scan(&dal.ID, &dal.ActionTime, &dal.ObjectID, &dal.ObjectRepr, &dal.ActionFlag, &dal.ChangeMessage, &dal.ContentTypeID, &dal.UserID)
		if err != nil {
			return nil, err
		}

		res = append(res, &dal)
	}

	return res, nil
}
557732
func (s *CopyObjectInput) SetContentType(v string) *CopyObjectInput {
	s.ContentType = &v
	return s
}
964551
func getContentSubtype(contentType string) string {
	if !strings.HasPrefix(contentType, baseContentType) || len(contentType) == len(baseContentType) {
		return ""
	}
	switch contentType[len(baseContentType)] {
	case '+', ';':
		return contentType[len(baseContentType)+1:]
	default:
		return ""
	}
}
1195731
func (ctx *Context) ContentType() string {
	return string(ctx.Request.Header.Peek(contentType))
}
129747
func (r *URIBuilder) ContentType(s string) *URIBuilder {
	r.cacheContentType = s
	return r
}
926694
func InvalidContentType(value string, allowed []string) *Validation {
	values := make([]interface{}, 0, len(allowed))
	for _, v := range allowed {
		values = append(values, v)
	}
	return &Validation{
		code:    http.StatusUnsupportedMediaType,
		Name:    "Content-Type",
		In:      "header",
		Value:   value,
		Values:  values,
		message: fmt.Sprintf(contentTypeFail, value, allowed),
	}
}
983
func ContentTypeHandler(h http.Handler, contentTypes ...string) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		if !(r.Method == "PUT" || r.Method == "POST" || r.Method == "PATCH") {
			h.ServeHTTP(w, r)
			return
		}

		for _, ct := range contentTypes {
			if isContentType(r.Header, ct) {
				h.ServeHTTP(w, r)
				return
			}
		}
		http.Error(w, fmt.Sprintf("Unsupported content type %q; expected one of %q", r.Header.Get("Content-Type"), contentTypes), http.StatusUnsupportedMediaType)
	})
}
48061
func (s *DescribeObjectOutput) SetContentType(v string) *DescribeObjectOutput {
	s.ContentType = &v
	return s
}
968426
func (s *TransformInput) SetContentType(v string) *TransformInput {
	s.ContentType = &v
	return s
}
48289
func (c *Config) WithContentType(ct string) *Config {
	c.ContentType = ct
	return c
}
357737
func RouterMiddlewareContentType(contentType string) RouterMiddleware {
	return func(h httprouter.Handle) httprouter.Handle {
		return func(rw http.ResponseWriter, r *http.Request, p httprouter.Params) {
			// Content type
			handleContentType(contentType, rw)

			// Next handler
			h(rw, r, p)
		}
	}
}
891076
func ContentType(ctypes ...string) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		if contentMethod(r.Method) && !checkCT(r.Header.Get("Content-Type"), ctypes...) {
			w.WriteHeader(http.StatusUnsupportedMediaType)
		}
	}
}