petstoreserver

package
v4.1.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

README

Go API Server for petstoreserver

This is a sample server Petstore server. For this sample, you can use the api key special-key to test the authorization filters.

Overview

This server was generated by the [openapi-generator] (https://openapi-generator.tech) project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.

To see how to make this your own, look here:

README

  • API version: 1.0.0
Running the server

To run the server, follow these simple steps:

go run main.go

To run the server in a docker container

docker build --network=host -t petstoreserver .

Once the image is built, just run

docker run --rm -it petstoreserver 
Known Issue

Endpoints sharing a common path may result in issues. For example, /v2/pet/findByTags and /v2/pet/:petId will result in an issue with the Gin framework. For more information about this known limitation, please refer to gin-gonic/gin#388 for more information.

A workaround is to manually update the path and handler. Please refer to gin-gonic/gin/issues/205#issuecomment-296155497 for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPet

func AddPet(c *gin.Context)

AddPet - Add a new pet to the store

func CreateUser

func CreateUser(c *gin.Context)

CreateUser - Create user

func CreateUsersWithArrayInput

func CreateUsersWithArrayInput(c *gin.Context)

CreateUsersWithArrayInput - Creates list of users with given input array

func CreateUsersWithListInput

func CreateUsersWithListInput(c *gin.Context)

CreateUsersWithListInput - Creates list of users with given input array

func DeleteOrder

func DeleteOrder(c *gin.Context)

DeleteOrder - Delete purchase order by ID

func DeletePet

func DeletePet(c *gin.Context)

DeletePet - Deletes a pet

func DeleteUser

func DeleteUser(c *gin.Context)

DeleteUser - Delete user

func FindPetsByStatus

func FindPetsByStatus(c *gin.Context)

FindPetsByStatus - Finds Pets by status

func FindPetsByTags

func FindPetsByTags(c *gin.Context)

FindPetsByTags - Finds Pets by tags

func GetInventory

func GetInventory(c *gin.Context)

GetInventory - Returns pet inventories by status

func GetOrderById

func GetOrderById(c *gin.Context)

GetOrderById - Find purchase order by ID

func GetPetById

func GetPetById(c *gin.Context)

GetPetById - Find pet by ID

func GetUserByName

func GetUserByName(c *gin.Context)

GetUserByName - Get user by user name

func Index

func Index(c *gin.Context)

Index is the index handler.

func LoginUser

func LoginUser(c *gin.Context)

LoginUser - Logs user into the system

func LogoutUser

func LogoutUser(c *gin.Context)

LogoutUser - Logs out current logged in user session

func NewRouter

func NewRouter() *gin.Engine

NewRouter returns a new router.

func PlaceOrder

func PlaceOrder(c *gin.Context)

PlaceOrder - Place an order for a pet

func UpdatePet

func UpdatePet(c *gin.Context)

UpdatePet - Update an existing pet

func UpdatePetWithForm

func UpdatePetWithForm(c *gin.Context)

UpdatePetWithForm - Updates a pet in the store with form data

func UpdateUser

func UpdateUser(c *gin.Context)

UpdateUser - Updated user

func UploadFile

func UploadFile(c *gin.Context)

UploadFile - uploads an image

Types

type ApiResponse

type ApiResponse struct {
	Code int32 `json:"code,omitempty"`

	Type string `json:"type,omitempty"`

	Message string `json:"message,omitempty"`
}

ApiResponse - Describes the result of uploading an image resource

type Category

type Category struct {
	Id int64 `json:"id,omitempty"`

	Name string `json:"name,omitempty"`
}

Category - A category for a pet

type Order

type Order struct {
	Id int64 `json:"id,omitempty"`

	PetId int64 `json:"petId,omitempty"`

	Quantity int32 `json:"quantity,omitempty"`

	ShipDate time.Time `json:"shipDate,omitempty"`

	// Order Status
	Status string `json:"status,omitempty"`

	Complete bool `json:"complete,omitempty"`
}

Order - An order for a pets from the pet store

type Pet

type Pet struct {
	Id int64 `json:"id,omitempty"`

	Category Category `json:"category,omitempty"`

	Name string `json:"name"`

	PhotoUrls []string `json:"photoUrls"`

	Tags []Tag `json:"tags,omitempty"`

	// pet status in the store
	Status string `json:"status,omitempty"`
}

Pet - A pet for sale in the pet store

type Route

type Route struct {
	// Name is the name of this Route.
	Name string
	// Method is the string for the HTTP method. ex) GET, POST etc..
	Method string
	// Pattern is the pattern of the URI.
	Pattern string
	// HandlerFunc is the handler function of this route.
	HandlerFunc gin.HandlerFunc
}

Route is the information for every URI.

type Routes

type Routes []Route

Routes is the list of the generated Route.

type Tag

type Tag struct {
	Id int64 `json:"id,omitempty"`

	Name string `json:"name,omitempty"`
}

Tag - A tag for a pet

type User

type User struct {
	Id int64 `json:"id,omitempty"`

	Username string `json:"username,omitempty"`

	FirstName string `json:"firstName,omitempty"`

	LastName string `json:"lastName,omitempty"`

	Email string `json:"email,omitempty"`

	Password string `json:"password,omitempty"`

	Phone string `json:"phone,omitempty"`

	// User Status
	UserStatus int32 `json:"userStatus,omitempty"`
}

User - A User who is purchasing from the pet store

Jump to

Keyboard shortcuts

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