product

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package product is a generated twirp stub package. This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v7.0.0.

It is generated from these files:

catalog-go/product/attribute.proto
catalog-go/product/category.proto
catalog-go/product/image.proto
catalog-go/product/label.proto
catalog-go/product/product.proto

Index

Constants

View Source
const ProductServicePathPrefix = "/twirp/flexdog.catalog.product.ProductService/"

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

Variables

View Source
var (
	Gender_name = map[int32]string{
		0: "UNKNOWN",
		1: "MALE",
		2: "FEMALE",
		3: "UNISEX",
		4: "KIDS",
	}
	Gender_value = map[string]int32{
		"UNKNOWN": 0,
		"MALE":    1,
		"FEMALE":  2,
		"UNISEX":  3,
		"KIDS":    4,
	}
)

Enum value maps for Gender.

View Source
var (
	Stage_name = map[int32]string{
		0: "DRAFT",
		1: "VALIDATION",
		2: "PUBLIC",
		3: "REJECTED",
		4: "DATA_SOURCE",
	}
	Stage_value = map[string]int32{
		"DRAFT":       0,
		"VALIDATION":  1,
		"PUBLIC":      2,
		"REJECTED":    3,
		"DATA_SOURCE": 4,
	}
)

Enum value maps for Stage.

View Source
var (
	Identifier_name = map[int32]string{
		0: "REMOTE_ID",
		1: "MPN",
		2: "GTIN",
	}
	Identifier_value = map[string]int32{
		"REMOTE_ID": 0,
		"MPN":       1,
		"GTIN":      2,
	}
)

Enum value maps for Identifier.

View Source
var File_catalog_go_product_attribute_proto protoreflect.FileDescriptor
View Source
var File_catalog_go_product_category_proto protoreflect.FileDescriptor
View Source
var File_catalog_go_product_image_proto protoreflect.FileDescriptor
View Source
var File_catalog_go_product_label_proto protoreflect.FileDescriptor
View Source
var File_catalog_go_product_product_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 Attribute

type Attribute struct {
	Id      *int32 `protobuf:"varint,1,opt,name=id,proto3,oneof" json:"id,omitempty"`
	TypeId  int32  `protobuf:"varint,2,opt,name=type_id,json=typeId,proto3" json:"type_id,omitempty"`
	Type    string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
	ValueId int32  `protobuf:"varint,4,opt,name=value_id,json=valueId,proto3" json:"value_id,omitempty"`
	// contains filtered or unexported fields
}

func (*Attribute) Descriptor deprecated

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

Deprecated: Use Attribute.ProtoReflect.Descriptor instead.

func (*Attribute) GetId

func (x *Attribute) GetId() int32

func (*Attribute) GetType

func (x *Attribute) GetType() string

func (*Attribute) GetTypeId

func (x *Attribute) GetTypeId() int32

func (*Attribute) GetValueId

func (x *Attribute) GetValueId() int32

func (*Attribute) ProtoMessage

func (*Attribute) ProtoMessage()

func (*Attribute) ProtoReflect

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

func (*Attribute) Reset

func (x *Attribute) Reset()

func (*Attribute) String

func (x *Attribute) String() string

type Category

type Category struct {
	Id         int32  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	CategoryId int32  `protobuf:"varint,2,opt,name=category_id,json=categoryId,proto3" json:"category_id,omitempty"`
	Title      string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
	// contains filtered or unexported fields
}

func (*Category) Descriptor deprecated

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

Deprecated: Use Category.ProtoReflect.Descriptor instead.

func (*Category) GetCategoryId

func (x *Category) GetCategoryId() int32

func (*Category) GetId

func (x *Category) GetId() int32

func (*Category) GetTitle

func (x *Category) GetTitle() string

func (*Category) ProtoMessage

func (*Category) ProtoMessage()

func (*Category) ProtoReflect

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

func (*Category) Reset

func (x *Category) Reset()

func (*Category) String

func (x *Category) String() string

type Gender

type Gender int32
const (
	Gender_UNKNOWN Gender = 0
	Gender_MALE    Gender = 1
	Gender_FEMALE  Gender = 2
	Gender_UNISEX  Gender = 3
	Gender_KIDS    Gender = 4
)

func (Gender) Descriptor

func (Gender) Descriptor() protoreflect.EnumDescriptor

func (Gender) Enum

func (x Gender) Enum() *Gender

func (Gender) EnumDescriptor deprecated

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

Deprecated: Use Gender.Descriptor instead.

func (Gender) Number

