petstore

package
v0.0.0-...-54d6317 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package petstore is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var Status_name = map[int32]string{
	0: "available",
	1: "pending",
	2: "sold",
}
View Source
var Status_value = map[string]int32{
	"available": 0,
	"pending":   1,
	"sold":      2,
}

Functions

func RegisterPetstoreServiceHandler

func RegisterPetstoreServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterPetstoreServiceHandler registers the http handlers for service PetstoreService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterPetstoreServiceHandlerClient

func RegisterPetstoreServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PetstoreServiceClient) error

RegisterPetstoreServiceHandlerClient registers the http handlers for service PetstoreService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PetstoreServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PetstoreServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "PetstoreServiceClient" to call the correct interceptors.

func RegisterPetstoreServiceHandlerFromEndpoint

func RegisterPetstoreServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterPetstoreServiceHandlerFromEndpoint is same as RegisterPetstoreServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterPetstoreServiceHandlerServer

func RegisterPetstoreServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PetstoreServiceServer) error

RegisterPetstoreServiceHandlerServer registers the http handlers for service PetstoreService to "mux". UnaryRPC :call PetstoreServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterPetstoreServiceServer

func RegisterPetstoreServiceServer(s *grpc.Server, srv PetstoreServiceServer)

Types

type ApiResponse

type ApiResponse struct {
	Code                 int32    `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Type                 string   `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	Message              string   `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ApiResponse) Descriptor

func (*ApiResponse) Descriptor() ([]byte, []int)

func (*ApiResponse) GetCode

func (m *ApiResponse) GetCode() int32

func (*ApiResponse) GetMessage

func (m *ApiResponse) GetMessage() string

func (*ApiResponse) GetType

func (m *ApiResponse) GetType() string

func (*ApiResponse) ProtoMessage

func (*ApiResponse) ProtoMessage()

func (*ApiResponse) Reset

func (m *ApiResponse) Reset()

func (*ApiResponse) String

func (m *ApiResponse) String() string

func (*ApiResponse) XXX_DiscardUnknown

func (m *ApiResponse) XXX_DiscardUnknown()

func (*ApiResponse) XXX_Marshal

func (m *ApiResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ApiResponse) XXX_Merge

func (m *ApiResponse) XXX_Merge(src proto.Message)

func (*ApiResponse) XXX_Size

func (m *ApiResponse) XXX_Size() int

func (*ApiResponse) XXX_Unmarshal

func (m *ApiResponse) XXX_Unmarshal(b []byte) error

type Category

type Category struct {
	Id                   int64    `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Name                 string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Category) Descriptor

func (*Category) Descriptor() ([]byte, []int)

func (*Category) GetId

func (m *Category) GetId() int64

func (*Category) GetName

func (m *Category) GetName() string

func (*Category) ProtoMessage

func (*Category) ProtoMessage()

func (*Category) Reset

func (m *Category) Reset()

func (*Category) String

func (m *Category) String() string

func (*Category) XXX_DiscardUnknown

func (m *Category) XXX_DiscardUnknown()

func (*Category) XXX_Marshal

func (m *Category) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Category) XXX_Merge

func (m *Category) XXX_Merge(src proto.Message)

func (*Category) XXX_Size

func (m *Category) XXX_Size() int

func (*Category) XXX_Unmarshal

func (m *Category) XXX_Unmarshal(b []byte) error

type Empty

type Empty struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Empty) Descriptor

func (*Empty) Descriptor() ([]byte, []int)

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) Reset

func (m *Empty) Reset()

func (*Empty) String

func (m *Empty) String() string

func (*Empty) XXX_DiscardUnknown

func (m *Empty) XXX_DiscardUnknown()

func (*Empty) XXX_Marshal

func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Empty) XXX_Merge

func (m *Empty) XXX_Merge(src proto.Message)

func (*Empty) XXX_Size

func (m *Empty) XXX_Size() int

func (*Empty) XXX_Unmarshal

func (m *Empty) XXX_Unmarshal(b []byte) error

type Pet

