package
3.0.68+incompatible
Repository: https://github.com/swagger-api/swagger-codegen.git
Documentation: pkg.go.dev

# 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

ClassMethodHTTP requestDescription
AnimalApiAddAnimalPost /animalAdd a new animal to the store
AnimalApiDeleteAnimalDelete /animal/{animalId}Deletes a animal
AnimalApiGetAnimalByIdGet /animal/{animalId}Find animal by ID
AnimalApiUpdateAnimalPut /animalUpdate an existing animal
AnimalApiUpdateAnimalWithFormPost /animal/{animalId}Updates a animal
AnotherFakeApiTestSpecialTagsPatch /another-fake/dummyTo test special tags
DogApiAddDogPost /dogAdd a new dog to the store
DogApiDeleteDogDelete /dog/{dogId}Deletes a dog
DogApiGetDogByIdGet /dog/{dogId}Find dog by ID
DogApiUpdateDogPut /dogUpdate an existing dog
DogApiUpdateDogWithFormPost /dog/{dogId}Updates a dog
FakeApiFakeOuterBooleanSerializePost /fake/outer/boolean
FakeApiFakeOuterCompositeSerializePost /fake/outer/composite
FakeApiFakeOuterNumberSerializePost /fake/outer/number
FakeApiFakeOuterStringSerializePost /fake/outer/string
FakeApiTestClientModelPatch /fakeTo test "client" model
FakeApiTestEndpointParametersPost /fakeFake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
FakeApiTestEnumParametersGet /fakeTo test enum parameters
FakeApiTestEnumRequestBodyPost /fake/enum/formTo test enum parameters
FakeApiTestInlineAdditionalPropertiesPost /fake/inline-additionalPropertiestest inline additionalProperties
FakeApiTestJsonFormDataPost /fake/jsonFormDatatest json serialization of form data
FakeClassnameTags123ApiTestClassnamePatch /fake_classname_testTo test class name in snake case
PetApiAddPetPost /petAdd a new pet to the store
PetApiDeletePetDelete /pet/{petId}Deletes a pet
PetApiDoCategoryStuffPost /pet/category
PetApiFindPetsByStatusGet /pet/findByStatusFinds Pets by status
PetApiFindPetsByTagsGet /pet/findByTagsFinds Pets by tags
PetApiGetAllPetsGet /allPets
PetApiGetPetByIdGet /pet/{petId}Find pet by ID
PetApiGetRandomPetGet /randomPet
PetApiUpdatePetPut /petUpdate an existing pet
PetApiUpdatePetWithFormPost /pet/{petId}Updates a pet in the store with form data
PetApiUploadFilePost /pet/{petId}/uploadImageuploads an image
StoreApiDeleteOrderDelete /store/order/{order_id}Delete purchase order by ID
StoreApiGetInventoryGet /store/inventoryReturns pet inventories by status
StoreApiGetOrderByIdGet /store/order/{order_id}Find purchase order by ID
StoreApiPlaceOrderPost /store/orderPlace an order for a pet
UserApiCreateUserPost /userCreate user
UserApiCreateUsersWithArrayInputPost /user/createWithArrayCreates list of users with given input array
UserApiCreateUsersWithListInputPost /user/createWithListCreates list of users with given input array
UserApiDeleteUserDelete /user/{username}Delete user
UserApiGetUserByNameGet /user/{username}Get user by user name
UserApiLoginUserGet /user/loginLogs user into the system
UserApiLogoutUserGet /user/logoutLogs out current logged in user session
UserApiUpdateUserPut /user/{username}Updated user

Documentation For Models

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

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

[email protected]

# 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