api

package
v0.0.0-...-e6d3afb Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterProdServiceHandler

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

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

func RegisterProdServiceHandlerClient

func RegisterProdServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ProdServiceClient) error

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

func RegisterProdServiceHandlerFromEndpoint

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

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

func RegisterProdServiceHandlerServer

func RegisterProdServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ProdServiceServer) error

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

func RegisterProdServiceServer

func RegisterProdServiceServer(s *grpc.Server, srv ProdServiceServer)

func RegisterStorageServiceServer

func RegisterStorageServiceServer(s *grpc.Server, srv StorageServiceServer)

Types

type ClientRequestProds

type ClientRequestProds struct {
	Vendor               string   `protobuf:"bytes,1,opt,name=vendor,proto3" json:"vendor,omitempty"`
	ProductType          string   `protobuf:"bytes,2,opt,name=productType,proto3" json:"productType,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ClientRequestProds) Descriptor

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

func (*ClientRequestProds) GetProductType

func (m *ClientRequestProds) GetProductType() string

func (*ClientRequestProds) GetVendor

func (m *ClientRequestProds) GetVendor() string

func (*ClientRequestProds) ProtoMessage

func (*ClientRequestProds) ProtoMessage()

func (*ClientRequestProds) Reset

func (m *ClientRequestProds) Reset()

func (*ClientRequestProds) String

func (m *ClientRequestProds) String() string

func (*ClientRequestProds) XXX_DiscardUnknown

func (m *ClientRequestProds) XXX_DiscardUnknown()

func (*ClientRequestProds) XXX_Marshal

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

func (*ClientRequestProds) XXX_Merge

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

func (*ClientRequestProds) XXX_Size

func (m *ClientRequestProds) XXX_Size() int

func (*ClientRequestProds) XXX_Unmarshal

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

type ClientRequestType

type ClientRequestType struct {
	Vendor               string   `protobuf:"bytes,1,opt,name=vendor,proto3" json:"vendor,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ClientRequestType) Descriptor

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

func (*ClientRequestType) GetVendor

func (m *ClientRequestType) GetVendor() string

func (*ClientRequestType) ProtoMessage

func (*ClientRequestType) ProtoMessage()

func (*ClientRequestType) Reset

func (m *ClientRequestType) Reset()

func (*ClientRequestType) String

func (m *ClientRequestType) String() string

func (*ClientRequestType) XXX_DiscardUnknown

func (m *ClientRequestType) XXX_DiscardUnknown()

func (*ClientRequestType) XXX_Marshal

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

func (*ClientRequestType) XXX_Merge

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

func (*ClientRequestType) XXX_Size

func (m *ClientRequestType) XXX_Size() int

func (*ClientRequestType) XXX_Unmarshal

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

type ClientResponseProds

type ClientResponseProds struct {
	Product              *ProdsPrep `protobuf:"bytes,1,opt,name=product,proto3" json:"product,omitempty"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_unrecognized     []byte     `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (*ClientResponseProds) Descriptor

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

func (*ClientResponseProds) GetProduct

func (m *ClientResponseProds) GetProduct() *ProdsPrep

func (*ClientResponseProds) ProtoMessage

func (*ClientResponseProds) ProtoMessage()

func (*ClientResponseProds) Reset

func (m *ClientResponseProds) Reset()

func (*ClientResponseProds) String

func (m *ClientResponseProds) String() string

func (*ClientResponseProds) XXX_DiscardUnknown

func (m *ClientResponseProds) XXX_DiscardUnknown()

func (*ClientResponseProds) XXX_Marshal

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

func (*ClientResponseProds) XXX_Merge

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

func (*ClientResponseProds) XXX_Size

func (m *ClientResponseProds) XXX_Size() int

func (*ClientResponseProds) XXX_Unmarshal

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

type ClientResponseType

type ClientResponseType struct {
	ProductType          string   `protobuf:"bytes,1,opt,name=productType,proto3" json:"productType,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ClientResponseType) Descriptor

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

func (*ClientResponseType) GetProductType

func (m *ClientResponseType) GetProductType() string

func (*ClientResponseType) ProtoMessage

func (*ClientResponseType) ProtoMessage()

func (*ClientResponseType) Reset

func (m *ClientResponseType) Reset()

func (*ClientResponseType) String

func (m *ClientResponseType) String() string

func (*ClientResponseType) XXX_DiscardUnknown

func (m *ClientResponseType) XXX_DiscardUnknown()

func (*ClientResponseType) XXX_Marshal

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

func (*ClientResponseType) XXX_Merge

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

func (*ClientResponseType) XXX_Size

func (m *ClientResponseType) XXX_Size() int

func (*ClientResponseType) XXX_Unmarshal

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

type ProdServiceClient

type ProdServiceClient interface {
	GetVendorProdTypes(ctx context.Context, in *ClientRequestType, opts ...grpc.CallOption) (*ClientResponseType, error)
	GetVendorProds(ctx context.Context, in *ClientRequestProds, opts ...grpc.CallOption) (ProdService_GetVendorProdsClient, error)
}

ProdServiceClient is the client API for ProdService service.

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

func NewProdServiceClient

func NewProdServiceClient(cc *grpc.ClientConn) ProdServiceClient

type ProdServiceServer

type ProdServiceServer interface {
	GetVendorProdTypes(context.Context, *ClientRequestType) (*ClientResponseType, error)
	GetVendorProds(*ClientRequestProds, ProdService_GetVendorProdsServer) error
}

ProdServiceServer is the server API for ProdService service.

type ProdService_GetVendorProdsClient

type ProdService_GetVendorProdsClient interface {
	Recv() (*ClientResponseProds, error)
	grpc.ClientStream
}

type ProdService_GetVendorProdsServer

type ProdService_GetVendorProdsServer interface {
	Send(*ClientResponseProds) error
	grpc.ServerStream
}

type ProdsPrep

type ProdsPrep struct {
	Title                string   `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	Url                  string   `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
	ShortUrl             string   `protobuf:"bytes,3,opt,name=shortUrl,proto3" json:"shortUrl,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ProdsPrep) Descriptor

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

func (*ProdsPrep) GetShortUrl

func (m *ProdsPrep) GetShortUrl() string

func (*ProdsPrep) GetTitle

func (m *ProdsPrep) GetTitle() string

func (*ProdsPrep) GetUrl

func (m *ProdsPrep) GetUrl() string

func (*ProdsPrep) ProtoMessage

func (*ProdsPrep) ProtoMessage()

func (*ProdsPrep) Reset

func (m *ProdsPrep) Reset()

func (*ProdsPrep) String

func (m *ProdsPrep) String() string

func (*ProdsPrep) XXX_DiscardUnknown

func (m *ProdsPrep) XXX_DiscardUnknown()

func (*ProdsPrep) XXX_Marshal

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

func (*ProdsPrep) XXX_Merge

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

func (*ProdsPrep) XXX_Size

func (m *ProdsPrep) XXX_Size() int

func (*ProdsPrep) XXX_Unmarshal

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

type Product

type Product struct {
	Title                string   `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	Url                  string   `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Product) Descriptor

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

func (*Product) GetTitle

func (m *Product) GetTitle() string

func (*Product) GetUrl

func (m *Product) GetUrl() string

func (*Product) ProtoMessage

func (*Product) ProtoMessage()

func (*Product) Reset

func (m *Product) Reset()

func (*Product) String

func (m *Product) String() string

func (*Product) XXX_DiscardUnknown

func (m *Product) XXX_DiscardUnknown()

func (*Product) XXX_Marshal

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

func (*Product) XXX_Merge

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

func (*Product) XXX_Size

func (m *Product) XXX_Size() int

func (*Product) XXX_Unmarshal

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

type StorageRequest

type StorageRequest struct {
	Vendor               string   `protobuf:"bytes,1,opt,name=vendor,proto3" json:"vendor,omitempty"`
	ProductType          string   `protobuf:"bytes,2,opt,name=productType,proto3" json:"productType,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*StorageRequest) Descriptor

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

func (*StorageRequest) GetProductType

func (m *StorageRequest) GetProductType() string

func (*StorageRequest) GetVendor

func (m *StorageRequest) GetVendor() string

func (*StorageRequest) ProtoMessage

func (*StorageRequest) ProtoMessage()

func (*StorageRequest) Reset

func (m *StorageRequest) Reset()

func (*StorageRequest) String

func (m *StorageRequest) String() string

func (*StorageRequest) XXX_DiscardUnknown

func (m *StorageRequest) XXX_DiscardUnknown()

func (*StorageRequest) XXX_Marshal

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

func (*StorageRequest) XXX_Merge

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

func (*StorageRequest) XXX_Size

func (m *StorageRequest) XXX_Size() int

func (*StorageRequest) XXX_Unmarshal

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

type StorageResponse

type StorageResponse struct {
	ProdDetail           []*Product `protobuf:"bytes,1,rep,name=prodDetail,proto3" json:"prodDetail,omitempty"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_unrecognized     []byte     `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (*StorageResponse) Descriptor

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

func (*StorageResponse) GetProdDetail

func (m *StorageResponse) GetProdDetail() []*Product

func (*StorageResponse) ProtoMessage

func (*StorageResponse) ProtoMessage()

func (*StorageResponse) Reset

func (m *StorageResponse) Reset()

func (*StorageResponse) String

func (m *StorageResponse) String() string

func (*StorageResponse) XXX_DiscardUnknown

func (m *StorageResponse) XXX_DiscardUnknown()

func (*StorageResponse) XXX_Marshal

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

func (*StorageResponse) XXX_Merge

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

func (*StorageResponse) XXX_Size

func (m *StorageResponse) XXX_Size() int

func (*StorageResponse) XXX_Unmarshal

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

type StorageServiceClient

type StorageServiceClient interface {
	GetProdsDetail(ctx context.Context, in *StorageRequest, opts ...grpc.CallOption) (*StorageResponse, error)
}

StorageServiceClient is the client API for StorageService service.

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

func NewStorageServiceClient

func NewStorageServiceClient(cc *grpc.ClientConn) StorageServiceClient

type StorageServiceServer

type StorageServiceServer interface {
	GetProdsDetail(context.Context, *StorageRequest) (*StorageResponse, error)
}

StorageServiceServer is the server API for StorageService service.

type UnimplementedProdServiceServer

type UnimplementedProdServiceServer struct {
}

UnimplementedProdServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedProdServiceServer) GetVendorProdTypes

func (*UnimplementedProdServiceServer) GetVendorProds

type UnimplementedStorageServiceServer

type UnimplementedStorageServiceServer struct {
}

UnimplementedStorageServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedStorageServiceServer) GetProdsDetail

Jump to

Keyboard shortcuts

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