github.com/weaviate/weaviate@v1.24.6/adapters/handlers/rest/operations/schema/schema_objects_get.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 // Code generated by go-swagger; DO NOT EDIT. 13 14 package schema 15 16 // This file was generated by the swagger tool. 17 // Editing this file might prove futile when you re-run the generate command 18 19 import ( 20 "net/http" 21 22 "github.com/go-openapi/runtime/middleware" 23 24 "github.com/weaviate/weaviate/entities/models" 25 ) 26 27 // SchemaObjectsGetHandlerFunc turns a function with the right signature into a schema objects get handler 28 type SchemaObjectsGetHandlerFunc func(SchemaObjectsGetParams, *models.Principal) middleware.Responder 29 30 // Handle executing the request and returning a response 31 func (fn SchemaObjectsGetHandlerFunc) Handle(params SchemaObjectsGetParams, principal *models.Principal) middleware.Responder { 32 return fn(params, principal) 33 } 34 35 // SchemaObjectsGetHandler interface for that can handle valid schema objects get params 36 type SchemaObjectsGetHandler interface { 37 Handle(SchemaObjectsGetParams, *models.Principal) middleware.Responder 38 } 39 40 // NewSchemaObjectsGet creates a new http.Handler for the schema objects get operation 41 func NewSchemaObjectsGet(ctx *middleware.Context, handler SchemaObjectsGetHandler) *SchemaObjectsGet { 42 return &SchemaObjectsGet{Context: ctx, Handler: handler} 43 } 44 45 /* 46 SchemaObjectsGet swagger:route GET /schema/{className} schema schemaObjectsGet 47 48 Get a single class from the schema 49 */ 50 type SchemaObjectsGet struct { 51 Context *middleware.Context 52 Handler SchemaObjectsGetHandler 53 } 54 55 func (o *SchemaObjectsGet) ServeHTTP(rw http.ResponseWriter, r *http.Request) { 56 route, rCtx, _ := o.Context.RouteInfo(r) 57 if rCtx != nil { 58 *r = *rCtx 59 } 60 var Params = NewSchemaObjectsGetParams() 61 uprinc, aCtx, err := o.Context.Authorize(r, route) 62 if err != nil { 63 o.Context.Respond(rw, r, route.Produces, route, err) 64 return 65 } 66 if aCtx != nil { 67 *r = *aCtx 68 } 69 var principal *models.Principal 70 if uprinc != nil { 71 principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise 72 } 73 74 if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params 75 o.Context.Respond(rw, r, route.Produces, route, err) 76 return 77 } 78 79 res := o.Handler.Handle(Params, principal) // actually handle the request 80 o.Context.Respond(rw, r, route.Produces, route, res) 81 82 }