Categorygithub.com/ibiscum/go-pet-store-client
modulepackage
0.0.0-20240530205930-017009088cba
Repository: https://github.com/ibiscum/go-pet-store-client.git
Documentation: pkg.go.dev

# README

Go API client for swagger

This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about Swagger at https://swagger.io. In the third iteration of the pet store, we've switched to the design first approach! You can now help us improve the API whether it's by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3. If you're looking for the Swagger 2.0/OAS 2.0 version of Petstore, then click here. Alternatively, you can load via the Edit > Load Petstore OAS 2.0 menu option! Some useful links: - The Pet Store repository - The source API definition for the Pet Store

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.11
  • 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 "./swagger"

Documentation for API Endpoints

All URIs are relative to https://petstore3.swagger.io/api/v3

ClassMethodHTTP requestDescription
PetApiAddPetPost /petAdd a new pet to the store
PetApiDeletePetDelete /pet/{petId}Deletes a pet
PetApiFindPetsByStatusGet /pet/findByStatusFinds Pets by status
PetApiFindPetsByTagsGet /pet/findByTagsFinds Pets by tags
PetApiGetPetByIdGet /pet/{petId}Find pet by ID
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/{orderId}Delete purchase order by ID
StoreApiGetInventoryGet /store/inventoryReturns pet inventories by status
StoreApiGetOrderByIdGet /store/order/{orderId}Find purchase order by ID
StoreApiPlaceOrderPost /store/orderPlace an order for a pet
UserApiCreateUserPost /userCreate user
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}Update 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)

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

# 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
APIClient manages communication with the Swagger Petstore - OpenAPI 3.0 API v1.0.11 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
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
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
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