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: 7 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 image is built use

docker run --rm -it petstoreserver 

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPet

func AddPet(w http.ResponseWriter, r *http.Request)

AddPet - Add a new pet to the store

func CreateUser

func CreateUser(w http.ResponseWriter, r *http.Request)

CreateUser - Create user

func CreateUsersWithArrayInput

func CreateUsersWithArrayInput(w http.ResponseWriter, r *http.Request)

CreateUsersWithArrayInput - Creates list of users with given input array

func CreateUsersWithListInput

func CreateUsersWithListInput(w http.ResponseWriter, r *http.Request)

CreateUsersWithListInput - Creates list of users with given input array

func DeleteOrder

func DeleteOrder(w http.ResponseWriter, r *http.Request)

DeleteOrder - Delete purchase order by ID

func DeletePet

func DeletePet(w http.ResponseWriter, r *http.Request)

DeletePet - Deletes a pet

func DeleteUser

func DeleteUser(w http.ResponseWriter, r *http.Request)

DeleteUser - Delete user

func FindPetsByStatus

func FindPetsByStatus(w http.ResponseWriter, r *http.Request)

FindPetsByStatus - Finds Pets by status

func FindPetsByTags

func FindPetsByTags(w http.ResponseWriter, r *http.Request)

FindPetsByTags - Finds Pets by tags

func GetInventory

func GetInventory(w http.ResponseWriter, r *http.Request)

GetInventory - Returns pet inventories by status

func GetOrderById

func GetOrderById(w http.ResponseWriter, r *http.Request)

GetOrderById - Find purchase order by ID

func GetPetById

func GetPetById(w http.ResponseWriter, r *http.Request)

GetPetById - Find pet by ID

func GetUserByName

func GetUserByName(w http.ResponseWriter, r *http.Request)

GetUserByName - Get user by user name

func Index

func Index(w http.ResponseWriter, r *http.Request)

func Logger

func Logger(inner http.Handler, name string) http.Handler

func LoginUser

func LoginUser(w http.ResponseWriter, r *http.Request)

LoginUser - Logs user into the system

func LogoutUser

func LogoutUser(w http.ResponseWriter, r *http.Request)

LogoutUser - Logs out current logged in user session

func NewRouter

func NewRouter() *mux.Router

func PlaceOrder

func PlaceOrder(w http.ResponseWriter, r *http.Request)

PlaceOrder - Place an order for a pet

func UpdatePet

func UpdatePet(w http.ResponseWriter, r *http.Request)

UpdatePet - Update an existing pet

func UpdatePetWithForm

func UpdatePetWithForm(w http.ResponseWriter, r *http.Request)

UpdatePetWithForm - Updates a pet in the store with form data

func UpdateUser

func UpdateUser(w http.ResponseWriter, r *http.Request)

UpdateUser - Updated user

func UploadFile

func UploadFile(w http.ResponseWriter, r *http.Request)

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 InlineObject

type InlineObject struct {

	// Updated name of the pet
	Name string `json:"name,omitempty"`

	// Updated status of the pet
	Status string `json:"status,omitempty"`
}

type InlineObject1

type InlineObject1 struct {

	// Additional data to pass to server
	AdditionalMetadata string `json:"additionalMetadata,omitempty"`

	// file to upload
	File **os.File `json:"file,omitempty"`
}

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        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

type Routes

type Routes []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