operations

package
v4.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CleverAPI

type CleverAPI struct {
	Middleware func(middleware.Builder) http.Handler

	// BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function.
	// It has a default implementation in the security package, however you can replace it for your particular usage.
	BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator

	// APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function.
	// It has a default implementation in the security package, however you can replace it for your particular usage.
	APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator

	// BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function.
	// It has a default implementation in the security package, however you can replace it for your particular usage.
	BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator

	// JSONConsumer registers a consumer for the following mime types:
	//   - application/json
	JSONConsumer runtime.Consumer

	// JSONProducer registers a producer for the following mime types:
	//   - application/json
	JSONProducer runtime.Producer

	// OauthAuth registers a function that takes an access token and a collection of required scopes and returns a principal
	// it performs authentication based on an oauth2 bearer token provided in the request
	OauthAuth func(string, []string) (interface{}, error)

	// APIAuthorizer provides access control (ACL/RBAC/ABAC) by providing access to the request and authenticated principal
	APIAuthorizer runtime.Authorizer

	// UsersGetContactsForUserHandler sets the operation handler for the get contacts for user operation
	UsersGetContactsForUserHandler users.GetContactsForUserHandler
	// CoursesGetCourseHandler sets the operation handler for the get course operation
	CoursesGetCourseHandler courses.GetCourseHandler
	// SectionsGetCourseForSectionHandler sets the operation handler for the get course for section operation
	SectionsGetCourseForSectionHandler sections.GetCourseForSectionHandler
	// CoursesGetCoursesHandler sets the operation handler for the get courses operation
	CoursesGetCoursesHandler courses.GetCoursesHandler
	// ResourcesGetCoursesForResourceHandler sets the operation handler for the get courses for resource operation
	ResourcesGetCoursesForResourceHandler resources.GetCoursesForResourceHandler
	// SchoolsGetCoursesForSchoolHandler sets the operation handler for the get courses for school operation
	SchoolsGetCoursesForSchoolHandler schools.GetCoursesForSchoolHandler
	// DistrictsGetDistrictHandler sets the operation handler for the get district operation
	DistrictsGetDistrictHandler districts.GetDistrictHandler
	// CoursesGetDistrictForCourseHandler sets the operation handler for the get district for course operation
	CoursesGetDistrictForCourseHandler courses.GetDistrictForCourseHandler
	// SchoolsGetDistrictForSchoolHandler sets the operation handler for the get district for school operation
	SchoolsGetDistrictForSchoolHandler schools.GetDistrictForSchoolHandler
	// SectionsGetDistrictForSectionHandler sets the operation handler for the get district for section operation
	SectionsGetDistrictForSectionHandler sections.GetDistrictForSectionHandler
	// TermsGetDistrictForTermHandler sets the operation handler for the get district for term operation
	TermsGetDistrictForTermHandler terms.GetDistrictForTermHandler
	// UsersGetDistrictForUserHandler sets the operation handler for the get district for user operation
	UsersGetDistrictForUserHandler users.GetDistrictForUserHandler
	// DistrictsGetDistrictsHandler sets the operation handler for the get districts operation
	DistrictsGetDistrictsHandler districts.GetDistrictsHandler
	// EventsGetEventHandler sets the operation handler for the get event operation
	EventsGetEventHandler events.GetEventHandler
	// EventsGetEventsHandler sets the operation handler for the get events operation
	EventsGetEventsHandler events.GetEventsHandler
	// ResourcesGetResourceHandler sets the operation handler for the get resource operation
	ResourcesGetResourceHandler resources.GetResourceHandler
	// ResourcesGetResourcesHandler sets the operation handler for the get resources operation
	ResourcesGetResourcesHandler resources.GetResourcesHandler
	// CoursesGetResourcesForCourseHandler sets the operation handler for the get resources for course operation
	CoursesGetResourcesForCourseHandler courses.GetResourcesForCourseHandler
	// SectionsGetResourcesForSectionHandler sets the operation handler for the get resources for section operation
	SectionsGetResourcesForSectionHandler sections.GetResourcesForSectionHandler
	// UsersGetResourcesForUserHandler sets the operation handler for the get resources for user operation
	UsersGetResourcesForUserHandler users.GetResourcesForUserHandler
	// SchoolsGetSchoolHandler sets the operation handler for the get school operation
	SchoolsGetSchoolHandler schools.GetSchoolHandler
	// SectionsGetSchoolForSectionHandler sets the operation handler for the get school for section operation
	SectionsGetSchoolForSectionHandler sections.GetSchoolForSectionHandler
	// SchoolsGetSchoolsHandler sets the operation handler for the get schools operation
	SchoolsGetSchoolsHandler schools.GetSchoolsHandler
	// CoursesGetSchoolsForCourseHandler sets the operation handler for the get schools for course operation
	CoursesGetSchoolsForCourseHandler courses.GetSchoolsForCourseHandler
	// TermsGetSchoolsForTermHandler sets the operation handler for the get schools for term operation
	TermsGetSchoolsForTermHandler terms.GetSchoolsForTermHandler
	// UsersGetSchoolsForUserHandler sets the operation handler for the get schools for user operation
	UsersGetSchoolsForUserHandler users.GetSchoolsForUserHandler
	// SectionsGetSectionHandler sets the operation handler for the get section operation
	SectionsGetSectionHandler sections.GetSectionHandler
	// SectionsGetSectionsHandler sets the operation handler for the get sections operation
	SectionsGetSectionsHandler sections.GetSectionsHandler
	// CoursesGetSectionsForCourseHandler sets the operation handler for the get sections for course operation
	CoursesGetSectionsForCourseHandler courses.GetSectionsForCourseHandler
	// ResourcesGetSectionsForResourceHandler sets the operation handler for the get sections for resource operation
	ResourcesGetSectionsForResourceHandler resources.GetSectionsForResourceHandler
	// SchoolsGetSectionsForSchoolHandler sets the operation handler for the get sections for school operation
	SchoolsGetSectionsForSchoolHandler schools.GetSectionsForSchoolHandler
	// TermsGetSectionsForTermHandler sets the operation handler for the get sections for term operation
	TermsGetSectionsForTermHandler terms.GetSectionsForTermHandler
	// UsersGetSectionsForUserHandler sets the operation handler for the get sections for user operation
	UsersGetSectionsForUserHandler users.GetSectionsForUserHandler
	// UsersGetStudentsForUserHandler sets the operation handler for the get students for user operation
	UsersGetStudentsForUserHandler users.GetStudentsForUserHandler
	// UsersGetTeachersForUserHandler sets the operation handler for the get teachers for user operation
	UsersGetTeachersForUserHandler users.GetTeachersForUserHandler
	// TermsGetTermHandler sets the operation handler for the get term operation
	TermsGetTermHandler terms.GetTermHandler
	// SectionsGetTermForSectionHandler sets the operation handler for the get term for section operation
	SectionsGetTermForSectionHandler sections.GetTermForSectionHandler
	// TermsGetTermsHandler sets the operation handler for the get terms operation
	TermsGetTermsHandler terms.GetTermsHandler
	// SchoolsGetTermsForSchoolHandler sets the operation handler for the get terms for school operation
	SchoolsGetTermsForSchoolHandler schools.GetTermsForSchoolHandler
	// UsersGetUserHandler sets the operation handler for the get user operation
	UsersGetUserHandler users.GetUserHandler
	// UsersGetUsersHandler sets the operation handler for the get users operation
	UsersGetUsersHandler users.GetUsersHandler
	// ResourcesGetUsersForResourceHandler sets the operation handler for the get users for resource operation
	ResourcesGetUsersForResourceHandler resources.GetUsersForResourceHandler
	// SchoolsGetUsersForSchoolHandler sets the operation handler for the get users for school operation
	SchoolsGetUsersForSchoolHandler schools.GetUsersForSchoolHandler
	// SectionsGetUsersForSectionHandler sets the operation handler for the get users for section operation
	SectionsGetUsersForSectionHandler sections.GetUsersForSectionHandler

	// ServeError is called when an error is received, there is a default handler
	// but you can set your own with this
	ServeError func(http.ResponseWriter, *http.Request, error)

	// PreServerShutdown is called before the HTTP(S) server is shutdown
	// This allows for custom functions to get executed before the HTTP(S) server stops accepting traffic
	PreServerShutdown func()

	// ServerShutdown is called when the HTTP(S) server is shut down and done
	// handling all active connections and does not accept connections any more
	ServerShutdown func()

	// Custom command line argument groups with their descriptions
	CommandLineOptionsGroups []swag.CommandLineOptionsGroup

	// User defined logger function.
	Logger func(string, ...interface{})
	// contains filtered or unexported fields
}

