petstoreapi

package
v1.41.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Description = `` /* 738-byte string literal not displayed */

Description is the human-readable summary of the microservice, surfaced in OpenAPI and discovery.

View Source
const Hostname = "petstore.example"

Hostname is the default hostname of the microservice.

View Source
const Name = "Petstore"

Name is the decorative PascalCase name of the microservice.

View Source
const Version = 1

Version is a generation counter bumped on each regeneration, not a semantic version.

Variables

View Source
var AddPet = define.Function{
	Host: Hostname, Method: "POST", Route: "/pet",
	In: AddPetIn{}, Out: AddPetOut{},
}

AddPet adds a new pet to the store.

View Source
var BearerToken = define.Config{
	Value:  string(""),
	Secret: true,
}

BearerToken is the OAuth2 bearer token presented to the remote Swagger Petstore API.

View Source
var GetPetById = define.Function{
	Host: Hostname, Method: "GET", Route: "/pet/{petId}",
	In: GetPetByIdIn{}, Out: GetPetByIdOut{},
}

GetPetById returns a single pet.

View Source
var RemoteBaseURL = define.Config{
	Value:      string(""),
	Default:    "https://petstore3.swagger.io/api/v3",
	Validation: "url",
}

RemoteBaseURL is the base URL of the remote Swagger Petstore API.

View Source
var UploadFile = define.Web{
	Host: Hostname, Method: "POST", Route: "/pet/{petId}/uploadImage",
}

UploadFile uploads an image of the pet.

Functions

This section is empty.

Types

type AddPetIn

type AddPetIn struct {
	HTTPRequestBody *Pet `json:"-"`
}

AddPetIn are the input arguments of AddPet.

type AddPetOut

type AddPetOut struct {
	HTTPResponseBody *Pet `json:"-"`
	HTTPStatusCode   int  `json:"-"`
}

AddPetOut are the output arguments of AddPet.

type AddPetResponse

type AddPetResponse multicastResponse // MARKER: AddPet

AddPetResponse packs the response of AddPet.

func (*AddPetResponse) Get

func (_res *AddPetResponse) Get() (httpResponseBody *Pet, httpStatusCode int, err error)

Get unpacks the return arguments of AddPet.

type ApiResponse

type ApiResponse struct {
	Code    int32  `json:"code,omitzero" jsonschema_description:"Code is the response code"`
	Type    string `json:"type,omitzero" jsonschema_description:"Type is the response type"`
	Message string `json:"message,omitzero" jsonschema_description:"Message is the response message"`
}

ApiResponse is a generic response from the Swagger Petstore API. Imported from the Swagger Petstore API.

type Category

type Category struct {
	ID   int64  `json:"id,omitzero" jsonschema_description:"ID is the category identifier"`
	Name string `json:"name,omitzero" jsonschema_description:"Name is the category name"`
}

Category is a pet category. Imported from the Swagger Petstore API.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a lightweight proxy for making unicast calls to the microservice.

func NewClient

func NewClient(caller service.Publisher) Client

NewClient creates a new unicast client proxy to the microservice.

func (Client) AddPet

func (_c Client) AddPet(ctx context.Context, httpRequestBody *Pet) (httpResponseBody *Pet, httpStatusCode int, err error)

AddPet adds a new pet to the store.

func (Client) ForHost

func (_c Client) ForHost(host string) Client

ForHost returns a copy of the client with a different hostname to be applied to requests.

func (Client) GetPetById

func (_c Client) GetPetById(ctx context.Context, petId int64) (httpResponseBody *Pet, httpStatusCode int, err error)

GetPetById returns a single pet.

func (Client) UploadFile

func (_c Client) UploadFile(ctx context.Context, relativeURL string, body any) (res *http.Response, err error)

UploadFile uploads an image of the pet.

func (Client) WithOptions

func (_c Client) WithOptions(opts ...pub.Option) Client

WithOptions returns a copy of the client with options to be applied to requests.

type GetPetByIdIn

type GetPetByIdIn struct {
	PetId int64 `json:"petId,omitzero" jsonschema_description:"petId is the ID of the pet to return"`
}

GetPetByIdIn are the input arguments of GetPetById.

type GetPetByIdOut

type GetPetByIdOut struct {
	HTTPResponseBody *Pet `json:"-"`
	HTTPStatusCode   int  `json:"-"`
}

GetPetByIdOut are the output arguments of GetPetById.

type GetPetByIdResponse

type GetPetByIdResponse multicastResponse // MARKER: GetPetById

GetPetByIdResponse packs the response of GetPetById.

func (*GetPetByIdResponse) Get

func (_res *GetPetByIdResponse) Get() (httpResponseBody *Pet, httpStatusCode int, err error)

Get unpacks the return arguments of GetPetById.

type MulticastClient

type MulticastClient struct {
	// contains filtered or unexported fields
}

MulticastClient is a lightweight proxy for making multicast calls to the microservice.

func NewMulticastClient

func NewMulticastClient(caller service.Publisher) MulticastClient

NewMulticastClient creates a new multicast client proxy to the microservice.

func (MulticastClient) AddPet

func (_c MulticastClient) AddPet(ctx context.Context, httpRequestBody *Pet) iter.Seq[*AddPetResponse]

AddPet adds a new pet to the store.

func (MulticastClient) ForHost

func (_c MulticastClient) ForHost(host string) MulticastClient

ForHost returns a copy of the client with a different hostname to be applied to requests.

func (MulticastClient) GetPetById

func (_c MulticastClient) GetPetById(ctx context.Context, petId int64) iter.Seq[*GetPetByIdResponse]

GetPetById returns a single pet.

func (MulticastClient) UploadFile

func (_c MulticastClient) UploadFile(ctx context.Context, relativeURL string, body any) iter.Seq[*pub.Response]

UploadFile uploads an image of the pet.

func (MulticastClient) WithOptions

func (_c MulticastClient) WithOptions(opts ...pub.Option) MulticastClient

WithOptions returns a copy of the client with options to be applied to requests.

type Pet

type Pet struct {
	ID        int64     `json:"id,omitzero" jsonschema_description:"ID is the pet identifier"`
	Name      string    `json:"name,omitzero" jsonschema_description:"Name is the pet name"`
	Category  *Category `json:"category,omitzero" jsonschema_description:"Category is the pet category"`
	PhotoURLs []string  `json:"photoUrls,omitzero" jsonschema_description:"PhotoURLs are the URLs of the pet photos"`
	Tags      []Tag     `json:"tags,omitzero" jsonschema_description:"Tags are the pet tags"`
	Status    string    `json:"status,omitzero" jsonschema_description:"Status is the pet status in the store"`
}

Pet is a pet in the store. Imported from the Swagger Petstore API.

type Tag

type Tag struct {
	ID   int64  `json:"id,omitzero" jsonschema_description:"ID is the tag identifier"`
	Name string `json:"name,omitzero" jsonschema_description:"Name is the tag name"`
}

Tag is a pet tag. Imported from the Swagger Petstore API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL