petstore

package
v2.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2016 License: Apache-2.0, Apache-2.0 Imports: 13 Imported by: 0

README

Go API client for petstore

This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key special-key to test the authorization filters.

Overview

This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build date: 2016-07-28T00:24:08.914+08:00
  • Build package: class io.swagger.codegen.languages.GoClientCodegen

Installation

Put the package under your project folder and add the following in import:

    "./petstore"

Documentation for API Endpoints

All URIs are relative to http://petstore.swagger.io/v2

Class Method HTTP request Description
PetApi AddPet Post /pet Add a new pet to the store
PetApi DeletePet Delete /pet/{petId} Deletes a pet
PetApi FindPetsByStatus Get /pet/findByStatus Finds Pets by status
PetApi FindPetsByTags Get /pet/findByTags Finds Pets by tags
PetApi GetPetById Get /pet/{petId} Find pet by ID
PetApi UpdatePet Put /pet Update an existing pet
PetApi UpdatePetWithForm Post /pet/{petId} Updates a pet in the store with form data
PetApi UploadFile Post /pet/{petId}/uploadImage uploads an image
StoreApi DeleteOrder Delete /store/order/{orderId} Delete purchase order by ID
StoreApi GetInventory Get /store/inventory Returns pet inventories by status
StoreApi GetOrderById Get /store/order/{orderId} Find purchase order by ID
StoreApi PlaceOrder Post /store/order Place an order for a pet
UserApi CreateUser Post /user Create user
UserApi CreateUsersWithArrayInput Post /user/createWithArray Creates list of users with given input array
UserApi CreateUsersWithListInput Post /user/createWithList Creates list of users with given input array
UserApi DeleteUser Delete /user/{username} Delete user
UserApi GetUserByName Get /user/{username} Get user by user name
UserApi LoginUser Get /user/login Logs user into the system
UserApi LogoutUser Get /user/logout Logs out current logged in user session
UserApi UpdateUser Put /user/{username} Updated user

Documentation For Models

Documentation For Authorization

api_key

  • Type: API key
  • API key parameter name: api_key
  • Location: HTTP header

petstore_auth

Author

apiteam@swagger.io

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
}

func (*APIClient) CallAPI

func (c *APIClient) CallAPI(path string, method string,
	postBody interface{},
	headerParams map[string]string,
	queryParams url.Values,
	formParams map[string]string,
	fileName string,
	fileBytes []byte) (*resty.Response, error)

func (*APIClient) ParameterToString

func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string

func (*APIClient) SelectHeaderAccept

func (c *APIClient) SelectHeaderAccept(accepts []string) string

func (*APIClient) SelectHeaderContentType

func (c *APIClient) SelectHeaderContentType(contentTypes []string) string

type APIResponse

