productseller

package
v0.0.0-...-f4b56a8 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const ProductSellerPathPrefix = "/twirp/com.leftbyte.productseller.ProductSeller/"

ProductSellerPathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html

Variables

View Source
var File_github_com_leftbyte_product_seller_rpc_productseller_productseller_proto protoreflect.FileDescriptor

Functions

func WriteError

func WriteError(resp http.ResponseWriter, err error)

WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)

Types

type CreateProductReq

type CreateProductReq struct {
	Product *Product `protobuf:"bytes,1,opt,name=product,proto3" json:"product,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateProductReq) Descriptor deprecated

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

Deprecated: Use CreateProductReq.ProtoReflect.Descriptor instead.

func (*CreateProductReq) GetProduct

func (x *CreateProductReq) GetProduct() *Product

func (*CreateProductReq) ProtoMessage

func (*CreateProductReq) ProtoMessage()

func (*CreateProductReq) ProtoReflect

func (x *CreateProductReq) ProtoReflect() protoreflect.Message

func (*CreateProductReq) Reset

func (x *CreateProductReq) Reset()

func (*CreateProductReq) String

func (x *CreateProductReq) String() string

type CreateProductResp

type CreateProductResp struct {
	Status        int32  `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`                                   // status code: 0 for OK
	StatusMessage string `protobuf:"bytes,2,opt,name=status_message,json=statusMessage,proto3" json:"status_message,omitempty"` // more context related to status
	// contains filtered or unexported fields
}

func (*CreateProductResp) Descriptor deprecated

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

Deprecated: Use CreateProductResp.ProtoReflect.Descriptor instead.

func (*CreateProductResp) GetStatus

func (x *CreateProductResp) GetStatus() int32

func (*CreateProductResp) GetStatusMessage

func (x *CreateProductResp) GetStatusMessage() string

func (*CreateProductResp) ProtoMessage

func (*CreateProductResp) ProtoMessage()

func (*CreateProductResp) ProtoReflect

func (x *CreateProductResp) ProtoReflect() protoreflect.Message

func (*CreateProductResp) Reset

func (x *CreateProductResp) Reset()

func (*CreateProductResp) String

func (x *CreateProductResp) String() string

type GetProductsReq

type GetProductsReq struct {
	Page          *uint32 `protobuf:"varint,1,opt,name=page,proto3,oneof" json:"page,omitempty"`      // default: 1
	Limit         *uint32 `protobuf:"varint,2,opt,name=limit,proto3,oneof" json:"limit,omitempty"`    // default: 25
	Sortby        *string `protobuf:"bytes,3,opt,name=sortby,proto3,oneof" json:"sortby,omitempty"`   // default: None
	Sortdir       *string `protobuf:"bytes,4,opt,name=sortdir,proto3,oneof" json:"sortdir,omitempty"` // default: None
	QueryName     string  `protobuf:"bytes,5,opt,name=query_name,json=queryName,proto3" json:"query_name,omitempty"`
	QueryCategory string  `protobuf:"bytes,6,opt,name=query_category,json=queryCategory,proto3" json:"query_category,omitempty"`
	QuerySku      string  `protobuf:"bytes,7,opt,name=query_sku,json=querySku,proto3" json:"query_sku,omitempty"`
	// contains filtered or unexported fields
}

func (*GetProductsReq) Descriptor deprecated

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

Deprecated: Use GetProductsReq.ProtoReflect.Descriptor instead.

func (*GetProductsReq) GetLimit

func (x *GetProductsReq) GetLimit() uint32

func (*GetProductsReq) GetPage

func (x *GetProductsReq) GetPage() uint32

func (*GetProductsReq) GetQueryCategory

func (x *GetProductsReq) GetQueryCategory() string

func (*GetProductsReq) GetQueryName

func (x *GetProductsReq) GetQueryName() string

func (*GetProductsReq) GetQuerySku

func (x *GetProductsReq) GetQuerySku() string

func (*GetProductsReq) GetSortby

func (x *GetProductsReq) GetSortby() string

func (*GetProductsReq) GetSortdir

func (x *GetProductsReq) GetSortdir() string

func (*GetProductsReq) ProtoMessage

func (*GetProductsReq) ProtoMessage()

func (*GetProductsReq) ProtoReflect

func (x *GetProductsReq) ProtoReflect() protoreflect.Message

func (*GetProductsReq) Reset

func (x *GetProductsReq) Reset()

func (*GetProductsReq) String

func (x *GetProductsReq) String() string

type GetProductsResp

type GetProductsResp struct {
	Page       uint32    `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
	NumResults uint32    `protobuf:"varint,2,opt,name=num_results,json=numResults,proto3" json:"num_results,omitempty"`
	Products   *Products `protobuf:"bytes,3,opt,name=products,proto3" json:"products,omitempty"`
	// contains filtered or unexported fields
}

func (*GetProductsResp) Descriptor deprecated

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

Deprecated: Use GetProductsResp.ProtoReflect.Descriptor instead.

func (*GetProductsResp) GetNumResults

func (x *GetProductsResp) GetNumResults() uint32

func (*GetProductsResp) GetPage

func (x *GetProductsResp) GetPage() uint32

func (*GetProductsResp) GetProducts

func (x *GetProductsResp) GetProducts() *Products

func (*GetProductsResp) ProtoMessage

func (*GetProductsResp) ProtoMessage()

func (*GetProductsResp) ProtoReflect

func (x *GetProductsResp) ProtoReflect() protoreflect.Message

func (*GetProductsResp) Reset

func (x *GetProductsResp) Reset()

func (*GetProductsResp) String

func (x *GetProductsResp) String() string

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.

type Product

type Product struct {
	Sku      string `protobuf:"bytes,1,opt,name=sku,proto3" json:"sku,omitempty"`
	Name     string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Category string `protobuf:"bytes,3,opt,name=category,proto3" json:"category,omitempty"`
	// contains filtered or unexported fields
}

func (*Product) Descriptor deprecated

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

Deprecated: Use Product.ProtoReflect.Descriptor instead.

func (*Product) GetCategory

func (x *Product) GetCategory() string

func (*Product) GetName

func (x *Product) GetName() string

func (*Product) GetSku

func (x *Product) GetSku() string

func (*Product) ProtoMessage

func (*Product) ProtoMessage()

func (*Product) ProtoReflect

func (x *Product) ProtoReflect() protoreflect.Message

func (*Product) Reset

func (x *Product) Reset()

func (*Product) String

func (x *Product) String() string

type ProductSeller

type ProductSeller interface {
	CreateProduct(context.Context, *CreateProductReq) (*CreateProductResp, error)

	GetProducts(context.Context, *GetProductsReq) (*GetProductsResp, error)
}

func NewProductSellerJSONClient

func NewProductSellerJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) ProductSeller

NewProductSellerJSONClient creates a JSON client that implements the ProductSeller interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewProductSellerProtobufClient

func NewProductSellerProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) ProductSeller

NewProductSellerProtobufClient creates a Protobuf client that implements the ProductSeller interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type Products

type Products struct {
	Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"`
	// contains filtered or unexported fields
}

func (*Products) Descriptor deprecated

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

Deprecated: Use Products.ProtoReflect.Descriptor instead.

func (*Products) GetProducts

func (x *Products) GetProducts() []*Product

func (*Products) ProtoMessage

func (*Products) ProtoMessage()

func (*Products) ProtoReflect

func (x *Products) ProtoReflect() protoreflect.Message

func (*Products) Reset

func (x *Products) Reset()

func (*Products) String

func (x *Products) String() string

type TwirpServer

type TwirpServer interface {
	http.Handler

	// ServiceDescriptor returns gzipped bytes describing the .proto file that
	// this service was generated from. Once unzipped, the bytes can be
	// unmarshalled as a
	// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.
	//
	// The returned integer is the index of this particular service within that
	// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
	// low-level field, expected to be used for reflection.
	ServiceDescriptor() ([]byte, int)

	// ProtocGenTwirpVersion is the semantic version string of the version of
	// twirp used to generate this file.
	ProtocGenTwirpVersion() string

	// PathPrefix returns the HTTP URL path prefix for all methods handled by this
	// service. This can be used with an HTTP mux to route Twirp requests.
	// The path prefix is in the form: "/<prefix>/<package>.<Service>/"
	// that is, everything in a Twirp route except for the <Method> at the end.
	PathPrefix() string
}

TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.

func NewProductSellerServer

func NewProductSellerServer(svc ProductSeller, opts ...interface{}) TwirpServer

NewProductSellerServer builds a TwirpServer that can be used as an http.Handler to handle HTTP requests that are routed to the right method in the provided svc implementation. The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).

Jump to

Keyboard shortcuts

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