operations

package
v0.0.0-...-b394ddd Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TutorAPI

type TutorAPI 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

	// OAuth2Auth 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
	OAuth2Auth func(string, []string) (*models.Principal, error)

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

	// RoleAddAdminHandler sets the operation handler for the add admin operation
	RoleAddAdminHandler role.AddAdminHandler
	// RoleAddCalendarHandler sets the operation handler for the add calendar operation
	RoleAddCalendarHandler role.AddCalendarHandler
	// RoleAddTutorHandler sets the operation handler for the add tutor operation
	RoleAddTutorHandler role.AddTutorHandler
	// AuthenticationCallbackHandler sets the operation handler for the callback operation
	AuthenticationCallbackHandler authentication.CallbackHandler
	// EventCreateEventHandler sets the operation handler for the create event operation
	EventCreateEventHandler event.CreateEventHandler
	// EventTypeCreateTypeHandler sets the operation handler for the create type operation
	EventTypeCreateTypeHandler event_type.CreateTypeHandler
	// UserCreateUserHandler sets the operation handler for the create user operation
	UserCreateUserHandler user.CreateUserHandler
	// EventDeleteEventHandler sets the operation handler for the delete event operation
	EventDeleteEventHandler event.DeleteEventHandler
	// UserDeleteMeHandler sets the operation handler for the delete me operation
	UserDeleteMeHandler user.DeleteMeHandler
	// EventTypeDeleteTypeHandler sets the operation handler for the delete type operation
	EventTypeDeleteTypeHandler event_type.DeleteTypeHandler
	// UserDeleteUserHandler sets the operation handler for the delete user operation
	UserDeleteUserHandler user.DeleteUserHandler
	// EventGetEventTypeHandler sets the operation handler for the get event type operation
	EventGetEventTypeHandler event.GetEventTypeHandler
	// EventListEventHandler sets the operation handler for the list event operation
	EventListEventHandler event.ListEventHandler
	// EventListEventUsersHandler sets the operation handler for the list event users operation
	EventListEventUsersHandler event.ListEventUsersHandler
	// EventListEventWithUsersHandler sets the operation handler for the list event with users operation
	EventListEventWithUsersHandler event.ListEventWithUsersHandler
	// UserListMeEventsHandler sets the operation handler for the list me events operation
	UserListMeEventsHandler user.ListMeEventsHandler
	// UserListMeRolesHandler sets the operation handler for the list me roles operation
	UserListMeRolesHandler user.ListMeRolesHandler
	// RoleListRoleHandler sets the operation handler for the list role operation
	RoleListRoleHandler role.ListRoleHandler
	// EventTypeListTypeHandler sets the operation handler for the list type operation
	EventTypeListTypeHandler event_type.ListTypeHandler
	// EventTypeListTypeEventsHandler sets the operation handler for the list type events operation
	EventTypeListTypeEventsHandler event_type.ListTypeEventsHandler
	// UserListUserHandler sets the operation handler for the list user operation
	UserListUserHandler user.ListUserHandler
	// UserListUserEventsHandler sets the operation handler for the list user events operation
	UserListUserEventsHandler user.ListUserEventsHandler
	// UserListUserRolesHandler sets the operation handler for the list user roles operation
	UserListUserRolesHandler user.ListUserRolesHandler
	// AuthenticationLoginHandler sets the operation handler for the login operation
	AuthenticationLoginHandler authentication.LoginHandler
	// EventReadEventHandler sets the operation handler for the read event operation
	EventReadEventHandler event.ReadEventHandler
	// UserReadMeHandler sets the operation handler for the read me operation
	UserReadMeHandler user.ReadMeHandler
	// EventTypeReadTypeHandler sets the operation handler for the read type operation
	EventTypeReadTypeHandler event_type.ReadTypeHandler
	// UserReadUserHandler sets the operation handler for the read user operation
	UserReadUserHandler user.ReadUserHandler
	// RoleRemoveAdminHandler sets the operation handler for the remove admin operation
	RoleRemoveAdminHandler role.RemoveAdminHandler
	// RoleRemoveCalendarHandler sets the operation handler for the remove calendar operation
	RoleRemoveCalendarHandler role.RemoveCalendarHandler
	// RoleRemoveTutorHandler sets the operation handler for the remove tutor operation
	RoleRemoveTutorHandler role.RemoveTutorHandler
	// EventSetEventTypeHandler sets the operation handler for the set event type operation
	EventSetEventTypeHandler event.SetEventTypeHandler
	// UserSubscribeMeHandler sets the operation handler for the subscribe me operation
	UserSubscribeMeHandler user.SubscribeMeHandler
	// UserSubscribeUserHandler sets the operation handler for the subscribe user operation
	UserSubscribeUserHandler user.SubscribeUserHandler
	// AuthenticationTokenInfoHandler sets the operation handler for the token info operation
	AuthenticationTokenInfoHandler authentication.TokenInfoHandler
	// AuthenticationTokenRefreshHandler sets the operation handler for the token refresh operation
	AuthenticationTokenRefreshHandler authentication.TokenRefreshHandler
	// UserUnsubscribeMeHandler sets the operation handler for the unsubscribe me operation
	UserUnsubscribeMeHandler user.UnsubscribeMeHandler
	// UserUnsubscribeUserHandler sets the operation handler for the unsubscribe user operation
	UserUnsubscribeUserHandler user.UnsubscribeUserHandler
	// EventUpdateEventHandler sets the operation handler for the update event operation
	EventUpdateEventHandler event.UpdateEventHandler
	// UserUpdateMeHandler sets the operation handler for the update me operation
	UserUpdateMeHandler user.UpdateMeHandler
	// EventTypeUpdateTypeHandler sets the operation handler for the update type operation
	EventTypeUpdateTypeHandler event_type.UpdateTypeHandler
	// UserUpdateUserHandler sets the operation handler for the update user operation
	UserUpdateUserHandler user.UpdateUserHandler

	// 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
}

TutorAPI An API for 42 tutors.

func NewTutorAPI

func NewTutorAPI(spec *loads.Document) *TutorAPI

NewTutorAPI creates a new Tutor instance

func (*TutorAPI) AddMiddlewareFor

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

AddMiddlewareFor adds a http middleware to existing handler

func (*TutorAPI) AuthenticatorsFor

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

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*TutorAPI) Authorizer

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

Authorizer returns the registered authorizer

func (*TutorAPI) ConsumersFor

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

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

func (*TutorAPI) Context

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

Context returns the middleware context for the tutor API

func (*TutorAPI) DefaultConsumes

func (o *TutorAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*TutorAPI) DefaultProduces

func (o *TutorAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*TutorAPI) Formats

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

Formats returns the registered string formats

func (*TutorAPI) HandlerFor

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

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

func (*TutorAPI) Init

func (o *TutorAPI) Init()

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

func (*TutorAPI) ProducersFor

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

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

func (*TutorAPI) RegisterConsumer

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

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

func (*TutorAPI) RegisterFormat

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

RegisterFormat registers a custom format validator

func (*TutorAPI) RegisterProducer

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

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

func (*TutorAPI) Serve

func (o *TutorAPI) 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 (*TutorAPI) ServeErrorFor

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

ServeErrorFor gets a error handler for a given operation id

func (*TutorAPI) SetDefaultConsumes

func (o *TutorAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*TutorAPI) SetDefaultProduces

func (o *TutorAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*TutorAPI) SetSpec

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

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

func (*TutorAPI) UseRedoc

func (o *TutorAPI) UseRedoc()

UseRedoc for documentation at /docs

func (*TutorAPI) UseSwaggerUI

func (o *TutorAPI) UseSwaggerUI()

UseSwaggerUI for documentation at /docs

func (*TutorAPI) Validate

func (o *TutorAPI) Validate() error

Validate validates the registrations in the TutorAPI

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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