[GO Gin Server] Webhooks support: add missing webhook handlers (#17411)

* Implement postProcessWebhooksWithModels

* Implement postProcessWebhooksWithModels

* Add missing webhook handlers

* Test webhook handler

* Generate samples
This commit is contained in:
Beppe Catanese
2023-12-21 09:10:09 +01:00
committed by GitHub
parent b20c8db281
commit a34eeaed77
7 changed files with 260 additions and 72 deletions

View File

@@ -14,29 +14,62 @@ import (
)
type PetAPI struct {
// Post /v2/pet
// Add a new pet to the store
AddPet gin.HandlerFunc
// Delete /v2/pet/:petId
// Deletes a pet
DeletePet gin.HandlerFunc
// Get /v2/pet/findByStatus
// Finds Pets by status
FindPetsByStatus gin.HandlerFunc
// Get /v2/pet/findByTags
// Finds Pets by tags
// Deprecated
FindPetsByTags gin.HandlerFunc
// Get /v2/pet/:petId
// Find pet by ID
GetPetById gin.HandlerFunc
// Put /v2/pet
// Update an existing pet
UpdatePet gin.HandlerFunc
// Post /v2/pet/:petId
// Updates a pet in the store with form data
UpdatePetWithForm gin.HandlerFunc
// Post /v2/pet/:petId/uploadImage
// uploads an image
UploadFile gin.HandlerFunc
}
// Post /v2/pet
// Add a new pet to the store
func (api *PetAPI) AddPet(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Delete /v2/pet/:petId
// Deletes a pet
func (api *PetAPI) DeletePet(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Get /v2/pet/findByStatus
// Finds Pets by status
func (api *PetAPI) FindPetsByStatus(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Get /v2/pet/findByTags
// Finds Pets by tags
// Deprecated
func (api *PetAPI) FindPetsByTags(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Get /v2/pet/:petId
// Find pet by ID
func (api *PetAPI) GetPetById(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Put /v2/pet
// Update an existing pet
func (api *PetAPI) UpdatePet(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Post /v2/pet/:petId
// Updates a pet in the store with form data
func (api *PetAPI) UpdatePetWithForm(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Post /v2/pet/:petId/uploadImage
// uploads an image
func (api *PetAPI) UploadFile(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}

View File

@@ -14,16 +14,33 @@ import (
)
type StoreAPI struct {
// Delete /v2/store/order/:orderId
// Delete purchase order by ID
DeleteOrder gin.HandlerFunc
// Get /v2/store/inventory
// Returns pet inventories by status
GetInventory gin.HandlerFunc
// Get /v2/store/order/:orderId
// Find purchase order by ID
GetOrderById gin.HandlerFunc
// Post /v2/store/order
// Place an order for a pet
PlaceOrder gin.HandlerFunc
}
// Delete /v2/store/order/:orderId
// Delete purchase order by ID
func (api *StoreAPI) DeleteOrder(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Get /v2/store/inventory
// Returns pet inventories by status
func (api *StoreAPI) GetInventory(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Get /v2/store/order/:orderId
// Find purchase order by ID
func (api *StoreAPI) GetOrderById(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Post /v2/store/order
// Place an order for a pet
func (api *StoreAPI) PlaceOrder(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}

View File

@@ -14,28 +14,61 @@ import (
)
type UserAPI struct {
// Post /v2/user
// Create user
CreateUser gin.HandlerFunc
// Post /v2/user/createWithArray
// Creates list of users with given input array
CreateUsersWithArrayInput gin.HandlerFunc
// Post /v2/user/createWithList
// Creates list of users with given input array
CreateUsersWithListInput gin.HandlerFunc
// Delete /v2/user/:username
// Delete user
DeleteUser gin.HandlerFunc
// Get /v2/user/:username
// Get user by user name
GetUserByName gin.HandlerFunc
// Get /v2/user/login
// Logs user into the system
LoginUser gin.HandlerFunc
// Get /v2/user/logout
// Logs out current logged in user session
LogoutUser gin.HandlerFunc
// Put /v2/user/:username
// Updated user
UpdateUser gin.HandlerFunc
}
// Post /v2/user
// Create user
func (api *UserAPI) CreateUser(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Post /v2/user/createWithArray
// Creates list of users with given input array
func (api *UserAPI) CreateUsersWithArrayInput(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Post /v2/user/createWithList
// Creates list of users with given input array
func (api *UserAPI) CreateUsersWithListInput(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Delete /v2/user/:username
// Delete user
func (api *UserAPI) DeleteUser(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Get /v2/user/:username
// Get user by user name
func (api *UserAPI) GetUserByName(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Get /v2/user/login
// Logs user into the system
func (api *UserAPI) LoginUser(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Get /v2/user/logout
// Logs out current logged in user session
func (api *UserAPI) LogoutUser(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}
// Put /v2/user/:username
// Updated user
func (api *UserAPI) UpdateUser(c *gin.Context) {
// Your handler implementation
c.JSON(200, gin.H{"status": "OK"})
}