func (x Gender) Number() protoreflect.EnumNumber

func (Gender) String

func (x Gender) String() string

func (Gender) Type

func (Gender) Type() protoreflect.EnumType

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 IdentifiedProductResponse

type IdentifiedProductResponse struct {
	IdentifiedBy Identifier         `` /* 138-byte string literal not displayed */
	Products     []*ProductListItem `protobuf:"bytes,2,rep,name=products,proto3" json:"products,omitempty"`
	// contains filtered or unexported fields
}

func (*IdentifiedProductResponse) Descriptor deprecated

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

Deprecated: Use IdentifiedProductResponse.ProtoReflect.Descriptor instead.

func (*IdentifiedProductResponse) GetIdentifiedBy

func (x *IdentifiedProductResponse) GetIdentifiedBy() Identifier

func (*IdentifiedProductResponse) GetProducts

func (x *IdentifiedProductResponse) GetProducts() []*ProductListItem

func (*IdentifiedProductResponse) ProtoMessage

func (*IdentifiedProductResponse) ProtoMessage()

func (*IdentifiedProductResponse) ProtoReflect

func (*IdentifiedProductResponse) Reset

func (x *IdentifiedProductResponse) Reset()

func (*IdentifiedProductResponse) String

func (x *IdentifiedProductResponse) String() string

type Identifier

type Identifier int32
const (
	Identifier_REMOTE_ID Identifier = 0
	Identifier_MPN       Identifier = 1
	Identifier_GTIN      Identifier = 2
)

func (Identifier) Descriptor

func (Identifier) Descriptor() protoreflect.EnumDescriptor

func (Identifier) Enum

func (x Identifier) Enum() *Identifier

func (Identifier) EnumDescriptor deprecated

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

Deprecated: Use Identifier.Descriptor instead.

func (Identifier) Number

func (x Identifier) Number() protoreflect.EnumNumber

func (Identifier) String

func (x Identifier) String() string

func (Identifier) Type

type IdentifyProductRequest

type IdentifyProductRequest struct {
	RemoteId string `protobuf:"bytes,1,opt,name=remote_id,json=remoteId,proto3" json:"remote_id,omitempty"`
	Mpn      string `protobuf:"bytes,2,opt,name=mpn,proto3" json:"mpn,omitempty"`
	Gtin     string `protobuf:"bytes,3,opt,name=gtin,proto3" json:"gtin,omitempty"`
	// contains filtered or unexported fields
}

func (*IdentifyProductRequest) Descriptor deprecated

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

Deprecated: Use IdentifyProductRequest.ProtoReflect.Descriptor instead.

func (*IdentifyProductRequest) GetGtin

func (x *IdentifyProductRequest) GetGtin() string

func (*IdentifyProductRequest) GetMpn

func (x *IdentifyProductRequest) GetMpn() string

func (*IdentifyProductRequest) GetRemoteId

func (x *IdentifyProductRequest) GetRemoteId() string

func (*IdentifyProductRequest) ProtoMessage

func (*IdentifyProductRequest) ProtoMessage()

func (*IdentifyProductRequest) ProtoReflect

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

func (*IdentifyProductRequest) Reset

func (x *IdentifyProductRequest) Reset()

func (*IdentifyProductRequest) String

func (x *IdentifyProductRequest) String() string

type Image

type Image struct {
	Id     *int32 `protobuf:"varint,1,opt,name=id,proto3,oneof" json:"id,omitempty"`
	Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"`
	Alt    string `protobuf:"bytes,3,opt,name=alt,proto3" json:"alt,omitempty"`
	Main   bool   `protobuf:"varint,4,opt,name=main,proto3" json:"main,omitempty"`
	// contains filtered or unexported fields
}

func (*Image) Descriptor deprecated

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

Deprecated: Use Image.ProtoReflect.Descriptor instead.

func (*Image) GetAlt

func (x *Image) GetAlt() string

func (*Image) GetId

func (x *Image) GetId() int32

func (*Image) GetMain

func (x *Image) GetMain() bool

func (*Image) GetSource

func (x *Image) GetSource() string

func (*Image) ProtoMessage

func (*Image) ProtoMessage()

func (*Image) ProtoReflect

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

func (*Image) Reset

func (x *Image) Reset()

func (*Image) String

func (x *Image) String() string

type Label

type Label struct {
	Id     *int32 `protobuf:"varint,1,opt,name=id,proto3,oneof" json:"id,omitempty"`
	Name   string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Title  string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
	Active bool   `protobuf:"varint,4,opt,name=active,proto3" json:"active,omitempty"`
	// contains filtered or unexported fields
}

