# 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.v3.generators.go.GoClientCodegen
Installation
Put the package under your project folder and add the following in import:
import "./petstore"
Documentation for API Endpoints
All URIs are relative to http://petstore.swagger.io:80/v2
Class | Method | HTTP request | Description |
---|---|---|---|
AnimalApi | AddAnimal | Post /animal | Add a new animal to the store |
AnimalApi | DeleteAnimal | Delete /animal/{animalId} | Deletes a animal |
AnimalApi | GetAnimalById | Get /animal/{animalId} | Find animal by ID |
AnimalApi | UpdateAnimal | Put /animal | Update an existing animal |
AnimalApi | UpdateAnimalWithForm | Post /animal/{animalId} | Updates a animal |
AnotherFakeApi | TestSpecialTags | Patch /another-fake/dummy | To test special tags |
DogApi | AddDog | Post /dog | Add a new dog to the store |
DogApi | DeleteDog | Delete /dog/{dogId} | Deletes a dog |
DogApi | GetDogById | Get /dog/{dogId} | Find dog by ID |
DogApi | UpdateDog | Put /dog | Update an existing dog |
DogApi | UpdateDogWithForm | Post /dog/{dogId} | Updates a dog |
FakeApi | FakeOuterBooleanSerialize | Post /fake/outer/boolean | |
FakeApi | FakeOuterCompositeSerialize | Post /fake/outer/composite | |
FakeApi | FakeOuterNumberSerialize | Post /fake/outer/number | |
FakeApi | FakeOuterStringSerialize | Post /fake/outer/string | |
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 |
FakeApi | TestEnumRequestBody | Post /fake/enum/form | To test enum parameters |
FakeApi | TestInlineAdditionalProperties | Post /fake/inline-additionalProperties | test inline additionalProperties |
FakeApi | TestJsonFormData | Post /fake/jsonFormData | test json serialization of form data |
FakeClassnameTags123Api | TestClassname | Patch /fake_classname_test | To test class name in snake case |
PetApi | AddPet | Post /pet | Add a new pet to the store |
PetApi | DeletePet | Delete /pet/{petId} | Deletes a pet |
PetApi | DoCategoryStuff | Post /pet/category | |
PetApi | FindPetsByStatus | Get /pet/findByStatus | Finds Pets by status |
PetApi | FindPetsByTags | Get /pet/findByTags | Finds Pets by tags |
PetApi | GetAllPets | Get /allPets | |
PetApi | GetPetById | Get /pet/{petId} | Find pet by ID |
PetApi | GetRandomPet | Get /randomPet | |
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/{order_id} | Delete purchase order by ID |
StoreApi | GetInventory | Get /store/inventory | Returns pet inventories by status |
StoreApi | GetOrderById | Get /store/order/{order_id} | 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
- AdditionalPropertiesClass
- AllOfSubCategoryCategory
- AllOfSubCategoryPetsItems
- Animal
- ArrayOfArrayOfNumberOnly
- ArrayOfNumberOnly
- ArrayTest
- Body
- Body1
- Body2
- Body3
- Body4
- Body5
- Body6
- Body7
- Capitalization
- Cat
- Category
- ClassModel
- Client
- Dog
- EnumArrays
- EnumClass
- EnumTest
- FormatTest
- HasOnlyReadOnly
- List
- MapTest
- MixedPropertiesAndAdditionalPropertiesClass
- Model200Response
- ModelApiResponse
- ModelReturn
- Name
- NullableEnumModel
- NumberOnly
- OneOfAllPetsResponseItems
- OneOfSinglePetResponsePet
- Order
- OuterComposite
- OuterEnum
- Pet
- ReadOnlyFirst
- SinglePetResponse
- SpecialModelName
- SubCategory
- Tag
- User
Documentation For Authorization
api_key
- Type: API key
Example
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
api_key_query
- Type: API key
Example
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
http_basic_test
- Type: HTTP basic authentication
Example
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)
petstore_auth
- Type: OAuth
- Flow: implicit
- Authorization URL: http://petstore.swagger.io/api/oauth/dialog
- Scopes:
- ****:
Example
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
import "golang.org/x/oauth2"
/* Perform OAuth2 round trip request and obtain a token */
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
Author
# Functions
CacheExpires helper function to determine remaining time before repeating a request.
NewAPIClient creates a new API client.
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
List of EnumClass.
List of OuterEnum.
List of OuterEnum.
List of EnumClass.
List of OuterEnum.
List of EnumClass.
# Variables
ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAPIKey takes an APIKey as authentication for the request.
ContextBasicAuth takes BasicAuth as authentication for the request.
ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
APIClient manages communication with the Swagger Petstore API v1.0.0 In most cases there should be only one, shared, APIClient.
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
No description provided by the author
No description provided by the author
No description provided by the author
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Model for testing model with \"_class\" property.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GenericSwaggerError Provides access to the body, error and model on returned errors.
No description provided by the author
No description provided by the author
No description provided by the author
Model for testing model name starting with number.
No description provided by the author
Model for testing reserved words.
Model for testing model name same as property name.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author