openapi-generator/samples/client/petstore/go/go-petstore
2017-06-15 17:14:39 +08:00
..
.swagger-codegen Update samples for several language (just whitespace changes, reordering, VERSION) (#5828) 2017-06-14 01:17:31 +08:00
docs Merge remote-tracking branch 'origin/master' into 2.3.0 2017-05-17 22:00:06 +08:00
.gitignore add new files 2016-04-17 17:10:28 +08:00
.swagger-codegen-ignore Spelling fixes 2016-08-27 02:34:33 +03:00
.travis.yml fixed travis build error 2016-05-17 13:53:12 -07:00
additional_properties_class.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
animal_farm.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
animal.go Fixed issue #4665 [go] required object parameters are marked omitempty. (#4682) 2017-02-01 23:56:22 +08:00
api_client.go Modifying resty dependency to use stable release instead of HEAD (#5579) 2017-05-08 09:55:13 +08:00
api_response.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
array_of_array_of_number_only.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
array_of_number_only.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
array_test.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
capitalization.go Fixed issue #4665 [go] required object parameters are marked omitempty. (#4682) 2017-02-01 23:56:22 +08:00
cat.go Fixed issue #4665 [go] required object parameters are marked omitempty. (#4682) 2017-02-01 23:56:22 +08:00
category.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
class_model.go Remove invalid code from mustache for arrays. (#4266) 2016-12-13 16:13:06 +08:00
client.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
configuration.go Rewrite of Go Client #2 (#5037) 2017-04-22 01:17:18 +08:00
dog.go Fixed issue #4665 [go] required object parameters are marked omitempty. (#4682) 2017-02-01 23:56:22 +08:00
enum_arrays.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
enum_class.go Adding enum generation support for golang client (#5635) 2017-05-15 15:41:13 +08:00
enum_test.go [go][model] Use pointers to avoid circular references (#5478) 2017-04-29 01:08:07 +08:00
fake_api.go Merge remote-tracking branch 'origin/master' into 2.3.0 2017-05-17 22:00:06 +08:00
fake_classname_tags123_api.go Rewrite of Go Client #2 (#5037) 2017-04-22 01:17:18 +08:00
format_test.go [go][model] Use pointers to avoid circular references (#5478) 2017-04-29 01:08:07 +08:00
git_push.sh Issue #2478 - generated code now conforms more closely to conventions 2016-05-01 14:41:40 +01:00
has_only_read_only.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
list.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
map_test.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
mixed_properties_and_additional_properties_class.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
model_200_response.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
model_api_response.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
model_return.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
name.go Fixed issue #4665 [go] required object parameters are marked omitempty. (#4682) 2017-02-01 23:56:22 +08:00
number_only.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
order.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
outer_boolean.go Add alias type definitions for Java 2017-04-17 12:58:31 -07:00
outer_composite.go Merge remote-tracking branch 'origin/master' into 2.3.0 2017-05-17 22:00:06 +08:00
outer_enum.go Adding enum generation support for golang client (#5635) 2017-05-15 15:41:13 +08:00
outer_number.go Add alias type definitions for Java 2017-04-17 12:58:31 -07:00
outer_string.go Add alias type definitions for Java 2017-04-17 12:58:31 -07:00
pet_api.go [go][model] Use pointers to avoid circular references (#5478) 2017-04-29 01:08:07 +08:00
pet.go [go][model] Use pointers to avoid circular references (#5478) 2017-04-29 01:08:07 +08:00
read_only_first.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
README.md Merge remote-tracking branch 'origin/master' into 2.3.0 2017-06-15 17:14:39 +08:00
special_model_name.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
store_api.go [go][model] Use pointers to avoid circular references (#5478) 2017-04-29 01:08:07 +08:00
tag.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00
user_api.go Rewrite of Go Client #2 (#5037) 2017-04-22 01:17:18 +08:00
user.go Remove Apache license from API client generators (#4197) 2016-11-16 21:44:49 +08:00

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:80/v2

Class Method HTTP request Description
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
Fake_classname_tags123Api 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 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/{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

Documentation For Authorization

api_key

  • Type: API key

Example

	auth := context.WithValue(context.TODO(), 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.TODO(), sw.ContextBasicAuth, sw.BasicAuth{
		UserName: "username",
		Password: "password",
	})
    r, err := client.Service.Operation(auth, args)

petstore_auth

Example

	auth := context.WithValue(context.TODO(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
    r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automaticly 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

apiteam@swagger.io