func (*Label) Descriptor deprecated

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

Deprecated: Use Label.ProtoReflect.Descriptor instead.

func (*Label) GetActive

func (x *Label) GetActive() bool

func (*Label) GetId

func (x *Label) GetId() int32

func (*Label) GetName

func (x *Label) GetName() string

func (*Label) GetTitle

func (x *Label) GetTitle() string

func (*Label) ProtoMessage

func (*Label) ProtoMessage()

func (*Label) ProtoReflect

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

func (*Label) Reset

func (x *Label) Reset()

func (*Label) String

func (x *Label) String() string

type Product

type Product struct {
	Id                *int32               `protobuf:"varint,1,opt,name=id,proto3,oneof" json:"id,omitempty"`
	Title             string               `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	Description       string               `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	MetaTitle         string               `protobuf:"bytes,4,opt,name=meta_title,json=metaTitle,proto3" json:"meta_title,omitempty"`
	MetaDescription   string               `protobuf:"bytes,5,opt,name=meta_description,json=metaDescription,proto3" json:"meta_description,omitempty"`
	MetaKeywords      string               `protobuf:"bytes,6,opt,name=meta_keywords,json=metaKeywords,proto3" json:"meta_keywords,omitempty"`
	Slug              string               `protobuf:"bytes,31,opt,name=slug,proto3" json:"slug,omitempty"`
	Code              string               `protobuf:"bytes,7,opt,name=code,proto3" json:"code,omitempty"`
	ManualPairingCode string               `protobuf:"bytes,8,opt,name=manual_pairing_code,json=manualPairingCode,proto3" json:"manual_pairing_code,omitempty"`
	ReleasedDate      *timestamp.Timestamp `protobuf:"bytes,9,opt,name=released_date,json=releasedDate,proto3" json:"released_date,omitempty"`
	Stage             Stage                `protobuf:"varint,10,opt,name=stage,proto3,enum=flexdog.catalog.product.Stage" json:"stage,omitempty"`
	Source            string               `protobuf:"bytes,11,opt,name=source,proto3" json:"source,omitempty"`
	Gender            Gender               `protobuf:"varint,12,opt,name=gender,proto3,enum=flexdog.catalog.product.Gender" json:"gender,omitempty"`
	Mpn               string               `protobuf:"bytes,13,opt,name=mpn,proto3" json:"mpn,omitempty"`
	Gtin              string               `protobuf:"bytes,14,opt,name=gtin,proto3" json:"gtin,omitempty"`
	MainProductId     *int32               `protobuf:"varint,15,opt,name=main_product_id,json=mainProductId,proto3,oneof" json:"main_product_id,omitempty"`
	RemoteId          string               `protobuf:"bytes,16,opt,name=remote_id,json=remoteId,proto3" json:"remote_id,omitempty"`
	RecommendedPrice  float64              `protobuf:"fixed64,17,opt,name=recommended_price,json=recommendedPrice,proto3" json:"recommended_price,omitempty"`
	// referrals
	BrandId     int32                `protobuf:"varint,18,opt,name=brand_id,json=brandId,proto3" json:"brand_id,omitempty"`
	ModelId     int32                `protobuf:"varint,19,opt,name=model_id,json=modelId,proto3" json:"model_id,omitempty"`
	SizeTableId *int32               `protobuf:"varint,20,opt,name=size_table_id,json=sizeTableId,proto3,oneof" json:"size_table_id,omitempty"`
	Attributes  []*Attribute         `protobuf:"bytes,23,rep,name=attributes,proto3" json:"attributes,omitempty"`
	Categories  []*Category          `protobuf:"bytes,24,rep,name=categories,proto3" json:"categories,omitempty"`
	Images      []*Image             `protobuf:"bytes,25,rep,name=images,proto3" json:"images,omitempty"`
	Labels      []*Label             `protobuf:"bytes,30,rep,name=labels,proto3" json:"labels,omitempty"`
	Active      bool                 `protobuf:"varint,26,opt,name=active,proto3" json:"active,omitempty"`
	ActiveSince *timestamp.Timestamp `protobuf:"bytes,27,opt,name=active_since,json=activeSince,proto3" json:"active_since,omitempty"`
	// metadata
	CreatedAt *timestamp.Timestamp `protobuf:"bytes,28,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	UpdatedAt *timestamp.Timestamp `protobuf:"bytes,29,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	// contains filtered or unexported fields
}

func (*Product) Descriptor deprecated

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

Deprecated: Use Product.ProtoReflect.Descriptor instead.

func (*Product) GetActive

func (x *Product) GetActive() bool

func (*Product) GetActiveSince

func (x *Product) GetActiveSince() *timestamp.Timestamp

func (*Product) GetAttributes

func (x *Product) GetAttributes() []*Attribute

func (*Product) GetBrandId

func (x *Product) GetBrandId() int32

func (*Product) GetCategories

func (x *Product) GetCategories() []*Category

func (*Product) GetCode

func (x *Product) GetCode() string

func (*Product) GetCreatedAt

func (x *Product) GetCreatedAt() *timestamp.Timestamp

func (*Product) GetDescription

func (x *Product) GetDescription() string

func (*Product) GetGender

func (x *Product) GetGender() Gender

func (*Product) GetGtin

func (x *Product) GetGtin() string

func (*Product) GetId

func (x *Product) GetId() int32

func (*Product) GetImages

func (x *Product) GetImages() []*Image

func (*Product) GetLabels

func (x *Product) GetLabels() []*Label

func (*Product) GetMainProductId

func (x *Product) GetMainProductId() int32

func (*Product) GetManualPairingCode

func (x *Product) GetManualPairingCode() string

func (*Product) GetMetaDescription

func (x *Product) GetMetaDescription() string

func (*Product) GetMetaKeywords

func (x *Product) GetMetaKeywords() string

func (*Product) GetMetaTitle

func (x *Product) GetMetaTitle() string

func (*Product) GetModelId

func (x *Product) GetModelId() int32

func (*Product) GetMpn

func (x *Product) GetMpn() string

func (*Product) GetRecommendedPrice

func (x *Product) GetRecommendedPrice() float64

func (*Product) GetReleasedDate

func (x *Product) GetReleasedDate() *timestamp.Timestamp

func (*Product) GetRemoteId

func (x *Product) GetRemoteId() string

func (*Product) GetSizeTableId

func (x *Product) GetSizeTableId() int32

func (*Product) GetSlug

func (x *Product) GetSlug() string

func (*Product) GetSource

func (x *Product) GetSource() string

func (*Product) GetStage

func (x *Product) GetStage() Stage

func (*Product) GetTitle

func (x *Product) GetTitle() string

func (*Product) GetUpdatedAt

func (x *Product) GetUpdatedAt() *timestamp.Timestamp

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 ProductListItem

type ProductListItem struct {
	Id                *int32               `protobuf:"varint,1,opt,name=Id,proto3,oneof" json:"Id,omitempty"`
	Title             string               `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	Description       string               `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	Slug              string               `protobuf:"bytes,18,opt,name=slug,proto3" json:"slug,omitempty"`
	Code              string               `protobuf:"bytes,4,opt,name=code,proto3" json:"code,omitempty"`
	ManualPairingCode string               `protobuf:"bytes,5,opt,name=manual_pairing_code,json=manualPairingCode,proto3" json:"manual_pairing_code,omitempty"`
	Gender            Gender               `protobuf:"varint,6,opt,name=gender,proto3,enum=flexdog.catalog.product.Gender" json:"gender,omitempty"`
	Mpn               string               `protobuf:"bytes,7,opt,name=mpn,proto3" json:"mpn,omitempty"`
	Gtin              string               `protobuf:"bytes,8,opt,name=gtin,proto3" json:"gtin,omitempty"`
	RemoteId          string               `protobuf:"bytes,9,opt,name=remote_id,json=remoteId,proto3" json:"remote_id,omitempty"`
	ReleasedDate      *timestamp.Timestamp `protobuf:"bytes,10,opt,name=released_date,json=releasedDate,proto3" json:"released_date,omitempty"`
	Stage             Stage                `protobuf:"varint,11,opt,name=stage,proto3,enum=flexdog.catalog.product.Stage" json:"stage,omitempty"`
	Active            bool                 `protobuf:"varint,19,opt,name=active,proto3" json:"active,omitempty"`
	// referrals
	BrandId     int32  `protobuf:"varint,12,opt,name=brand_id,json=brandId,proto3" json:"brand_id,omitempty"`
	ModelId     int32  `protobuf:"varint,13,opt,name=model_id,json=modelId,proto3" json:"model_id,omitempty"`
	SizeTableId *int32 `protobuf:"varint,14,opt,name=size_table_id,json=sizeTableId,proto3,oneof" json:"size_table_id,omitempty"`
	// metadata
	CreatedAt     *timestamp.Timestamp `protobuf:"bytes,15,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	UpdatedAt     *timestamp.Timestamp `protobuf:"bytes,16,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	MainProductId *int32               `protobuf:"varint,17,opt,name=main_product_id,json=mainProductId,proto3,oneof" json:"main_product_id,omitempty"`
	// contains filtered or unexported fields
}

func (*ProductListItem) Descriptor deprecated

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

Deprecated: Use ProductListItem.ProtoReflect.Descriptor instead.

func (*ProductListItem) GetActive

func (x *ProductListItem) GetActive() bool

func (*ProductListItem) GetBrandId

func (x *ProductListItem) GetBrandId() int32

func (*ProductListItem) GetCode

func (x *ProductListItem) GetCode() string

func (*ProductListItem) GetCreatedAt

func (x *ProductListItem) GetCreatedAt() *timestamp.Timestamp

func (*ProductListItem) GetDescription

func (x *ProductListItem) GetDescription() string

func (*ProductListItem) GetGender

func (x *ProductListItem) GetGender() Gender

func (*ProductListItem) GetGtin

func (x *ProductListItem) GetGtin() string

func (*ProductListItem) GetId

func (x *ProductListItem) GetId() int32

func (*ProductListItem) GetMainProductId

func (x *ProductListItem) GetMainProductId() int32

func (*ProductListItem) GetManualPairingCode

func (x *ProductListItem) GetManualPairingCode() string

func (*ProductListItem) GetModelId

func (x *ProductListItem) GetModelId() int32

func (*ProductListItem) GetMpn

func (x *ProductListItem) GetMpn() string

func (*ProductListItem) GetReleasedDate

func (x *ProductListItem) GetReleasedDate() *timestamp.Timestamp

func (*ProductListItem) GetRemoteId

func (x *ProductListItem) GetRemoteId() string

func (*ProductListItem) GetSizeTableId

func (x *ProductListItem) GetSizeTableId() int32

func (*ProductListItem) GetSlug

func (x *ProductListItem) GetSlug() string

func (*ProductListItem) GetStage

func (x *ProductListItem) GetStage() Stage

func (*ProductListItem) GetTitle

func (x *ProductListItem) GetTitle() string

func (*ProductListItem) GetUpdatedAt

func (x *ProductListItem) GetUpdatedAt() *timestamp.Timestamp

func (*ProductListItem) ProtoMessage

func (*ProductListItem) ProtoMessage()

func (*ProductListItem) ProtoReflect

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

func (*ProductListItem) Reset

func (x *ProductListItem) Reset()

func (*ProductListItem) String

func (x *ProductListItem) String() string

type ProductRequest

type ProductRequest struct {
	Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*ProductRequest) Descriptor deprecated

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

Deprecated: Use ProductRequest.ProtoReflect.Descriptor instead.

func (*ProductRequest) GetId

func (x *ProductRequest) GetId() int32

func (*ProductRequest) ProtoMessage

func (*ProductRequest) ProtoMessage()

func (*ProductRequest) ProtoReflect

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

func (*ProductRequest) Reset

func (x *ProductRequest) Reset()

func (*ProductRequest) String

func (x *ProductRequest) String() string

type ProductService

type ProductService interface {
	// product calls
	Get(context.Context, *ProductRequest) (*Product, error)

	IdentifyProduct(context.Context, *IdentifyProductRequest) (*IdentifiedProductResponse, error)
}

func NewProductServiceJSONClient

func NewProductServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) ProductService

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

func NewProductServiceProtobufClient

func NewProductServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) ProductService

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

type Stage

type Stage int32
const (
	Stage_DRAFT       Stage = 0
	Stage_VALIDATION  Stage = 1
	Stage_PUBLIC      Stage = 2
	Stage_REJECTED    Stage = 3
	Stage_DATA_SOURCE Stage = 4
)

func (Stage) Descriptor

func (Stage) Descriptor() protoreflect.EnumDescriptor

func (Stage) Enum

func (x Stage) Enum() *Stage

func (Stage) EnumDescriptor deprecated

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

Deprecated: Use Stage.Descriptor instead.

func (Stage) Number

func (x Stage) Number() protoreflect.EnumNumber

func (Stage) String

func (x Stage) String() string

func (Stage) Type

func (Stage) Type() protoreflect.EnumType

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
	// github.com/golang/protobuf/protoc-gen-go/descriptor.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 NewProductServiceServer

func NewProductServiceServer(svc ProductService, opts ...interface{}) TwirpServer

NewProductServiceServer 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