type APIResponse struct {
	*http.Response
	Message string `json:"message,omitempty"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type Category

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

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

type Configuration

type Configuration struct {
	UserName     string            `json:"userName,omitempty"`
	Password     string            `json:"password,omitempty"`
	APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"`
	APIKey       map[string]string `json:"APIKey,omitempty"`

	DebugFile     string            `json:"debugFile,omitempty"`
	OAuthToken    string            `json:"oAuthToken,omitempty"`
	Timeout       int               `json:"timeout,omitempty"`
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	AccessToken   string            `json:"accessToken,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	APIClient     APIClient         `json:"APIClient,omitempty"`
	// contains filtered or unexported fields
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

func (*Configuration) GetAPIKeyWithPrefix

func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string

func (*Configuration) GetBasicAuthEncodedString

func (c *Configuration) GetBasicAuthEncodedString() string

func (*Configuration) GetDebug

func (c *Configuration) GetDebug() bool

func (*Configuration) SetDebug

func (c *Configuration) SetDebug(enable bool)

type ModelApiResponse

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

	Type_ string `json:"type,omitempty"`

	Message string `json:"message,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"`
}

type Pet

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

	Category Category `json:"category,omitempty"`

	Name string `json:"name,omitempty"`

	PhotoUrls []string `json:"photoUrls,omitempty"`

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

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

type PetApi

type PetApi struct {
	Configuration Configuration
}

func NewPetApi

func NewPetApi() *PetApi

func NewPetApiWithBasePath

func NewPetApiWithBasePath(basePath string) *PetApi

func (PetApi) AddPet

func (a PetApi) AddPet(body Pet) (*APIResponse, error)

*

  • Add a new pet to the store * *
  • @param body Pet object that needs to be added to the store
  • @return void

func (PetApi) DeletePet

func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error)

*

  • Deletes a pet * *
  • @param petId Pet id to delete
  • @param apiKey
  • @return void

func (PetApi) FindPetsByStatus

func (a PetApi) FindPetsByStatus(status []string) ([]Pet, *APIResponse, error)

*

  • Finds Pets by status
  • Multiple status values can be provided with comma separated strings *
  • @param status Status values that need to be considered for filter
  • @return []Pet

func (PetApi) FindPetsByTags

func (a PetApi) FindPetsByTags(tags []string) ([]Pet, *APIResponse, error)

*

  • Finds Pets by tags
  • Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. *
  • @param tags Tags to filter by
  • @return []Pet

func (PetApi) GetPetById

func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error)

*

  • Find pet by ID
  • Returns a single pet *
  • @param petId ID of pet to return
  • @return *Pet

func (PetApi) UpdatePet

func (a PetApi) UpdatePet(body Pet) (*APIResponse, error)

*

  • Update an existing pet * *
  • @param body Pet object that needs to be added to the store
  • @return void

func (PetApi) UpdatePetWithForm

func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*APIResponse, error)

*

  • Updates a pet in the store with form data * *
  • @param petId ID of pet that needs to be updated
  • @param name Updated name of the pet
  • @param status Updated status of the pet
  • @return void

func (PetApi) UploadFile

func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File) (*ModelApiResponse, *APIResponse, error)

*

  • uploads an image * *
  • @param petId ID of pet to update
  • @param additionalMetadata Additional data to pass to server
  • @param file file to upload
  • @return *ModelApiResponse

type StoreApi

type StoreApi struct {
	Configuration Configuration
}

func NewStoreApi

func NewStoreApi() *StoreApi

func NewStoreApiWithBasePath

func NewStoreApiWithBasePath(basePath string) *StoreApi

func (StoreApi) DeleteOrder

func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error)

*

  • Delete purchase order by ID
  • For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors *
  • @param orderId ID of the order that needs to be deleted
  • @return void

func (StoreApi) GetInventory

func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error)

*

  • Returns pet inventories by status
  • Returns a map of status codes to quantities *
  • @return *map[string]int32

func (StoreApi) GetOrderById

func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error)

*

  • Find purchase order by ID
  • For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions *
  • @param orderId ID of pet that needs to be fetched
  • @return *Order

func (StoreApi) PlaceOrder

func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error)

*

  • Place an order for a pet * *
  • @param body order placed for purchasing the pet
  • @return *Order

type Tag

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

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

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"`
}

type UserApi

type UserApi struct {
	Configuration Configuration
}

func NewUserApi

func NewUserApi() *UserApi

func NewUserApiWithBasePath

func NewUserApiWithBasePath(basePath string) *UserApi

func (UserApi) CreateUser

func (a UserApi) CreateUser(body User) (*APIResponse, error)

*

  • Create user
  • This can only be done by the logged in user. *
  • @param body Created user object
  • @return void

func (UserApi) CreateUsersWithArrayInput

func (a UserApi) CreateUsersWithArrayInput(body []User) (*APIResponse, error)

*

  • Creates list of users with given input array * *
  • @param body List of user object
  • @return void

func (UserApi) CreateUsersWithListInput

func (a UserApi) CreateUsersWithListInput(body []User) (*APIResponse, error)

*

  • Creates list of users with given input array * *
  • @param body List of user object
  • @return void

func (UserApi) DeleteUser

func (a UserApi) DeleteUser(username string) (*APIResponse, error)

*

  • Delete user
  • This can only be done by the logged in user. *
  • @param username The name that needs to be deleted
  • @return void

func (UserApi) GetUserByName

func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error)

*

  • Get user by user name * *
  • @param username The name that needs to be fetched. Use user1 for testing.
  • @return *User

func (UserApi) LoginUser

func (a UserApi) LoginUser(username string, password string) (*string, *APIResponse, error)

*

  • Logs user into the system * *
  • @param username The user name for login
  • @param password The password for login in clear text
  • @return *string

func (UserApi) LogoutUser

func (a UserApi) LogoutUser() (*APIResponse, error)

*

  • Logs out current logged in user session * *
  • @return void

func (UserApi) UpdateUser

func (a UserApi) UpdateUser(username string, body User) (*APIResponse, error)

*

  • Updated user
  • This can only be done by the logged in user. *
  • @param username name that need to be deleted
  • @param body Updated user object
  • @return void

Jump to

Keyboard shortcuts

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