type Pet struct {
	Id                   int64     `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Category             *Category `protobuf:"bytes,2,opt,name=category,proto3" json:"category,omitempty"`
	Name                 string    `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	PhotoUrls            []string  `protobuf:"bytes,4,rep,name=photo_urls,json=photoUrls,proto3" json:"photo_urls,omitempty"`
	Tags                 []*Tag    `protobuf:"bytes,5,rep,name=tags,proto3" json:"tags,omitempty"`
	Status               string    `protobuf:"bytes,6,opt,name=status,proto3" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*Pet) Descriptor

func (*Pet) Descriptor() ([]byte, []int)

func (*Pet) GetCategory

func (m *Pet) GetCategory() *Category

func (*Pet) GetId

func (m *Pet) GetId() int64

func (*Pet) GetName

func (m *Pet) GetName() string

func (*Pet) GetPhotoUrls

func (m *Pet) GetPhotoUrls() []string

func (*Pet) GetStatus

func (m *Pet) GetStatus() string

func (*Pet) GetTags

func (m *Pet) GetTags() []*Tag

func (*Pet) ProtoMessage

func (*Pet) ProtoMessage()

func (*Pet) Reset

func (m *Pet) Reset()

func (*Pet) String

func (m *Pet) String() string

func (*Pet) XXX_DiscardUnknown

func (m *Pet) XXX_DiscardUnknown()

func (*Pet) XXX_Marshal

func (m *Pet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Pet) XXX_Merge

func (m *Pet) XXX_Merge(src proto.Message)

func (*Pet) XXX_Size

func (m *Pet) XXX_Size() int

func (*Pet) XXX_Unmarshal

func (m *Pet) XXX_Unmarshal(b []byte) error

type PetBody

type PetBody struct {
	PetId                int64    `protobuf:"varint,1,opt,name=pet_id,json=petId,proto3" json:"pet_id,omitempty"`
	Body                 string   `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PetBody) Descriptor

func (*PetBody) Descriptor() ([]byte, []int)

func (*PetBody) GetBody

func (m *PetBody) GetBody() string

func (*PetBody) GetPetId

func (m *PetBody) GetPetId() int64

func (*PetBody) ProtoMessage

func (*PetBody) ProtoMessage()

func (*PetBody) Reset

func (m *PetBody) Reset()

func (*PetBody) String

func (m *PetBody) String() string

func (*PetBody) XXX_DiscardUnknown

func (m *PetBody) XXX_DiscardUnknown()

func (*PetBody) XXX_Marshal

func (m *PetBody) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PetBody) XXX_Merge

func (m *PetBody) XXX_Merge(src proto.Message)

func (*PetBody) XXX_Size

func (m *PetBody) XXX_Size() int

func (*PetBody) XXX_Unmarshal

func (m *PetBody) XXX_Unmarshal(b []byte) error

type PetID

type PetID struct {
	PetId                int64    `protobuf:"varint,1,opt,name=pet_id,json=petId,proto3" json:"pet_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PetID) Descriptor

func (*PetID) Descriptor() ([]byte, []int)

func (*PetID) GetPetId

func (m *PetID) GetPetId() int64

func (*PetID) ProtoMessage

func (*PetID) ProtoMessage()

func (*PetID) Reset

func (m *PetID) Reset()

func (*PetID) String

func (m *PetID) String() string

func (*PetID) XXX_DiscardUnknown

func (m *PetID) XXX_DiscardUnknown()

func (*PetID) XXX_Marshal

func (m *PetID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PetID) XXX_Merge

func (m *PetID) XXX_Merge(src proto.Message)

func (*PetID) XXX_Size

func (m *PetID) XXX_Size() int

func (*PetID) XXX_Unmarshal

func (m *PetID) XXX_Unmarshal(b []byte) error

type Pets

type Pets struct {
	Pets                 []*Pet   `protobuf:"bytes,1,rep,name=pets,proto3" json:"pets,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Pets) Descriptor

func (*Pets) Descriptor() ([]byte, []int)

func (*Pets) GetPets

func (m *Pets) GetPets() []*Pet

func (*Pets) ProtoMessage

func (*Pets) ProtoMessage()

func (*Pets) Reset

func (m *Pets) Reset()

func (*Pets) String

func (m *Pets) String() string

func (*Pets) XXX_DiscardUnknown

func (m *Pets) XXX_DiscardUnknown()

func (*Pets) XXX_Marshal

func (m *Pets) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Pets) XXX_Merge

