func (o *PetStoreAPI) initHandlerCache() {
	if o.context == nil {
		o.context = middleware.NewRoutableContext(o.spec, o, nil)
	}

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

	o.handlers["getPetById"] = pet.NewGetPetByID(o.context, o.GetPetByIDHandler)

	o.handlers["logoutUser"] = user.NewLogoutUser(o.context, o.LogoutUserHandler)

	o.handlers["deleteUser"] = user.NewDeleteUser(o.context, o.DeleteUserHandler)

	o.handlers["deleteOrder"] = store.NewDeleteOrder(o.context, o.DeleteOrderHandler)

	o.handlers["updateUser"] = user.NewUpdateUser(o.context, o.UpdateUserHandler)

	o.handlers["loginUser"] = user.NewLoginUser(o.context, o.LoginUserHandler)

	o.handlers["deletePet"] = pet.NewDeletePet(o.context, o.DeletePetHandler)

	o.handlers["updatePet"] = pet.NewUpdatePet(o.context, o.UpdatePetHandler)

	o.handlers["createUsersWithListInput"] = user.NewCreateUsersWithListInput(o.context, o.CreateUsersWithListInputHandler)

	o.handlers["addPet"] = pet.NewAddPet(o.context, o.AddPetHandler)

	o.handlers["createUser"] = user.NewCreateUser(o.context, o.CreateUserHandler)

	o.handlers["findPetsByStatus"] = pet.NewFindPetsByStatus(o.context, o.FindPetsByStatusHandler)

	o.handlers["getUserByName"] = user.NewGetUserByName(o.context, o.GetUserByNameHandler)

	o.handlers["placeOrder"] = store.NewPlaceOrder(o.context, o.PlaceOrderHandler)

	o.handlers["updatePetWithForm"] = pet.NewUpdatePetWithForm(o.context, o.UpdatePetWithFormHandler)

	o.handlers["getOrderById"] = store.NewGetOrderByID(o.context, o.GetOrderByIDHandler)

	o.handlers["findPetsByTags"] = pet.NewFindPetsByTags(o.context, o.FindPetsByTagsHandler)

	o.handlers["createUsersWithArrayInput"] = user.NewCreateUsersWithArrayInput(o.context, o.CreateUsersWithArrayInputHandler)

}
func (s *SwaggerPetstoreAPI) initHandlerCache() {
	if s.context == nil {
		s.context = middleware.NewRoutableContext(s.spec, s, nil)
	}

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

	s.handlers["addPet"] = pet.NewAddPet(s.context, s.AddPetHandler)

	s.handlers["createUser"] = user.NewCreateUser(s.context, s.CreateUserHandler)

	s.handlers["createUsersWithArrayInput"] = user.NewCreateUsersWithArrayInput(s.context, s.CreateUsersWithArrayInputHandler)

	s.handlers["logoutUser"] = user.NewLogoutUser(s.context, s.LogoutUserHandler)

	s.handlers["updateUser"] = user.NewUpdateUser(s.context, s.UpdateUserHandler)

	s.handlers["findPetsByStatus"] = pet.NewFindPetsByStatus(s.context, s.FindPetsByStatusHandler)

	s.handlers["loginUser"] = user.NewLoginUser(s.context, s.LoginUserHandler)

	s.handlers["getPetById"] = pet.NewGetPetByID(s.context, s.GetPetByIDHandler)

	s.handlers["getOrderById"] = store.NewGetOrderByID(s.context, s.GetOrderByIDHandler)

	s.handlers["getUserByName"] = user.NewGetUserByName(s.context, s.GetUserByNameHandler)

	s.handlers["deletePet"] = pet.NewDeletePet(s.context, s.DeletePetHandler)

	s.handlers["deleteUser"] = user.NewDeleteUser(s.context, s.DeleteUserHandler)

	s.handlers["updatePet"] = pet.NewUpdatePet(s.context, s.UpdatePetHandler)

	s.handlers["createUsersWithListInput"] = user.NewCreateUsersWithListInput(s.context, s.CreateUsersWithListInputHandler)

	s.handlers["placeOrder"] = store.NewPlaceOrder(s.context, s.PlaceOrderHandler)

	s.handlers["updatePetWithForm"] = pet.NewUpdatePetWithForm(s.context, s.UpdatePetWithFormHandler)

	s.handlers["findPetsByTags"] = pet.NewFindPetsByTags(s.context, s.FindPetsByTagsHandler)

	s.handlers["deleteOrder"] = store.NewDeleteOrder(s.context, s.DeleteOrderHandler)

}
Exemple #3
0
func (o *PetstoreAPI) 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["POST"] == nil {
		o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
	}
	o.handlers["POST"]["/pet"] = pet.NewAddPet(o.context, o.PetAddPetHandler)

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

	if o.handlers["POST"] == nil {
		o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
	}
	o.handlers["POST"]["/user/createWithArray"] = user.NewCreateUsersWithArrayInput(o.context, o.UserCreateUsersWithArrayInputHandler)

	if o.handlers["POST"] == nil {
		o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
	}
	o.handlers["POST"]["/user/createWithList"] = user.NewCreateUsersWithListInput(o.context, o.UserCreateUsersWithListInputHandler)

	if o.handlers["DELETE"] == nil {
		o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
	}
	o.handlers["DELETE"]["/store/order/{orderId}"] = store.NewDeleteOrder(o.context, o.StoreDeleteOrderHandler)

	if o.handlers["DELETE"] == nil {
		o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
	}
	o.handlers["DELETE"]["/pet/{petId}"] = pet.NewDeletePet(o.context, o.PetDeletePetHandler)

	if o.handlers["DELETE"] == nil {
		o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
	}
	o.handlers["DELETE"]["/user/{username}"] = user.NewDeleteUser(o.context, o.UserDeleteUserHandler)

	if o.handlers["GET"] == nil {
		o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
	}
	o.handlers["GET"]["/pet/findByStatus"] = pet.NewFindPetsByStatus(o.context, o.PetFindPetsByStatusHandler)

	if o.handlers["GET"] == nil {
		o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
	}
	o.handlers["GET"]["/pet/findByTags"] = pet.NewFindPetsByTags(o.context, o.PetFindPetsByTagsHandler)

	if o.handlers["GET"] == nil {
		o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
	}
	o.handlers["GET"]["/store/inventory"] = store.NewGetInventory(o.context, o.StoreGetInventoryHandler)

	if o.handlers["GET"] == nil {
		o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
	}
	o.handlers["GET"]["/store/order/{orderId}"] = store.NewGetOrderByID(o.context, o.StoreGetOrderByIDHandler)

	if o.handlers["GET"] == nil {
		o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
	}
	o.handlers["GET"]["/pet/{petId}"] = pet.NewGetPetByID(o.context, o.PetGetPetByIDHandler)

	if o.handlers["GET"] == nil {
		o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
	}
	o.handlers["GET"]["/user/{username}"] = user.NewGetUserByName(o.context, o.UserGetUserByNameHandler)

	if o.handlers["GET"] == nil {
		o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
	}
	o.handlers["GET"]["/user/login"] = user.NewLoginUser(o.context, o.UserLoginUserHandler)

	if o.handlers["GET"] == nil {
		o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
	}
	o.handlers["GET"]["/user/logout"] = user.NewLogoutUser(o.context, o.UserLogoutUserHandler)

	if o.handlers["POST"] == nil {
		o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
	}
	o.handlers["POST"]["/store/order"] = store.NewPlaceOrder(o.context, o.StorePlaceOrderHandler)

	if o.handlers["PUT"] == nil {
		o.handlers[strings.ToUpper("PUT")] = make(map[string]http.Handler)
	}
	o.handlers["PUT"]["/pet"] = pet.NewUpdatePet(o.context, o.PetUpdatePetHandler)

	if o.handlers["POST"] == nil {
		o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
	}
	o.handlers["POST"]["/pet/{petId}"] = pet.NewUpdatePetWithForm(o.context, o.PetUpdatePetWithFormHandler)

	if o.handlers["PUT"] == nil {
		o.handlers[strings.ToUpper("PUT")] = make(map[string]http.Handler)
	}
	o.handlers["PUT"]["/user/{username}"] = user.NewUpdateUser(o.context, o.UserUpdateUserHandler)

	if o.handlers["POST"] == nil {
		o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
	}
	o.handlers["POST"]["/pet/{petId}/uploadImage"] = pet.NewUploadFile(o.context, o.PetUploadFileHandler)

}