CleverAPI Serves the Clever Data API

func NewCleverAPI

func NewCleverAPI(spec *loads.Document) *CleverAPI

NewCleverAPI creates a new Clever instance

func (*CleverAPI) AddMiddlewareFor

func (o *CleverAPI) AddMiddlewareFor(method, path string, builder middleware.Builder)

AddMiddlewareFor adds a http middleware to existing handler

func (*CleverAPI) AuthenticatorsFor

func (o *CleverAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*CleverAPI) Authorizer

func (o *CleverAPI) Authorizer() runtime.Authorizer

Authorizer returns the registered authorizer

func (*CleverAPI) ConsumersFor

func (o *CleverAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer

ConsumersFor gets the consumers for the specified media types. MIME type parameters are ignored here.

func (*CleverAPI) Context

func (o *CleverAPI) Context() *middleware.Context

Context returns the middleware context for the clever API

func (*CleverAPI) DefaultConsumes

func (o *CleverAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*CleverAPI) DefaultProduces

func (o *CleverAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*CleverAPI) Formats

func (o *CleverAPI) Formats() strfmt.Registry

Formats returns the registered string formats

func (*CleverAPI) HandlerFor

func (o *CleverAPI) HandlerFor(method, path string) (http.Handler, bool)

HandlerFor gets a http.Handler for the provided operation method and path

func (*CleverAPI) Init

func (o *CleverAPI) Init()

Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit

func (*CleverAPI) ProducersFor

func (o *CleverAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer

ProducersFor gets the producers for the specified media types. MIME type parameters are ignored here.

func (*CleverAPI) RegisterConsumer

func (o *CleverAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer)

RegisterConsumer allows you to add (or override) a consumer for a media type.

func (*CleverAPI) RegisterFormat

func (o *CleverAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator)

RegisterFormat registers a custom format validator

func (*CleverAPI) RegisterProducer

func (o *CleverAPI) RegisterProducer(mediaType string, producer runtime.Producer)

RegisterProducer allows you to add (or override) a producer for a media type.

func (*CleverAPI) Serve

func (o *CleverAPI) Serve(builder middleware.Builder) http.Handler

Serve creates a http handler to serve the API over HTTP can be used directly in http.ListenAndServe(":8000", api.Serve(nil))

func (*CleverAPI) ServeErrorFor

func (o *CleverAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error)

ServeErrorFor gets a error handler for a given operation id

func (*CleverAPI) SetDefaultConsumes

func (o *CleverAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*CleverAPI) SetDefaultProduces

func (o *CleverAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*CleverAPI) SetSpec

func (o *CleverAPI) SetSpec(spec *loads.Document)

SetSpec sets a spec that will be served for the clients.

func (*CleverAPI) UseRedoc

func (o *CleverAPI) UseRedoc()

UseRedoc for documentation at /docs

func (*CleverAPI) UseSwaggerUI

func (o *CleverAPI) UseSwaggerUI()

UseSwaggerUI for documentation at /docs

func (*CleverAPI) Validate

func (o *CleverAPI) Validate() error

Validate validates the registrations in the CleverAPI

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL