Ejemplo n.º 1
0
func (o *EventListAPI) initHandlerCache() {
	if o.context == nil {
		o.context = middleware.NewRoutableContext(o.spec, o, nil)
	}

	if o.handlers == nil {
		o.handlers = make(map[string]map[string]http.Handler)
	}

	if o.handlers["DELETE"] == nil {
		o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
	}
	o.handlers["DELETE"]["/events/{id}"] = events.NewDeleteEventByID(o.context, o.EventsDeleteEventByIDHandler)

	if o.handlers["GET"] == nil {
		o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
	}
	o.handlers["GET"]["/events/{id}"] = events.NewGetEventByID(o.context, o.EventsGetEventByIDHandler)

	if o.handlers["GET"] == nil {
		o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
	}
	o.handlers["GET"]["/events"] = events.NewGetEvents(o.context, o.EventsGetEventsHandler)

	if o.handlers["POST"] == nil {
		o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
	}
	o.handlers["POST"]["/events"] = events.NewPostEvent(o.context, o.EventsPostEventHandler)

	if o.handlers["PUT"] == nil {
		o.handlers[strings.ToUpper("PUT")] = make(map[string]http.Handler)
	}
	o.handlers["PUT"]["/events/{id}"] = events.NewPutEventByID(o.context, o.EventsPutEventByIDHandler)

}
Ejemplo n.º 2
0
func (o *EventListAPI) initHandlerCache() {
	if o.context == nil {
		o.context = middleware.NewRoutableContext(o.spec, o, nil)
	}

	o.handlers = make(map[string]http.Handler)

	o.handlers["deleteEventById"] = events.NewDeleteEventByID(o.context, o.DeleteEventByIDHandler)

	o.handlers["getEventById"] = events.NewGetEventByID(o.context, o.GetEventByIDHandler)

	o.handlers["getEvents"] = events.NewGetEvents(o.context, o.GetEventsHandler)

	o.handlers["postEvent"] = events.NewPostEvent(o.context, o.PostEventHandler)

	o.handlers["putEventById"] = events.NewPutEventByID(o.context, o.PutEventByIDHandler)

}