petstore

package
v2.2.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

README

Go API client for petstore

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \

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 package: 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
FakeApi TestClientModel Patch /fake To test "client" model
FakeApi TestEndpointParameters Post /fake Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
FakeApi TestEnumParameters Get /fake To test enum parameters
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

http_basic_test

  • Type: HTTP basic authentication

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 {
	// contains filtered or unexported fields
}

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 `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the swagger operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type AdditionalPropertiesClass

type AdditionalPropertiesClass struct {
	MapProperty map[string]string `json:"map_property,omitempty"`

	MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty"`
}

type Animal

type Animal struct {
	ClassName string `json:"className"`

	Color string `json:"color,omitempty"`
}

type AnimalFarm

type AnimalFarm struct {
}

type ArrayOfArrayOfNumberOnly

type ArrayOfArrayOfNumberOnly struct {
	ArrayArrayNumber [][]float32 `json:"ArrayArrayNumber,omitempty"`
}

type ArrayOfNumberOnly

type ArrayOfNumberOnly struct {
	ArrayNumber []float32 `json:"ArrayNumber,omitempty"`
}

type Capitalization

type Capitalization struct {
	SmallCamel string `json:"smallCamel,omitempty"`

	CapitalCamel string `json:"CapitalCamel,omitempty"`

	SmallSnake string `json:"small_Snake,omitempty"`

	CapitalSnake string `json:"Capital_Snake,omitempty"`

	SCAETHFlowPoints string `json:"SCA_ETH_Flow_Points,omitempty"`

	// Name of the pet
	ATT_NAME string `json:"ATT_NAME,omitempty"`
}

type Cat

type Cat struct {
	ClassName string `json:"className"`

	Color string `json:"color,omitempty"`

	Declawed bool `json:"declawed,omitempty"`
}

type Category

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

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

type ClassModel

type ClassModel struct {
	Class string `json:"_class,omitempty"`
}

Model for testing model with \"_class\" property

type Client

type Client struct {
	Client string `json:"client,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"`
	Debug         bool              `json:"debug,omitempty"`
	DebugFile     string            `json:"debugFile,omitempty"`
	OAuthToken    string            `json:"oAuthToken,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
	Transport     *http.Transport
	Timeout       *time.Duration `json:"timeout,omitempty"`
}

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

type Dog

type Dog struct {
	ClassName string `json:"className"`

	Color string `json:"color,omitempty"`

	Breed string `json:"breed,omitempty"`
}

type EnumArrays

type EnumArrays struct {
	JustSymbol string `json:"just_symbol,omitempty"`

	ArrayEnum []string `json:"array_enum,omitempty"`
}

type EnumClass

type EnumClass struct {
}

type FakeApi

type FakeApi struct {
	Configuration *Configuration
}

func NewFakeApi

func NewFakeApi() *FakeApi

func NewFakeApiWithBasePath

func NewFakeApiWithBasePath(basePath string) *FakeApi

func (FakeApi) TestClientModel

func (a FakeApi) TestClientModel(body Client) (*Client, *APIResponse, error)

*

  • To test \"client\" model
  • To test \"client\" model *
  • @param body client model
  • @return *Client

func (FakeApi) TestEndpointParameters

func (a FakeApi) TestEndpointParameters(number float32, double float64, patternWithoutDelimiter string, byte_ string, integer int32, int32_ int32, int64_ int64, float float32, string_ string, binary string, date time.Time, dateTime time.Time, password string, callback string) (*APIResponse, error)

*

  • Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
  • Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *
  • @param number None
  • @param double None
  • @param patternWithoutDelimiter None
  • @param byte_ None
  • @param integer None
  • @param int32_ None
  • @param int64_ None
  • @param float None
  • @param string_ None
  • @param binary None
  • @param date None
  • @param dateTime None
  • @param password None
  • @param callback None
  • @return void

func (FakeApi) TestEnumParameters

func (a FakeApi) TestEnumParameters(enumFormStringArray []string, enumFormString string, enumHeaderStringArray []string, enumHeaderString string, enumQueryStringArray []string, enumQueryString string, enumQueryInteger int32, enumQueryDouble float64) (*APIResponse, error)

*

  • To test enum parameters
  • To test enum parameters *
  • @param enumFormStringArray Form parameter enum test (string array)
  • @param enumFormString Form parameter enum test (string)
  • @param enumHeaderStringArray Header parameter enum test (string array)
  • @param enumHeaderString Header parameter enum test (string)
  • @param enumQueryStringArray Query parameter enum test (string array)
  • @param enumQueryString Query parameter enum test (string)
  • @param enumQueryInteger Query parameter enum test (double)
  • @param enumQueryDouble Query parameter enum test (double)
  • @return void

type HasOnlyReadOnly

type HasOnlyReadOnly struct {
	Bar string `json:"bar,omitempty"`

	Foo string `json:"foo,omitempty"`
}

type List

type List struct {
	Var123List string `json:"123-list,omitempty"`
}

type MixedPropertiesAndAdditionalPropertiesClass

type MixedPropertiesAndAdditionalPropertiesClass struct {
	Uuid string `json:"uuid,omitempty"`

	DateTime time.Time `json:"dateTime,omitempty"`

	Map_ map[string]Animal `json:"map,omitempty"`
}

type Model200Response

type Model200Response struct {
	Name int32 `json:"name,omitempty"`

	Class string `json:"class,omitempty"`
}

Model for testing model name starting with number

type ModelApiResponse

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

	Type_ string `json:"type,omitempty"`

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

type ModelReturn

type ModelReturn struct {
	Return_ int32 `json:"return,omitempty"`
}

Model for testing reserved words

type Name

type Name struct {
	Name int32 `json:"name"`

	SnakeCase int32 `json:"snake_case,omitempty"`

	Property string `json:"property,omitempty"`

	Var123Number int32 `json:"123Number,omitempty"`
}

Model for testing model name same as property name

type NumberOnly

type NumberOnly struct {
	JustNumber float32 `json:"JustNumber,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 OuterEnum

type OuterEnum struct {
}

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

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 ReadOnlyFirst

type ReadOnlyFirst struct {
	Bar string `json:"bar,omitempty"`

	Baz string `json:"baz,omitempty"`
}

type SpecialModelName

type SpecialModelName struct {
	SpecialPropertyName int64 `json:"$special[property.name],omitempty"`
}

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