func (m *Pets) XXX_Merge(src proto.Message)

func (*Pets) XXX_Size

func (m *Pets) XXX_Size() int

func (*Pets) XXX_Unmarshal

func (m *Pets) XXX_Unmarshal(b []byte) error

type PetstoreServiceClient

type PetstoreServiceClient interface {
	GetPetByID(ctx context.Context, in *PetID, opts ...grpc.CallOption) (*Pet, error)
	UpdatePetWithForm(ctx context.Context, in *UpdatePetWithFormReq, opts ...grpc.CallOption) (*Empty, error)
	DeletePet(ctx context.Context, in *PetID, opts ...grpc.CallOption) (*Empty, error)
	UploadFile(ctx context.Context, in *UploadFileReq, opts ...grpc.CallOption) (*ApiResponse, error)
	AddPet(ctx context.Context, in *Pet, opts ...grpc.CallOption) (*Pet, error)
	UpdatePet(ctx context.Context, in *Pet, opts ...grpc.CallOption) (*Pet, error)
	FindPetsByStatus(ctx context.Context, in *StatusReq, opts ...grpc.CallOption) (*Pets, error)
}

PetstoreServiceClient is the client API for PetstoreService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewPetstoreServiceClient

func NewPetstoreServiceClient(cc *grpc.ClientConn) PetstoreServiceClient

type PetstoreServiceServer

type PetstoreServiceServer interface {
	GetPetByID(context.Context, *PetID) (*Pet, error)
	UpdatePetWithForm(context.Context, *UpdatePetWithFormReq) (*Empty, error)
	DeletePet(context.Context, *PetID) (*Empty, error)
	UploadFile(context.Context, *UploadFileReq) (*ApiResponse, error)
	AddPet(context.Context, *Pet) (*Pet, error)
	UpdatePet(context.Context, *Pet) (*Pet, error)
	FindPetsByStatus(context.Context, *StatusReq) (*Pets, error)
}

PetstoreServiceServer is the server API for PetstoreService service.

type Status

type Status int32
const (
	Status_available Status = 0
	Status_pending   Status = 1
	Status_sold      Status = 2
)

func (Status) EnumDescriptor

func (Status) EnumDescriptor() ([]byte, []int)

func (Status) String

func (x Status) String() string

type StatusReq

type StatusReq struct {
	Status               []string `protobuf:"bytes,1,rep,name=status,proto3" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*StatusReq) Descriptor

func (*StatusReq) Descriptor() ([]byte, []int)

func (*StatusReq) GetStatus

func (m *StatusReq) GetStatus() []string

func (*StatusReq) ProtoMessage

func (*StatusReq) ProtoMessage()

func (*StatusReq) Reset

func (m *StatusReq) Reset()

func (*StatusReq) String

func (m *StatusReq) String() string

func (*StatusReq) XXX_DiscardUnknown

func (m *StatusReq) XXX_DiscardUnknown()

func (*StatusReq) XXX_Marshal

func (m *StatusReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StatusReq) XXX_Merge

func (m *StatusReq) XXX_Merge(src proto.Message)

func (*StatusReq) XXX_Size

func (m *StatusReq) XXX_Size() int

func (*StatusReq) XXX_Unmarshal

func (m *StatusReq) XXX_Unmarshal(b []byte) error

type Tag

type Tag struct {
	Id                   int64    `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Name                 string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Tag) Descriptor

func (*Tag) Descriptor() ([]byte, []int)

func (*Tag) GetId

func (m *Tag) GetId() int64

func (*Tag) GetName

func (m *Tag) GetName() string

func (*Tag) ProtoMessage

func (*Tag) ProtoMessage()

func (*Tag) Reset

func (m *Tag) Reset()

func (*Tag) String

func (m *Tag) String() string

func (*Tag) XXX_DiscardUnknown

func (m *Tag) XXX_DiscardUnknown()

func (*Tag) XXX_Marshal

func (m *Tag) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Tag) XXX_Merge

func (m *Tag) XXX_Merge(src proto.Message)

func (*Tag) XXX_Size

func (m *Tag) XXX_Size() int

func (*Tag) XXX_Unmarshal

func (m *Tag) XXX_Unmarshal(b []byte) error

type UnimplementedPetstoreServiceServer

type UnimplementedPetstoreServiceServer struct {
}

UnimplementedPetstoreServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedPetstoreServiceServer) AddPet

func (*UnimplementedPetstoreServiceServer) DeletePet

func (*UnimplementedPetstoreServiceServer) FindPetsByStatus

func (*UnimplementedPetstoreServiceServer) FindPetsByStatus(ctx context.Context, req *StatusReq) (*Pets, error)

func (*UnimplementedPetstoreServiceServer) GetPetByID

func (*UnimplementedPetstoreServiceServer) GetPetByID(ctx context.Context, req *PetID) (*Pet, error)

func (*UnimplementedPetstoreServiceServer) UpdatePet

func (*UnimplementedPetstoreServiceServer) UpdatePet(ctx context.Context, req *Pet) (*Pet, error)

func (*UnimplementedPetstoreServiceServer) UpdatePetWithForm

func (*UnimplementedPetstoreServiceServer) UploadFile

type UpdatePetWithFormReq

type UpdatePetWithFormReq struct {
	PetId                int64    `protobuf:"varint,1,opt,name=pet_id,json=petId,proto3" json:"pet_id,omitempty"`
	Name                 string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Status               string   `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*UpdatePetWithFormReq) Descriptor

func (*UpdatePetWithFormReq) Descriptor() ([]byte, []int)

func (*UpdatePetWithFormReq) GetName

func (m *UpdatePetWithFormReq) GetName() string

func (*UpdatePetWithFormReq) GetPetId

func (m *UpdatePetWithFormReq) GetPetId() int64

func (*UpdatePetWithFormReq) GetStatus

func (m *UpdatePetWithFormReq) GetStatus() string

func (*UpdatePetWithFormReq) ProtoMessage

func (*UpdatePetWithFormReq) ProtoMessage()

func (*UpdatePetWithFormReq) Reset

func (m *UpdatePetWithFormReq) Reset()

func (*UpdatePetWithFormReq) String

func (m *UpdatePetWithFormReq) String() string

func (*UpdatePetWithFormReq) XXX_DiscardUnknown

func (m *UpdatePetWithFormReq) XXX_DiscardUnknown()

func (*UpdatePetWithFormReq) XXX_Marshal

func (m *UpdatePetWithFormReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UpdatePetWithFormReq) XXX_Merge

func (m *UpdatePetWithFormReq) XXX_Merge(src proto.Message)

func (*UpdatePetWithFormReq) XXX_Size

func (m *UpdatePetWithFormReq) XXX_Size() int

func (*UpdatePetWithFormReq) XXX_Unmarshal

func (m *UpdatePetWithFormReq) XXX_Unmarshal(b []byte) error

type UploadFileReq

type UploadFileReq struct {
	PetId                int64    `protobuf:"varint,1,opt,name=pet_id,json=petId,proto3" json:"pet_id,omitempty"`
	AdditionalMetadata   string   `protobuf:"bytes,2,opt,name=additional_metadata,json=additionalMetadata,proto3" json:"additional_metadata,omitempty"`
	File                 string   `protobuf:"bytes,3,opt,name=file,proto3" json:"file,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*UploadFileReq) Descriptor

func (*UploadFileReq) Descriptor() ([]byte, []int)

func (*UploadFileReq) GetAdditionalMetadata

func (m *UploadFileReq) GetAdditionalMetadata() string

func (*UploadFileReq) GetFile

func (m *UploadFileReq) GetFile() string

func (*UploadFileReq) GetPetId

func (m *UploadFileReq) GetPetId() int64

func (*UploadFileReq) ProtoMessage

func (*UploadFileReq) ProtoMessage()

func (*UploadFileReq) Reset

func (m *UploadFileReq) Reset()

func (*UploadFileReq) String

func (m *UploadFileReq) String() string

func (*UploadFileReq) XXX_DiscardUnknown

func (m *UploadFileReq) XXX_DiscardUnknown()

func (*UploadFileReq) XXX_Marshal

func (m *UploadFileReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UploadFileReq) XXX_Merge

func (m *UploadFileReq) XXX_Merge(src proto.Message)

func (*UploadFileReq) XXX_Size

func (m *UploadFileReq) XXX_Size() int

func (*UploadFileReq) XXX_Unmarshal

func (m *UploadFileReq) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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