chore: initial commit

This commit is contained in:
2024-04-16 22:27:52 +01:00
commit 531b5dabe2
194 changed files with 27071 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package config
import (
"os"
"github.com/hexolan/stocklet/internal/pkg/errors"
)
// Load an option from an environment variable
func loadFromEnv(name string) *string {
value, exists := os.LookupEnv(name)
if !exists || value == "" {
return nil
}
return &value
}
// Require an option from an environment variable
func RequireFromEnv(name string) (string, error) {
value := loadFromEnv(name)
if value == nil {
return "", errors.NewServiceErrorf(errors.ErrCodeService, "failed to load required cfg option (%s)", name)
}
return *value, nil
}
// Shared configuration implemented by all services
type SharedConfig struct {
// Env Var: "MODE" (optional)
// 'dev' or 'development' -> true
// Defaults to false
DevMode bool
Otel OtelConfig
}
// Load the options in the shared config
func (cfg *SharedConfig) Load() error {
// Determine application mode
cfg.DevMode = false
if mode, err := RequireFromEnv("MODE"); err == nil && (mode == "dev" || mode == "development") {
cfg.DevMode = true
}
// load the Open Telemetry config
cfg.Otel = OtelConfig{}
if err := cfg.Otel.Load(); err != nil {
return err
}
// Config succesfully loaded
return nil
}

View File

@@ -0,0 +1,40 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package config
import (
"strings"
)
type KafkaConfig struct {
// Env Var: "KAFKA_BROKERS"
// Comma delimited from env var.
Brokers []string
}
func (cfg *KafkaConfig) Load() error {
// load configurations from env
brokersOpt, err := RequireFromEnv("KAFKA_BROKERS")
if err != nil {
return err
}
// Comma seperate the kafka brokers
cfg.Brokers = strings.Split(brokersOpt, ",")
// Config options were succesfully loaded
return nil
}

View File

@@ -0,0 +1,33 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package config
type OtelConfig struct {
// Env Var: "OTEL_COLLECTOR_GRPC"
CollectorGrpc string
}
func (cfg *OtelConfig) Load() error {
// Load configurations from env
if collectorGrpc, err := RequireFromEnv("OTEL_COLLECTOR_GRPC"); err != nil {
return err
} else {
cfg.CollectorGrpc = collectorGrpc
}
// Succesfully loaded config properties
return nil
}

View File

@@ -0,0 +1,85 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package config
import (
"fmt"
)
type PostgresConfig struct {
// Env Var: "PG_USER"
Username string
// Env Var: "PG_PASS"
Password string
// Env Var: "PG_HOST"
Host string
// Env Var: "PG_PORT" (optional)
// Defaults to "5432"
Port string
// Env Var: "PG_DB"
Database string
}
func (conf *PostgresConfig) GetDSN() string {
return fmt.Sprintf(
"postgresql://%s:%s@%s:%s/%s?sslmode=disable",
conf.Username,
conf.Password,
conf.Host,
conf.Port,
conf.Database,
)
}
func (cfg *PostgresConfig) Load() error {
// Load configurations from env
if opt, err := RequireFromEnv("PG_USER"); err != nil {
return err
} else {
cfg.Username = opt
}
if opt, err := RequireFromEnv("PG_PASS"); err != nil {
return err
} else {
cfg.Password = opt
}
if opt, err := RequireFromEnv("PG_HOST"); err != nil {
return err
} else {
cfg.Host = opt
}
if opt, err := RequireFromEnv("PG_PORT"); err != nil {
cfg.Port = "5432"
} else {
cfg.Port = opt
}
if opt, err := RequireFromEnv("PG_DB"); err != nil {
return err
} else {
cfg.Database = opt
}
// Config properties succesfully loaded
return nil
}

View File

@@ -0,0 +1,62 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package errors
import (
"google.golang.org/grpc/codes"
)
type ErrorCode int32
const (
ErrCodeUnknown ErrorCode = iota
ErrCodeService
ErrCodeExtService
ErrCodeNotFound
ErrCodeAlreadyExists
ErrCodeForbidden
ErrCodeUnauthorised
ErrCodeInvalidArgument
)
// Maps the custom service error codes
// to their gRPC status code equivalents.
func (c ErrorCode) GRPCCode() codes.Code {
codeMap := map[ErrorCode]codes.Code{
ErrCodeUnknown: codes.Unknown,
ErrCodeService: codes.Internal,
ErrCodeExtService: codes.Unavailable,
ErrCodeNotFound: codes.NotFound,
ErrCodeAlreadyExists: codes.AlreadyExists,
ErrCodeForbidden: codes.PermissionDenied,
ErrCodeUnauthorised: codes.PermissionDenied,
ErrCodeInvalidArgument: codes.InvalidArgument,
}
grpcCode, mapped := codeMap[c]
if mapped {
return grpcCode
}
return codes.Unknown
}

View File

@@ -0,0 +1,71 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package errors
import (
"fmt"
"google.golang.org/grpc/status"
)
type ServiceError struct {
code ErrorCode
msg string
wrapped error
}
func NewServiceError(code ErrorCode, msg string) error {
return &ServiceError{
code: code,
msg: msg,
}
}
func NewServiceErrorf(code ErrorCode, msg string, args ...interface{}) error {
return NewServiceError(code, fmt.Sprintf(msg, args...))
}
func WrapServiceError(code ErrorCode, msg string, wrapped error) error {
return &ServiceError{
code: code,
msg: msg,
wrapped: wrapped,
}
}
func (e ServiceError) Error() string {
if e.wrapped != nil {
return fmt.Sprintf("%s: %s", e.msg, e.wrapped.Error())
}
return e.msg
}
func (e ServiceError) Code() ErrorCode {
return e.code
}
// Set the gRPC status to only expose the top error message.
//
// This is to prevent any full error contexts (from wrapped errors) being exposed to users by the gateway.
// e.g. "{"code":2,"message":"something went wrong scanning order: failed to connect to `host=postgres user=postgres database=postgres`: hostname resolving error (lookup postgres on 127.0.0.11:53: server misbehaving)","details":[]}"
func (e ServiceError) GRPCStatus() *status.Status {
return status.New(e.Code().GRPCCode(), e.msg)
}
func (e ServiceError) Unwrap() error {
return e.wrapped
}

View File

@@ -0,0 +1,96 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package gwauth
import (
"context"
"encoding/base64"
"encoding/json"
"google.golang.org/grpc/metadata"
"github.com/hexolan/stocklet/internal/pkg/errors"
)
const JWTPayloadHeader string = "X-JWT-Payload"
type JWTClaims struct {
Subject string `json:"sub"`
IssuedAt int64 `json:"iat"`
Expiry int64 `json:"exp"`
}
func IsGatewayRequest(ctx context.Context) (bool, *metadata.MD) {
// Check the gRPC request has metadata
md, exists := metadata.FromIncomingContext(ctx)
if !exists {
return false, nil
}
if len(md.Get("from-gateway")) != 0 {
return true, &md
}
return false, &md
}
func GetGatewayUser(md *metadata.MD) (*JWTClaims, error) {
// Check a token payload has been passed down
// Envoy validates JWT tokens and provides a "X-JWT-Payload" header (containing base64 JWT token claims)
authorization := md.Get("jwt-payload")
if len(authorization) != 1 {
return nil, errors.NewServiceError(errors.ErrCodeUnauthorised, "invalid jwt")
}
// User is authenticated
// Attempt to decode the jwt-payload
bytes, err := base64.StdEncoding.DecodeString(authorization[0])
if err != nil {
return nil, errors.WrapServiceError(errors.ErrCodeUnauthorised, "malformed jwt", err)
}
var claims JWTClaims
err = json.Unmarshal(bytes, &claims)
if err != nil {
return nil, errors.WrapServiceError(errors.ErrCodeUnauthorised, "malformed jwt", err)
}
return &claims, nil
}
func getTokenPayload(md *metadata.MD) (*JWTClaims, error) {
// Envoy validates JWT tokens and provides a header containing
// valid auth token claims in base64 format.
authorization := md.Get("jwt-payload")
if len(authorization) != 1 {
return nil, errors.NewServiceError(errors.ErrCodeUnauthorised, "auth token not provided")
}
// User is authenticated
// Attempt to decode the jwt-payload
bytes, err := base64.StdEncoding.DecodeString(authorization[0])
if err != nil {
return nil, errors.WrapServiceError(errors.ErrCodeUnauthorised, "malformed jwt", err)
}
var claims JWTClaims
err = json.Unmarshal(bytes, &claims)
if err != nil {
return nil, errors.WrapServiceError(errors.ErrCodeUnauthorised, "malformed jwt", err)
}
return &claims, nil
}

View File

@@ -0,0 +1,48 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package messaging
import (
"context"
"github.com/twmb/franz-go/pkg/kadm"
"github.com/twmb/franz-go/pkg/kgo"
"github.com/hexolan/stocklet/internal/pkg/config"
"github.com/hexolan/stocklet/internal/pkg/errors"
)
func NewKafkaConn(conf *config.KafkaConfig, opts ...kgo.Opt) (*kgo.Client, error) {
opts = append(opts, kgo.SeedBrokers(conf.Brokers...))
cl, err := kgo.NewClient(opts...)
if err != nil {
return nil, errors.WrapServiceError(errors.ErrCodeExtService, "failed to connect to Kafka", err)
}
return cl, nil
}
func EnsureKafkaTopics(cl *kgo.Client, topics ...string) error {
ctx := context.Background()
kadmCl := kadm.NewClient(cl)
_, err := kadmCl.CreateTopics(ctx, -1, -1, nil, topics...)
if err != nil {
return errors.WrapServiceError(errors.ErrCodeExtService, "failed to create Kafka topics", err)
}
return nil
}

View File

@@ -0,0 +1,93 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package messaging
import (
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
)
type ConsumerController interface {
Start()
Stop()
}
// Topic Definitions
const (
// Order Topics
Order_State_Topic = "order.state"
Order_State_Created_Topic = Order_State_Topic + ".created"
Order_State_Pending_Topic = Order_State_Topic + ".pending"
Order_State_Rejected_Topic = Order_State_Topic + ".rejected"
Order_State_Approved_Topic = Order_State_Topic + ".approved"
// Payment Topics
Payment_Balance_Topic = "payment.balance"
Payment_Balance_Created_Topic = Payment_Balance_Topic + ".created"
Payment_Balance_Credited_Topic = Payment_Balance_Topic + ".credited"
Payment_Balance_Debited_Topic = Payment_Balance_Topic + ".debited"
Payment_Balance_Closed_Topic = Payment_Balance_Topic + ".closed"
Payment_Transaction_Topic = "payment.transaction"
Payment_Transaction_Created_Topic = Payment_Transaction_Topic + ".created"
Payment_Transaction_Reversed_Topic = Payment_Transaction_Topic + ".reversed"
Payment_Processing_Topic = "payment.processing"
// Product Topics
Product_State_Topic = "product.state"
Product_State_Created_Topic = Product_State_Topic + ".created"
Product_State_Deleted_Topic = Product_State_Topic + ".deleted"
Product_Attribute_Topic = "product.attr"
Product_Attribute_Price_Topic = Product_Attribute_Topic + ".price"
Product_PriceQuotation_Topic = "product.pricequotation"
// Shipping Topics
Shipping_Shipment_Topic = "shipping.shipment"
Shipping_Shipment_Allocation_Topic = Shipping_Shipment_Topic + ".allocation"
Shipping_Shipment_Dispatched_Topic = Shipping_Shipment_Topic + ".dispatched"
// User Topics
User_State_Topic = "user.state"
User_State_Created_Topic = User_State_Topic + ".created"
User_State_Deleted_Topic = User_State_Topic + ".deleted"
User_Attribute_Topic = "user.attr"
User_Attribute_Email_Topic = User_Attribute_Topic + ".email"
// Warehouse Topics
Warehouse_Stock_Topic = "warehouse.stock"
Warehouse_Stock_Created_Topic = Warehouse_Stock_Topic + ".created"
Warehouse_Stock_Added_Topic = Warehouse_Stock_Topic + ".added"
Warehouse_Stock_Removed_Topic = Warehouse_Stock_Topic + ".removed"
Warehouse_Reservation_Topic = "warehouse.reservation"
Warehouse_Reservation_Failed_Topic = Warehouse_Reservation_Topic + ".failed"
Warehouse_Reservation_Reserved_Topic = Warehouse_Reservation_Topic + ".reserved"
Warehouse_Reservation_Returned_Topic = Warehouse_Reservation_Topic + ".returned"
Warehouse_Reservation_Consumed_Topic = Warehouse_Reservation_Topic + ".consumed"
)
func MarshalEvent(event protoreflect.ProtoMessage, topic string) ([]byte, string, error) {
wireEvent, err := proto.Marshal(event)
if err != nil {
return []byte{}, "", err
}
return wireEvent, topic, nil
}

View File

@@ -0,0 +1,24 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package metrics
import (
"github.com/rs/zerolog"
)
func ConfigureLogger() {
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
}

View File

@@ -0,0 +1,82 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package metrics
import (
"context"
"github.com/rs/zerolog/log"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
"go.opentelemetry.io/otel/propagation"
sdkresource "go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
"github.com/hexolan/stocklet/internal/pkg/config"
)
// Initiate the OpenTelemetry tracer provider
func InitTracerProvider(cfg *config.OtelConfig, svcName string) *sdktrace.TracerProvider {
// Create resource and trace exporter (to otel-collector)
resource := initTracerResource(svcName)
exporter := initTracerExporter(cfg.CollectorGrpc)
// Create the trace provider
tp := sdktrace.NewTracerProvider(
sdktrace.WithBatcher(exporter),
sdktrace.WithResource(resource),
)
otel.SetTracerProvider(tp)
otel.SetTextMapPropagator(propagation.TraceContext{})
return tp
}
// Establishes a connection to otel-collector over gRPC
func initTracerExporter(collectorEndpoint string) sdktrace.SpanExporter {
ctx := context.Background()
exporter, err := otlptracegrpc.New(
ctx,
otlptracegrpc.WithEndpoint(collectorEndpoint),
otlptracegrpc.WithInsecure(),
)
if err != nil {
log.Panic().Err(err).Msg("otel: failed to start otlp gRPC exporter")
}
return exporter
}
// Prepare a tracer resource to use with the tracing provider
func initTracerResource(svcName string) *sdkresource.Resource {
ctx := context.Background()
resource, err := sdkresource.New(
ctx,
sdkresource.WithAttributes(
semconv.ServiceName(svcName),
),
)
if err != nil {
log.Panic().Err(err).Msg("otel: failed to create tracer resource")
}
return resource
}

View File

@@ -0,0 +1,579 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/auth/v1/service.proto
package auth_v1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
v11 "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1"
_ "google.golang.org/genproto/googleapis/api/annotations"
_ "google.golang.org/genproto/googleapis/api/visibility"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type GetJwksRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *GetJwksRequest) Reset() {
*x = GetJwksRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_auth_v1_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetJwksRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetJwksRequest) ProtoMessage() {}
func (x *GetJwksRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_auth_v1_service_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetJwksRequest.ProtoReflect.Descriptor instead.
func (*GetJwksRequest) Descriptor() ([]byte, []int) {
return file_stocklet_auth_v1_service_proto_rawDescGZIP(), []int{0}
}
type GetJwksResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Keys []*PublicEcJWK `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"`
}
func (x *GetJwksResponse) Reset() {
*x = GetJwksResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_auth_v1_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetJwksResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetJwksResponse) ProtoMessage() {}
func (x *GetJwksResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_auth_v1_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetJwksResponse.ProtoReflect.Descriptor instead.
func (*GetJwksResponse) Descriptor() ([]byte, []int) {
return file_stocklet_auth_v1_service_proto_rawDescGZIP(), []int{1}
}
func (x *GetJwksResponse) GetKeys() []*PublicEcJWK {
if x != nil {
return x.Keys
}
return nil
}
type LoginPasswordRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
}
func (x *LoginPasswordRequest) Reset() {
*x = LoginPasswordRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_auth_v1_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LoginPasswordRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LoginPasswordRequest) ProtoMessage() {}
func (x *LoginPasswordRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_auth_v1_service_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LoginPasswordRequest.ProtoReflect.Descriptor instead.
func (*LoginPasswordRequest) Descriptor() ([]byte, []int) {
return file_stocklet_auth_v1_service_proto_rawDescGZIP(), []int{2}
}
func (x *LoginPasswordRequest) GetUserId() string {
if x != nil {
return x.UserId
}
return ""
}
func (x *LoginPasswordRequest) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
type LoginPasswordResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Detail string `protobuf:"bytes,1,opt,name=detail,proto3" json:"detail,omitempty"`
Data *AuthToken `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
}
func (x *LoginPasswordResponse) Reset() {
*x = LoginPasswordResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_auth_v1_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LoginPasswordResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LoginPasswordResponse) ProtoMessage() {}
func (x *LoginPasswordResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_auth_v1_service_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LoginPasswordResponse.ProtoReflect.Descriptor instead.
func (*LoginPasswordResponse) Descriptor() ([]byte, []int) {
return file_stocklet_auth_v1_service_proto_rawDescGZIP(), []int{3}
}
func (x *LoginPasswordResponse) GetDetail() string {
if x != nil {
return x.Detail
}
return ""
}
func (x *LoginPasswordResponse) GetData() *AuthToken {
if x != nil {
return x.Data
}
return nil
}
type SetPasswordRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
}
func (x *SetPasswordRequest) Reset() {
*x = SetPasswordRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_auth_v1_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SetPasswordRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SetPasswordRequest) ProtoMessage() {}
func (x *SetPasswordRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_auth_v1_service_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SetPasswordRequest.ProtoReflect.Descriptor instead.
func (*SetPasswordRequest) Descriptor() ([]byte, []int) {
return file_stocklet_auth_v1_service_proto_rawDescGZIP(), []int{4}
}
func (x *SetPasswordRequest) GetUserId() string {
if x != nil {
return x.UserId
}
return ""
}
func (x *SetPasswordRequest) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
type SetPasswordResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Detail string `protobuf:"bytes,1,opt,name=detail,proto3" json:"detail,omitempty"`
}
func (x *SetPasswordResponse) Reset() {
*x = SetPasswordResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_auth_v1_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SetPasswordResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SetPasswordResponse) ProtoMessage() {}
func (x *SetPasswordResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_auth_v1_service_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SetPasswordResponse.ProtoReflect.Descriptor instead.
func (*SetPasswordResponse) Descriptor() ([]byte, []int) {
return file_stocklet_auth_v1_service_proto_rawDescGZIP(), []int{5}
}
func (x *SetPasswordResponse) GetDetail() string {
if x != nil {
return x.Detail
}
return ""
}
var File_stocklet_auth_v1_service_proto protoreflect.FileDescriptor
var file_stocklet_auth_v1_service_proto_rawDesc = []byte{
0x0a, 0x1e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f,
0x76, 0x31, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x10, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e,
0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65,
0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f,
0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f,
0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x69, 0x73, 0x69, 0x62,
0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70,
0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c,
0x65, 0x74, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74,
0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73,
0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x10, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4a,
0x77, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x44, 0x0a, 0x0f, 0x47, 0x65,
0x74, 0x4a, 0x77, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a,
0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x74,
0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x50,
0x75, 0x62, 0x6c, 0x69, 0x63, 0x45, 0x63, 0x4a, 0x57, 0x4b, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73,
0x22, 0x65, 0x0a, 0x14, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72,
0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72,
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xe0, 0x41, 0x02, 0xba, 0x48,
0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x28, 0x0a,
0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42,
0x0c, 0xe0, 0x41, 0x02, 0xba, 0x48, 0x06, 0x72, 0x04, 0x10, 0x01, 0x18, 0x40, 0x52, 0x08, 0x70,
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x60, 0x0a, 0x15, 0x4c, 0x6f, 0x67, 0x69, 0x6e,
0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x2f, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65,
0x74, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f,
0x6b, 0x65, 0x6e, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x63, 0x0a, 0x12, 0x53, 0x65, 0x74,
0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x23, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x42, 0x0a, 0xe0, 0x41, 0x02, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x75, 0x73,
0x65, 0x72, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0c, 0xe0, 0x41, 0x02, 0xba, 0x48, 0x06, 0x72, 0x04,
0x10, 0x01, 0x18, 0x40, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x2d,
0x0a, 0x13, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x32, 0xd0, 0x04,
0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x78, 0x0a,
0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x73,
0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76,
0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e,
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82,
0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f,
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x65, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4a, 0x77,
0x6b, 0x73, 0x12, 0x20, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x61, 0x75,
0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4a, 0x77, 0x6b, 0x73, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e,
0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4a, 0x77, 0x6b, 0x73, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12,
0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x6a, 0x77, 0x6b, 0x73, 0x12, 0x7b,
0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12,
0x26, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e,
0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c,
0x65, 0x74, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e,
0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31,
0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x78, 0x0a, 0x0b, 0x53,
0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x24, 0x2e, 0x73, 0x74, 0x6f,
0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65,
0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x25, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x61, 0x75, 0x74, 0x68,
0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a,
0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x70, 0x61, 0x73,
0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x69, 0x0a, 0x17, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73,
0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74,
0x12, 0x24, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e,
0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x10,
0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c,
0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68,
0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f,
0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x75,
0x74, 0x68, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_auth_v1_service_proto_rawDescOnce sync.Once
file_stocklet_auth_v1_service_proto_rawDescData = file_stocklet_auth_v1_service_proto_rawDesc
)
func file_stocklet_auth_v1_service_proto_rawDescGZIP() []byte {
file_stocklet_auth_v1_service_proto_rawDescOnce.Do(func() {
file_stocklet_auth_v1_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_auth_v1_service_proto_rawDescData)
})
return file_stocklet_auth_v1_service_proto_rawDescData
}
var file_stocklet_auth_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_stocklet_auth_v1_service_proto_goTypes = []interface{}{
(*GetJwksRequest)(nil), // 0: stocklet.auth.v1.GetJwksRequest
(*GetJwksResponse)(nil), // 1: stocklet.auth.v1.GetJwksResponse
(*LoginPasswordRequest)(nil), // 2: stocklet.auth.v1.LoginPasswordRequest
(*LoginPasswordResponse)(nil), // 3: stocklet.auth.v1.LoginPasswordResponse
(*SetPasswordRequest)(nil), // 4: stocklet.auth.v1.SetPasswordRequest
(*SetPasswordResponse)(nil), // 5: stocklet.auth.v1.SetPasswordResponse
(*PublicEcJWK)(nil), // 6: stocklet.auth.v1.PublicEcJWK
(*AuthToken)(nil), // 7: stocklet.auth.v1.AuthToken
(*v1.ServiceInfoRequest)(nil), // 8: stocklet.common.v1.ServiceInfoRequest
(*v11.UserDeletedEvent)(nil), // 9: stocklet.events.v1.UserDeletedEvent
(*v1.ServiceInfoResponse)(nil), // 10: stocklet.common.v1.ServiceInfoResponse
(*emptypb.Empty)(nil), // 11: google.protobuf.Empty
}
var file_stocklet_auth_v1_service_proto_depIdxs = []int32{
6, // 0: stocklet.auth.v1.GetJwksResponse.keys:type_name -> stocklet.auth.v1.PublicEcJWK
7, // 1: stocklet.auth.v1.LoginPasswordResponse.data:type_name -> stocklet.auth.v1.AuthToken
8, // 2: stocklet.auth.v1.AuthService.ServiceInfo:input_type -> stocklet.common.v1.ServiceInfoRequest
0, // 3: stocklet.auth.v1.AuthService.GetJwks:input_type -> stocklet.auth.v1.GetJwksRequest
2, // 4: stocklet.auth.v1.AuthService.LoginPassword:input_type -> stocklet.auth.v1.LoginPasswordRequest
4, // 5: stocklet.auth.v1.AuthService.SetPassword:input_type -> stocklet.auth.v1.SetPasswordRequest
9, // 6: stocklet.auth.v1.AuthService.ProcessUserDeletedEvent:input_type -> stocklet.events.v1.UserDeletedEvent
10, // 7: stocklet.auth.v1.AuthService.ServiceInfo:output_type -> stocklet.common.v1.ServiceInfoResponse
1, // 8: stocklet.auth.v1.AuthService.GetJwks:output_type -> stocklet.auth.v1.GetJwksResponse
3, // 9: stocklet.auth.v1.AuthService.LoginPassword:output_type -> stocklet.auth.v1.LoginPasswordResponse
5, // 10: stocklet.auth.v1.AuthService.SetPassword:output_type -> stocklet.auth.v1.SetPasswordResponse
11, // 11: stocklet.auth.v1.AuthService.ProcessUserDeletedEvent:output_type -> google.protobuf.Empty
7, // [7:12] is the sub-list for method output_type
2, // [2:7] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_stocklet_auth_v1_service_proto_init() }
func file_stocklet_auth_v1_service_proto_init() {
if File_stocklet_auth_v1_service_proto != nil {
return
}
file_stocklet_auth_v1_types_proto_init()
if !protoimpl.UnsafeEnabled {
file_stocklet_auth_v1_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetJwksRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_auth_v1_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetJwksResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_auth_v1_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LoginPasswordRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_auth_v1_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LoginPasswordResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_auth_v1_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SetPasswordRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_auth_v1_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SetPasswordResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_auth_v1_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_stocklet_auth_v1_service_proto_goTypes,
DependencyIndexes: file_stocklet_auth_v1_service_proto_depIdxs,
MessageInfos: file_stocklet_auth_v1_service_proto_msgTypes,
}.Build()
File_stocklet_auth_v1_service_proto = out.File
file_stocklet_auth_v1_service_proto_rawDesc = nil
file_stocklet_auth_v1_service_proto_goTypes = nil
file_stocklet_auth_v1_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,395 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: stocklet/auth/v1/service.proto
/*
Package auth_v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package auth_v1
import (
"context"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = metadata.Join
func request_AuthService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := client.ServiceInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_AuthService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := server.ServiceInfo(ctx, &protoReq)
return msg, metadata, err
}
func request_AuthService_GetJwks_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetJwksRequest
var metadata runtime.ServerMetadata
msg, err := client.GetJwks(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_AuthService_GetJwks_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetJwksRequest
var metadata runtime.ServerMetadata
msg, err := server.GetJwks(ctx, &protoReq)
return msg, metadata, err
}
func request_AuthService_LoginPassword_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq LoginPasswordRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.LoginPassword(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_AuthService_LoginPassword_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq LoginPasswordRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.LoginPassword(ctx, &protoReq)
return msg, metadata, err
}
func request_AuthService_SetPassword_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq SetPasswordRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.SetPassword(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_AuthService_SetPassword_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq SetPasswordRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.SetPassword(ctx, &protoReq)
return msg, metadata, err
}
// RegisterAuthServiceHandlerServer registers the http handlers for service AuthService to "mux".
// UnaryRPC :call AuthServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAuthServiceHandlerFromEndpoint instead.
func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServiceServer) error {
mux.Handle("GET", pattern_AuthService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.auth.v1.AuthService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/auth/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_AuthService_ServiceInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_AuthService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_AuthService_GetJwks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.auth.v1.AuthService/GetJwks", runtime.WithHTTPPathPattern("/v1/auth/jwks"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_AuthService_GetJwks_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_AuthService_GetJwks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_AuthService_LoginPassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.auth.v1.AuthService/LoginPassword", runtime.WithHTTPPathPattern("/v1/auth/login"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_AuthService_LoginPassword_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_AuthService_LoginPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_AuthService_SetPassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.auth.v1.AuthService/SetPassword", runtime.WithHTTPPathPattern("/v1/auth/password"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_AuthService_SetPassword_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_AuthService_SetPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterAuthServiceHandlerFromEndpoint is same as RegisterAuthServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterAuthServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.DialContext(ctx, endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterAuthServiceHandler(ctx, mux, conn)
}
// RegisterAuthServiceHandler registers the http handlers for service AuthService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterAuthServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterAuthServiceHandlerClient(ctx, mux, NewAuthServiceClient(conn))
}
// RegisterAuthServiceHandlerClient registers the http handlers for service AuthService
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AuthServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AuthServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "AuthServiceClient" to call the correct interceptors.
func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthServiceClient) error {
mux.Handle("GET", pattern_AuthService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.auth.v1.AuthService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/auth/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_AuthService_ServiceInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_AuthService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_AuthService_GetJwks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.auth.v1.AuthService/GetJwks", runtime.WithHTTPPathPattern("/v1/auth/jwks"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_AuthService_GetJwks_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_AuthService_GetJwks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_AuthService_LoginPassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.auth.v1.AuthService/LoginPassword", runtime.WithHTTPPathPattern("/v1/auth/login"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_AuthService_LoginPassword_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_AuthService_LoginPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_AuthService_SetPassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.auth.v1.AuthService/SetPassword", runtime.WithHTTPPathPattern("/v1/auth/password"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_AuthService_SetPassword_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_AuthService_SetPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_AuthService_ServiceInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "service"}, ""))
pattern_AuthService_GetJwks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "jwks"}, ""))
pattern_AuthService_LoginPassword_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "login"}, ""))
pattern_AuthService_SetPassword_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "password"}, ""))
)
var (
forward_AuthService_ServiceInfo_0 = runtime.ForwardResponseMessage
forward_AuthService_GetJwks_0 = runtime.ForwardResponseMessage
forward_AuthService_LoginPassword_0 = runtime.ForwardResponseMessage
forward_AuthService_SetPassword_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,291 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: stocklet/auth/v1/service.proto
package auth_v1
import (
context "context"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
v11 "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
AuthService_ServiceInfo_FullMethodName = "/stocklet.auth.v1.AuthService/ServiceInfo"
AuthService_GetJwks_FullMethodName = "/stocklet.auth.v1.AuthService/GetJwks"
AuthService_LoginPassword_FullMethodName = "/stocklet.auth.v1.AuthService/LoginPassword"
AuthService_SetPassword_FullMethodName = "/stocklet.auth.v1.AuthService/SetPassword"
AuthService_ProcessUserDeletedEvent_FullMethodName = "/stocklet.auth.v1.AuthService/ProcessUserDeletedEvent"
)
// AuthServiceClient is the client API for AuthService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type AuthServiceClient interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error)
GetJwks(ctx context.Context, in *GetJwksRequest, opts ...grpc.CallOption) (*GetJwksResponse, error)
LoginPassword(ctx context.Context, in *LoginPasswordRequest, opts ...grpc.CallOption) (*LoginPasswordResponse, error)
SetPassword(ctx context.Context, in *SetPasswordRequest, opts ...grpc.CallOption) (*SetPasswordResponse, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessUserDeletedEvent(ctx context.Context, in *v11.UserDeletedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type authServiceClient struct {
cc grpc.ClientConnInterface
}
func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient {
return &authServiceClient{cc}
}
func (c *authServiceClient) ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error) {
out := new(v1.ServiceInfoResponse)
err := c.cc.Invoke(ctx, AuthService_ServiceInfo_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authServiceClient) GetJwks(ctx context.Context, in *GetJwksRequest, opts ...grpc.CallOption) (*GetJwksResponse, error) {
out := new(GetJwksResponse)
err := c.cc.Invoke(ctx, AuthService_GetJwks_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authServiceClient) LoginPassword(ctx context.Context, in *LoginPasswordRequest, opts ...grpc.CallOption) (*LoginPasswordResponse, error) {
out := new(LoginPasswordResponse)
err := c.cc.Invoke(ctx, AuthService_LoginPassword_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authServiceClient) SetPassword(ctx context.Context, in *SetPasswordRequest, opts ...grpc.CallOption) (*SetPasswordResponse, error) {
out := new(SetPasswordResponse)
err := c.cc.Invoke(ctx, AuthService_SetPassword_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authServiceClient) ProcessUserDeletedEvent(ctx context.Context, in *v11.UserDeletedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, AuthService_ProcessUserDeletedEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// AuthServiceServer is the server API for AuthService service.
// All implementations must embed UnimplementedAuthServiceServer
// for forward compatibility
type AuthServiceServer interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error)
GetJwks(context.Context, *GetJwksRequest) (*GetJwksResponse, error)
LoginPassword(context.Context, *LoginPasswordRequest) (*LoginPasswordResponse, error)
SetPassword(context.Context, *SetPasswordRequest) (*SetPasswordResponse, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessUserDeletedEvent(context.Context, *v11.UserDeletedEvent) (*emptypb.Empty, error)
mustEmbedUnimplementedAuthServiceServer()
}
// UnimplementedAuthServiceServer must be embedded to have forward compatible implementations.
type UnimplementedAuthServiceServer struct {
}
func (UnimplementedAuthServiceServer) ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ServiceInfo not implemented")
}
func (UnimplementedAuthServiceServer) GetJwks(context.Context, *GetJwksRequest) (*GetJwksResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetJwks not implemented")
}
func (UnimplementedAuthServiceServer) LoginPassword(context.Context, *LoginPasswordRequest) (*LoginPasswordResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LoginPassword not implemented")
}
func (UnimplementedAuthServiceServer) SetPassword(context.Context, *SetPasswordRequest) (*SetPasswordResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetPassword not implemented")
}
func (UnimplementedAuthServiceServer) ProcessUserDeletedEvent(context.Context, *v11.UserDeletedEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessUserDeletedEvent not implemented")
}
func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {}
// UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AuthServiceServer will
// result in compilation errors.
type UnsafeAuthServiceServer interface {
mustEmbedUnimplementedAuthServiceServer()
}
func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) {
s.RegisterService(&AuthService_ServiceDesc, srv)
}
func _AuthService_ServiceInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v1.ServiceInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServiceServer).ServiceInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AuthService_ServiceInfo_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).ServiceInfo(ctx, req.(*v1.ServiceInfoRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AuthService_GetJwks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetJwksRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServiceServer).GetJwks(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AuthService_GetJwks_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).GetJwks(ctx, req.(*GetJwksRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AuthService_LoginPassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginPasswordRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServiceServer).LoginPassword(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AuthService_LoginPassword_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).LoginPassword(ctx, req.(*LoginPasswordRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AuthService_SetPassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetPasswordRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServiceServer).SetPassword(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AuthService_SetPassword_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).SetPassword(ctx, req.(*SetPasswordRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AuthService_ProcessUserDeletedEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.UserDeletedEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServiceServer).ProcessUserDeletedEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AuthService_ProcessUserDeletedEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).ProcessUserDeletedEvent(ctx, req.(*v11.UserDeletedEvent))
}
return interceptor(ctx, in, info, handler)
}
// AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var AuthService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "stocklet.auth.v1.AuthService",
HandlerType: (*AuthServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ServiceInfo",
Handler: _AuthService_ServiceInfo_Handler,
},
{
MethodName: "GetJwks",
Handler: _AuthService_GetJwks_Handler,
},
{
MethodName: "LoginPassword",
Handler: _AuthService_LoginPassword_Handler,
},
{
MethodName: "SetPassword",
Handler: _AuthService_SetPassword_Handler,
},
{
MethodName: "ProcessUserDeletedEvent",
Handler: _AuthService_ProcessUserDeletedEvent_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "stocklet/auth/v1/service.proto",
}

View File

@@ -0,0 +1,289 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/auth/v1/types.proto
package auth_v1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type PublicEcJWK struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Kty string `protobuf:"bytes,1,opt,name=kty,proto3" json:"kty,omitempty"`
Use string `protobuf:"bytes,2,opt,name=use,proto3" json:"use,omitempty"`
Alg string `protobuf:"bytes,3,opt,name=alg,proto3" json:"alg,omitempty"`
Crv string `protobuf:"bytes,4,opt,name=crv,proto3" json:"crv,omitempty"`
X string `protobuf:"bytes,5,opt,name=x,proto3" json:"x,omitempty"`
Y string `protobuf:"bytes,6,opt,name=y,proto3" json:"y,omitempty"`
}
func (x *PublicEcJWK) Reset() {
*x = PublicEcJWK{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_auth_v1_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PublicEcJWK) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PublicEcJWK) ProtoMessage() {}
func (x *PublicEcJWK) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_auth_v1_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PublicEcJWK.ProtoReflect.Descriptor instead.
func (*PublicEcJWK) Descriptor() ([]byte, []int) {
return file_stocklet_auth_v1_types_proto_rawDescGZIP(), []int{0}
}
func (x *PublicEcJWK) GetKty() string {
if x != nil {
return x.Kty
}
return ""
}
func (x *PublicEcJWK) GetUse() string {
if x != nil {
return x.Use
}
return ""
}
func (x *PublicEcJWK) GetAlg() string {
if x != nil {
return x.Alg
}
return ""
}
func (x *PublicEcJWK) GetCrv() string {
if x != nil {
return x.Crv
}
return ""
}
func (x *PublicEcJWK) GetX() string {
if x != nil {
return x.X
}
return ""
}
func (x *PublicEcJWK) GetY() string {
if x != nil {
return x.Y
}
return ""
}
type AuthToken struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TokenType string `protobuf:"bytes,1,opt,name=token_type,json=tokenType,proto3" json:"token_type,omitempty"`
AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
ExpiresIn int64 `protobuf:"varint,3,opt,name=expires_in,json=expiresIn,proto3" json:"expires_in,omitempty"`
}
func (x *AuthToken) Reset() {
*x = AuthToken{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_auth_v1_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AuthToken) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AuthToken) ProtoMessage() {}
func (x *AuthToken) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_auth_v1_types_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AuthToken.ProtoReflect.Descriptor instead.
func (*AuthToken) Descriptor() ([]byte, []int) {
return file_stocklet_auth_v1_types_proto_rawDescGZIP(), []int{1}
}
func (x *AuthToken) GetTokenType() string {
if x != nil {
return x.TokenType
}
return ""
}
func (x *AuthToken) GetAccessToken() string {
if x != nil {
return x.AccessToken
}
return ""
}
func (x *AuthToken) GetExpiresIn() int64 {
if x != nil {
return x.ExpiresIn
}
return 0
}
var File_stocklet_auth_v1_types_proto protoreflect.FileDescriptor
var file_stocklet_auth_v1_types_proto_rawDesc = []byte{
0x0a, 0x1c, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f,
0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31,
0x22, 0x71, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x45, 0x63, 0x4a, 0x57, 0x4b, 0x12,
0x10, 0x0a, 0x03, 0x6b, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x74,
0x79, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x75, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x6c, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x61, 0x6c, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x72, 0x76, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x63, 0x72, 0x76, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x05, 0x20, 0x01,
0x28, 0x09, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,
0x52, 0x01, 0x79, 0x22, 0x6c, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12,
0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b,
0x65, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x5f, 0x69, 0x6e,
0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x49,
0x6e, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74,
0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x3b, 0x61,
0x75, 0x74, 0x68, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_auth_v1_types_proto_rawDescOnce sync.Once
file_stocklet_auth_v1_types_proto_rawDescData = file_stocklet_auth_v1_types_proto_rawDesc
)
func file_stocklet_auth_v1_types_proto_rawDescGZIP() []byte {
file_stocklet_auth_v1_types_proto_rawDescOnce.Do(func() {
file_stocklet_auth_v1_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_auth_v1_types_proto_rawDescData)
})
return file_stocklet_auth_v1_types_proto_rawDescData
}
var file_stocklet_auth_v1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_stocklet_auth_v1_types_proto_goTypes = []interface{}{
(*PublicEcJWK)(nil), // 0: stocklet.auth.v1.PublicEcJWK
(*AuthToken)(nil), // 1: stocklet.auth.v1.AuthToken
}
var file_stocklet_auth_v1_types_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_stocklet_auth_v1_types_proto_init() }
func file_stocklet_auth_v1_types_proto_init() {
if File_stocklet_auth_v1_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_auth_v1_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PublicEcJWK); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_auth_v1_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AuthToken); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_auth_v1_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_auth_v1_types_proto_goTypes,
DependencyIndexes: file_stocklet_auth_v1_types_proto_depIdxs,
MessageInfos: file_stocklet_auth_v1_types_proto_msgTypes,
}.Build()
File_stocklet_auth_v1_types_proto = out.File
file_stocklet_auth_v1_types_proto_rawDesc = nil
file_stocklet_auth_v1_types_proto_goTypes = nil
file_stocklet_auth_v1_types_proto_depIdxs = nil
}

View File

@@ -0,0 +1,235 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/common/v1/requests.proto
package common_v1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ServiceInfoRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ServiceInfoRequest) Reset() {
*x = ServiceInfoRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_common_v1_requests_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ServiceInfoRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ServiceInfoRequest) ProtoMessage() {}
func (x *ServiceInfoRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_common_v1_requests_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ServiceInfoRequest.ProtoReflect.Descriptor instead.
func (*ServiceInfoRequest) Descriptor() ([]byte, []int) {
return file_stocklet_common_v1_requests_proto_rawDescGZIP(), []int{0}
}
type ServiceInfoResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"`
SourceLicense string `protobuf:"bytes,3,opt,name=source_license,json=sourceLicense,proto3" json:"source_license,omitempty"`
}
func (x *ServiceInfoResponse) Reset() {
*x = ServiceInfoResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_common_v1_requests_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ServiceInfoResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ServiceInfoResponse) ProtoMessage() {}
func (x *ServiceInfoResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_common_v1_requests_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ServiceInfoResponse.ProtoReflect.Descriptor instead.
func (*ServiceInfoResponse) Descriptor() ([]byte, []int) {
return file_stocklet_common_v1_requests_proto_rawDescGZIP(), []int{1}
}
func (x *ServiceInfoResponse) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *ServiceInfoResponse) GetSource() string {
if x != nil {
return x.Source
}
return ""
}
func (x *ServiceInfoResponse) GetSourceLicense() string {
if x != nil {
return x.SourceLicense
}
return ""
}
var File_stocklet_common_v1_requests_proto protoreflect.FileDescriptor
var file_stocklet_common_v1_requests_proto_rawDesc = []byte{
0x0a, 0x21, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x12, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x63, 0x6f,
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x22, 0x14, 0x0a, 0x12, 0x53, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x68, 0x0a,
0x13, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x12, 0x25, 0x0a, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6c, 0x69, 0x63, 0x65, 0x6e,
0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x42, 0x47, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74,
0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f,
0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x76, 0x31,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_common_v1_requests_proto_rawDescOnce sync.Once
file_stocklet_common_v1_requests_proto_rawDescData = file_stocklet_common_v1_requests_proto_rawDesc
)
func file_stocklet_common_v1_requests_proto_rawDescGZIP() []byte {
file_stocklet_common_v1_requests_proto_rawDescOnce.Do(func() {
file_stocklet_common_v1_requests_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_common_v1_requests_proto_rawDescData)
})
return file_stocklet_common_v1_requests_proto_rawDescData
}
var file_stocklet_common_v1_requests_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_stocklet_common_v1_requests_proto_goTypes = []interface{}{
(*ServiceInfoRequest)(nil), // 0: stocklet.common.v1.ServiceInfoRequest
(*ServiceInfoResponse)(nil), // 1: stocklet.common.v1.ServiceInfoResponse
}
var file_stocklet_common_v1_requests_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_stocklet_common_v1_requests_proto_init() }
func file_stocklet_common_v1_requests_proto_init() {
if File_stocklet_common_v1_requests_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_common_v1_requests_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServiceInfoRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_common_v1_requests_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ServiceInfoResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_common_v1_requests_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_common_v1_requests_proto_goTypes,
DependencyIndexes: file_stocklet_common_v1_requests_proto_depIdxs,
MessageInfos: file_stocklet_common_v1_requests_proto_msgTypes,
}.Build()
File_stocklet_common_v1_requests_proto = out.File
file_stocklet_common_v1_requests_proto_rawDesc = nil
file_stocklet_common_v1_requests_proto_goTypes = nil
file_stocklet_common_v1_requests_proto_depIdxs = nil
}

View File

@@ -0,0 +1,521 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/events/v1/order.proto
package events_v1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Order Status = processing
type OrderCreatedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
OrderId string `protobuf:"bytes,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
CustomerId string `protobuf:"bytes,3,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
ItemQuantities map[string]int32 `protobuf:"bytes,4,rep,name=item_quantities,json=itemQuantities,proto3" json:"item_quantities,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
}
func (x *OrderCreatedEvent) Reset() {
*x = OrderCreatedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_order_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OrderCreatedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OrderCreatedEvent) ProtoMessage() {}
func (x *OrderCreatedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_order_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OrderCreatedEvent.ProtoReflect.Descriptor instead.
func (*OrderCreatedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_order_proto_rawDescGZIP(), []int{0}
}
func (x *OrderCreatedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *OrderCreatedEvent) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *OrderCreatedEvent) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
func (x *OrderCreatedEvent) GetItemQuantities() map[string]int32 {
if x != nil {
return x.ItemQuantities
}
return nil
}
// Order Status = pending
type OrderPendingEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
OrderId string `protobuf:"bytes,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
CustomerId string `protobuf:"bytes,3,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
ItemQuantities map[string]int32 `protobuf:"bytes,4,rep,name=item_quantities,json=itemQuantities,proto3" json:"item_quantities,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
ItemsPrice float32 `protobuf:"fixed32,5,opt,name=items_price,json=itemsPrice,proto3" json:"items_price,omitempty"`
TotalPrice float32 `protobuf:"fixed32,6,opt,name=total_price,json=totalPrice,proto3" json:"total_price,omitempty"`
}
func (x *OrderPendingEvent) Reset() {
*x = OrderPendingEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_order_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OrderPendingEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OrderPendingEvent) ProtoMessage() {}
func (x *OrderPendingEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_order_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OrderPendingEvent.ProtoReflect.Descriptor instead.
func (*OrderPendingEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_order_proto_rawDescGZIP(), []int{1}
}
func (x *OrderPendingEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *OrderPendingEvent) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *OrderPendingEvent) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
func (x *OrderPendingEvent) GetItemQuantities() map[string]int32 {
if x != nil {
return x.ItemQuantities
}
return nil
}
func (x *OrderPendingEvent) GetItemsPrice() float32 {
if x != nil {
return x.ItemsPrice
}
return 0
}
func (x *OrderPendingEvent) GetTotalPrice() float32 {
if x != nil {
return x.TotalPrice
}
return 0
}
// Order Status = rejected
type OrderRejectedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
OrderId string `protobuf:"bytes,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
TransactionId *string `protobuf:"bytes,3,opt,name=transaction_id,json=transactionId,proto3,oneof" json:"transaction_id,omitempty"`
ShippingId *string `protobuf:"bytes,4,opt,name=shipping_id,json=shippingId,proto3,oneof" json:"shipping_id,omitempty"`
}
func (x *OrderRejectedEvent) Reset() {
*x = OrderRejectedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_order_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OrderRejectedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OrderRejectedEvent) ProtoMessage() {}
func (x *OrderRejectedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_order_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OrderRejectedEvent.ProtoReflect.Descriptor instead.
func (*OrderRejectedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_order_proto_rawDescGZIP(), []int{2}
}
func (x *OrderRejectedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *OrderRejectedEvent) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *OrderRejectedEvent) GetTransactionId() string {
if x != nil && x.TransactionId != nil {
return *x.TransactionId
}
return ""
}
func (x *OrderRejectedEvent) GetShippingId() string {
if x != nil && x.ShippingId != nil {
return *x.ShippingId
}
return ""
}
// Order Status = approved
type OrderApprovedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
OrderId string `protobuf:"bytes,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
TransactionId string `protobuf:"bytes,3,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"`
ShippingId string `protobuf:"bytes,4,opt,name=shipping_id,json=shippingId,proto3" json:"shipping_id,omitempty"`
}
func (x *OrderApprovedEvent) Reset() {
*x = OrderApprovedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_order_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OrderApprovedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OrderApprovedEvent) ProtoMessage() {}
func (x *OrderApprovedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_order_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OrderApprovedEvent.ProtoReflect.Descriptor instead.
func (*OrderApprovedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_order_proto_rawDescGZIP(), []int{3}
}
func (x *OrderApprovedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *OrderApprovedEvent) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *OrderApprovedEvent) GetTransactionId() string {
if x != nil {
return x.TransactionId
}
return ""
}
func (x *OrderApprovedEvent) GetShippingId() string {
if x != nil {
return x.ShippingId
}
return ""
}
var File_stocklet_events_v1_order_proto protoreflect.FileDescriptor
var file_stocklet_events_v1_order_proto_rawDesc = []byte{
0x0a, 0x1e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x12, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x2e, 0x76, 0x31, 0x22, 0x92, 0x02, 0x0a, 0x11, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x72,
0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65,
0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65,
0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f,
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49,
0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72,
0x49, 0x64, 0x12, 0x62, 0x0a, 0x0f, 0x69, 0x74, 0x65, 0x6d, 0x5f, 0x71, 0x75, 0x61, 0x6e, 0x74,
0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x73, 0x74,
0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31,
0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65,
0x6e, 0x74, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65,
0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x69, 0x74, 0x65, 0x6d, 0x51, 0x75, 0x61, 0x6e,
0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x41, 0x0a, 0x13, 0x49, 0x74, 0x65, 0x6d, 0x51, 0x75,
0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd4, 0x02, 0x0a, 0x11, 0x4f, 0x72,
0x64, 0x65, 0x72, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12,
0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x6f,
0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f,
0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d,
0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x75, 0x73,
0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x12, 0x62, 0x0a, 0x0f, 0x69, 0x74, 0x65, 0x6d, 0x5f,
0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x39, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e,
0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x50, 0x65, 0x6e, 0x64, 0x69,
0x6e, 0x67, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x51, 0x75, 0x61, 0x6e,
0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x69, 0x74, 0x65,
0x6d, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69,
0x74, 0x65, 0x6d, 0x73, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x02,
0x52, 0x0a, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b,
0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28,
0x02, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x1a, 0x41, 0x0a,
0x13, 0x49, 0x74, 0x65, 0x6d, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
0x22, 0xc0, 0x01, 0x0a, 0x12, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74,
0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73,
0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73,
0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2a,
0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x24, 0x0a, 0x0b, 0x73, 0x68,
0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48,
0x01, 0x52, 0x0a, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x88, 0x01, 0x01,
0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x5f, 0x69, 0x64, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67,
0x5f, 0x69, 0x64, 0x22, 0x93, 0x01, 0x0a, 0x12, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x41, 0x70, 0x70,
0x72, 0x6f, 0x76, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65,
0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65,
0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f,
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49,
0x64, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73,
0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x68, 0x69, 0x70,
0x70, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73,
0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x42, 0x47, 0x5a, 0x45, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,
0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65,
0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x5f,
0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_events_v1_order_proto_rawDescOnce sync.Once
file_stocklet_events_v1_order_proto_rawDescData = file_stocklet_events_v1_order_proto_rawDesc
)
func file_stocklet_events_v1_order_proto_rawDescGZIP() []byte {
file_stocklet_events_v1_order_proto_rawDescOnce.Do(func() {
file_stocklet_events_v1_order_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_events_v1_order_proto_rawDescData)
})
return file_stocklet_events_v1_order_proto_rawDescData
}
var file_stocklet_events_v1_order_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_stocklet_events_v1_order_proto_goTypes = []interface{}{
(*OrderCreatedEvent)(nil), // 0: stocklet.events.v1.OrderCreatedEvent
(*OrderPendingEvent)(nil), // 1: stocklet.events.v1.OrderPendingEvent
(*OrderRejectedEvent)(nil), // 2: stocklet.events.v1.OrderRejectedEvent
(*OrderApprovedEvent)(nil), // 3: stocklet.events.v1.OrderApprovedEvent
nil, // 4: stocklet.events.v1.OrderCreatedEvent.ItemQuantitiesEntry
nil, // 5: stocklet.events.v1.OrderPendingEvent.ItemQuantitiesEntry
}
var file_stocklet_events_v1_order_proto_depIdxs = []int32{
4, // 0: stocklet.events.v1.OrderCreatedEvent.item_quantities:type_name -> stocklet.events.v1.OrderCreatedEvent.ItemQuantitiesEntry
5, // 1: stocklet.events.v1.OrderPendingEvent.item_quantities:type_name -> stocklet.events.v1.OrderPendingEvent.ItemQuantitiesEntry
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_stocklet_events_v1_order_proto_init() }
func file_stocklet_events_v1_order_proto_init() {
if File_stocklet_events_v1_order_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_events_v1_order_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OrderCreatedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_order_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OrderPendingEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_order_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OrderRejectedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_order_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OrderApprovedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_stocklet_events_v1_order_proto_msgTypes[2].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_events_v1_order_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_events_v1_order_proto_goTypes,
DependencyIndexes: file_stocklet_events_v1_order_proto_depIdxs,
MessageInfos: file_stocklet_events_v1_order_proto_msgTypes,
}.Build()
File_stocklet_events_v1_order_proto = out.File
file_stocklet_events_v1_order_proto_rawDesc = nil
file_stocklet_events_v1_order_proto_goTypes = nil
file_stocklet_events_v1_order_proto_depIdxs = nil
}

View File

@@ -0,0 +1,833 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/events/v1/payment.proto
package events_v1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type PaymentProcessedEvent_Type int32
const (
PaymentProcessedEvent_TYPE_UNSPECIFIED PaymentProcessedEvent_Type = 0
PaymentProcessedEvent_TYPE_FAILED PaymentProcessedEvent_Type = 1
PaymentProcessedEvent_TYPE_SUCCESS PaymentProcessedEvent_Type = 2
)
// Enum value maps for PaymentProcessedEvent_Type.
var (
PaymentProcessedEvent_Type_name = map[int32]string{
0: "TYPE_UNSPECIFIED",
1: "TYPE_FAILED",
2: "TYPE_SUCCESS",
}
PaymentProcessedEvent_Type_value = map[string]int32{
"TYPE_UNSPECIFIED": 0,
"TYPE_FAILED": 1,
"TYPE_SUCCESS": 2,
}
)
func (x PaymentProcessedEvent_Type) Enum() *PaymentProcessedEvent_Type {
p := new(PaymentProcessedEvent_Type)
*p = x
return p
}
func (x PaymentProcessedEvent_Type) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (PaymentProcessedEvent_Type) Descriptor() protoreflect.EnumDescriptor {
return file_stocklet_events_v1_payment_proto_enumTypes[0].Descriptor()
}
func (PaymentProcessedEvent_Type) Type() protoreflect.EnumType {
return &file_stocklet_events_v1_payment_proto_enumTypes[0]
}
func (x PaymentProcessedEvent_Type) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use PaymentProcessedEvent_Type.Descriptor instead.
func (PaymentProcessedEvent_Type) EnumDescriptor() ([]byte, []int) {
return file_stocklet_events_v1_payment_proto_rawDescGZIP(), []int{6, 0}
}
type BalanceCreatedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
CustomerId string `protobuf:"bytes,2,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
Balance float32 `protobuf:"fixed32,3,opt,name=balance,proto3" json:"balance,omitempty"`
}
func (x *BalanceCreatedEvent) Reset() {
*x = BalanceCreatedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BalanceCreatedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BalanceCreatedEvent) ProtoMessage() {}
func (x *BalanceCreatedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BalanceCreatedEvent.ProtoReflect.Descriptor instead.
func (*BalanceCreatedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_payment_proto_rawDescGZIP(), []int{0}
}
func (x *BalanceCreatedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *BalanceCreatedEvent) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
func (x *BalanceCreatedEvent) GetBalance() float32 {
if x != nil {
return x.Balance
}
return 0
}
type BalanceCreditedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
CustomerId string `protobuf:"bytes,2,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
Amount float32 `protobuf:"fixed32,3,opt,name=amount,proto3" json:"amount,omitempty"`
NewBalance float32 `protobuf:"fixed32,4,opt,name=new_balance,json=newBalance,proto3" json:"new_balance,omitempty"`
}
func (x *BalanceCreditedEvent) Reset() {
*x = BalanceCreditedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BalanceCreditedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BalanceCreditedEvent) ProtoMessage() {}
func (x *BalanceCreditedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BalanceCreditedEvent.ProtoReflect.Descriptor instead.
func (*BalanceCreditedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_payment_proto_rawDescGZIP(), []int{1}
}
func (x *BalanceCreditedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *BalanceCreditedEvent) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
func (x *BalanceCreditedEvent) GetAmount() float32 {
if x != nil {
return x.Amount
}
return 0
}
func (x *BalanceCreditedEvent) GetNewBalance() float32 {
if x != nil {
return x.NewBalance
}
return 0
}
type BalanceDebitedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
CustomerId string `protobuf:"bytes,2,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
Amount float32 `protobuf:"fixed32,3,opt,name=amount,proto3" json:"amount,omitempty"`
NewBalance float32 `protobuf:"fixed32,4,opt,name=new_balance,json=newBalance,proto3" json:"new_balance,omitempty"`
}
func (x *BalanceDebitedEvent) Reset() {
*x = BalanceDebitedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BalanceDebitedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BalanceDebitedEvent) ProtoMessage() {}
func (x *BalanceDebitedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BalanceDebitedEvent.ProtoReflect.Descriptor instead.
func (*BalanceDebitedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_payment_proto_rawDescGZIP(), []int{2}
}
func (x *BalanceDebitedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *BalanceDebitedEvent) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
func (x *BalanceDebitedEvent) GetAmount() float32 {
if x != nil {
return x.Amount
}
return 0
}
func (x *BalanceDebitedEvent) GetNewBalance() float32 {
if x != nil {
return x.NewBalance
}
return 0
}
type BalanceClosedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
CustomerId string `protobuf:"bytes,2,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
Balance float32 `protobuf:"fixed32,3,opt,name=balance,proto3" json:"balance,omitempty"`
}
func (x *BalanceClosedEvent) Reset() {
*x = BalanceClosedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BalanceClosedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BalanceClosedEvent) ProtoMessage() {}
func (x *BalanceClosedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BalanceClosedEvent.ProtoReflect.Descriptor instead.
func (*BalanceClosedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_payment_proto_rawDescGZIP(), []int{3}
}
func (x *BalanceClosedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *BalanceClosedEvent) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
func (x *BalanceClosedEvent) GetBalance() float32 {
if x != nil {
return x.Balance
}
return 0
}
type TransactionLoggedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
TransactionId string `protobuf:"bytes,2,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"`
Amount float32 `protobuf:"fixed32,3,opt,name=amount,proto3" json:"amount,omitempty"`
OrderId string `protobuf:"bytes,4,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
CustomerId string `protobuf:"bytes,5,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
}
func (x *TransactionLoggedEvent) Reset() {
*x = TransactionLoggedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TransactionLoggedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TransactionLoggedEvent) ProtoMessage() {}
func (x *TransactionLoggedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TransactionLoggedEvent.ProtoReflect.Descriptor instead.
func (*TransactionLoggedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_payment_proto_rawDescGZIP(), []int{4}
}
func (x *TransactionLoggedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *TransactionLoggedEvent) GetTransactionId() string {
if x != nil {
return x.TransactionId
}
return ""
}
func (x *TransactionLoggedEvent) GetAmount() float32 {
if x != nil {
return x.Amount
}
return 0
}
func (x *TransactionLoggedEvent) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *TransactionLoggedEvent) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
type TransactionReversedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
TransactionId string `protobuf:"bytes,2,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"`
Amount float32 `protobuf:"fixed32,3,opt,name=amount,proto3" json:"amount,omitempty"`
OrderId string `protobuf:"bytes,4,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
CustomerId string `protobuf:"bytes,5,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
}
func (x *TransactionReversedEvent) Reset() {
*x = TransactionReversedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TransactionReversedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TransactionReversedEvent) ProtoMessage() {}
func (x *TransactionReversedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TransactionReversedEvent.ProtoReflect.Descriptor instead.
func (*TransactionReversedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_payment_proto_rawDescGZIP(), []int{5}
}
func (x *TransactionReversedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *TransactionReversedEvent) GetTransactionId() string {
if x != nil {
return x.TransactionId
}
return ""
}
func (x *TransactionReversedEvent) GetAmount() float32 {
if x != nil {
return x.Amount
}
return 0
}
func (x *TransactionReversedEvent) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *TransactionReversedEvent) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
type PaymentProcessedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
Type PaymentProcessedEvent_Type `protobuf:"varint,2,opt,name=type,proto3,enum=stocklet.events.v1.PaymentProcessedEvent_Type" json:"type,omitempty"`
OrderId string `protobuf:"bytes,3,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
CustomerId string `protobuf:"bytes,4,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
Amount float32 `protobuf:"fixed32,5,opt,name=amount,proto3" json:"amount,omitempty"`
TransactionId *string `protobuf:"bytes,6,opt,name=transaction_id,json=transactionId,proto3,oneof" json:"transaction_id,omitempty"`
}
func (x *PaymentProcessedEvent) Reset() {
*x = PaymentProcessedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PaymentProcessedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PaymentProcessedEvent) ProtoMessage() {}
func (x *PaymentProcessedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_payment_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PaymentProcessedEvent.ProtoReflect.Descriptor instead.
func (*PaymentProcessedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_payment_proto_rawDescGZIP(), []int{6}
}
func (x *PaymentProcessedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *PaymentProcessedEvent) GetType() PaymentProcessedEvent_Type {
if x != nil {
return x.Type
}
return PaymentProcessedEvent_TYPE_UNSPECIFIED
}
func (x *PaymentProcessedEvent) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *PaymentProcessedEvent) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
func (x *PaymentProcessedEvent) GetAmount() float32 {
if x != nil {
return x.Amount
}
return 0
}
func (x *PaymentProcessedEvent) GetTransactionId() string {
if x != nil && x.TransactionId != nil {
return *x.TransactionId
}
return ""
}
var File_stocklet_events_v1_payment_proto protoreflect.FileDescriptor
var file_stocklet_events_v1_payment_proto_rawDesc = []byte{
0x0a, 0x20, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x12, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65,
0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x22, 0x6c, 0x0a, 0x13, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63,
0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a,
0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x75, 0x73,
0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61,
0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x07, 0x62, 0x61, 0x6c,
0x61, 0x6e, 0x63, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x14, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65,
0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a,
0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x75, 0x73,
0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d,
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75,
0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x65, 0x77, 0x5f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63,
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x6e, 0x65, 0x77, 0x42, 0x61, 0x6c, 0x61,
0x6e, 0x63, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x13, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x44,
0x65, 0x62, 0x69, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72,
0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72,
0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f,
0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x75,
0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75,
0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x65, 0x77, 0x5f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18,
0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x6e, 0x65, 0x77, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63,
0x65, 0x22, 0x6b, 0x0a, 0x12, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6c, 0x6f, 0x73,
0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73,
0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73,
0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f,
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d,
0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18,
0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x22, 0xaf,
0x01, 0x0a, 0x16, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x6f,
0x67, 0x67, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76,
0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x76,
0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74,
0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06,
0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x06, 0x61, 0x6d,
0x6f, 0x75, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64,
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12,
0x1f, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x05,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64,
0x22, 0xb1, 0x01, 0x0a, 0x18, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a,
0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61,
0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64,
0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02,
0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65,
0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65,
0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f,
0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d,
0x65, 0x72, 0x49, 0x64, 0x22, 0xcb, 0x02, 0x0a, 0x15, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74,
0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a,
0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, 0x04, 0x74, 0x79,
0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61,
0x79, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x45, 0x76,
0x65, 0x6e, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19,
0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x75, 0x73,
0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d,
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x02, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75,
0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0d, 0x74, 0x72,
0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x88, 0x01, 0x01, 0x22, 0x3f,
0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55,
0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b,
0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12, 0x10, 0x0a,
0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x02, 0x42,
0x11, 0x0a, 0x0f, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
0x69, 0x64, 0x42, 0x47, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65,
0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76,
0x31, 0x3b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
file_stocklet_events_v1_payment_proto_rawDescOnce sync.Once
file_stocklet_events_v1_payment_proto_rawDescData = file_stocklet_events_v1_payment_proto_rawDesc
)
func file_stocklet_events_v1_payment_proto_rawDescGZIP() []byte {
file_stocklet_events_v1_payment_proto_rawDescOnce.Do(func() {
file_stocklet_events_v1_payment_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_events_v1_payment_proto_rawDescData)
})
return file_stocklet_events_v1_payment_proto_rawDescData
}
var file_stocklet_events_v1_payment_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_stocklet_events_v1_payment_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_stocklet_events_v1_payment_proto_goTypes = []interface{}{
(PaymentProcessedEvent_Type)(0), // 0: stocklet.events.v1.PaymentProcessedEvent.Type
(*BalanceCreatedEvent)(nil), // 1: stocklet.events.v1.BalanceCreatedEvent
(*BalanceCreditedEvent)(nil), // 2: stocklet.events.v1.BalanceCreditedEvent
(*BalanceDebitedEvent)(nil), // 3: stocklet.events.v1.BalanceDebitedEvent
(*BalanceClosedEvent)(nil), // 4: stocklet.events.v1.BalanceClosedEvent
(*TransactionLoggedEvent)(nil), // 5: stocklet.events.v1.TransactionLoggedEvent
(*TransactionReversedEvent)(nil), // 6: stocklet.events.v1.TransactionReversedEvent
(*PaymentProcessedEvent)(nil), // 7: stocklet.events.v1.PaymentProcessedEvent
}
var file_stocklet_events_v1_payment_proto_depIdxs = []int32{
0, // 0: stocklet.events.v1.PaymentProcessedEvent.type:type_name -> stocklet.events.v1.PaymentProcessedEvent.Type
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_stocklet_events_v1_payment_proto_init() }
func file_stocklet_events_v1_payment_proto_init() {
if File_stocklet_events_v1_payment_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_events_v1_payment_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BalanceCreatedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_payment_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BalanceCreditedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_payment_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BalanceDebitedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_payment_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BalanceClosedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_payment_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TransactionLoggedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_payment_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TransactionReversedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_payment_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PaymentProcessedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_stocklet_events_v1_payment_proto_msgTypes[6].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_events_v1_payment_proto_rawDesc,
NumEnums: 1,
NumMessages: 7,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_events_v1_payment_proto_goTypes,
DependencyIndexes: file_stocklet_events_v1_payment_proto_depIdxs,
EnumInfos: file_stocklet_events_v1_payment_proto_enumTypes,
MessageInfos: file_stocklet_events_v1_payment_proto_msgTypes,
}.Build()
File_stocklet_events_v1_payment_proto = out.File
file_stocklet_events_v1_payment_proto_rawDesc = nil
file_stocklet_events_v1_payment_proto_goTypes = nil
file_stocklet_events_v1_payment_proto_depIdxs = nil
}

View File

@@ -0,0 +1,555 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/events/v1/product.proto
package events_v1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ProductPriceQuoteEvent_Type int32
const (
ProductPriceQuoteEvent_TYPE_UNSPECIFIED ProductPriceQuoteEvent_Type = 0
ProductPriceQuoteEvent_TYPE_UNAVALIABLE ProductPriceQuoteEvent_Type = 1
ProductPriceQuoteEvent_TYPE_AVALIABLE ProductPriceQuoteEvent_Type = 2
)
// Enum value maps for ProductPriceQuoteEvent_Type.
var (
ProductPriceQuoteEvent_Type_name = map[int32]string{
0: "TYPE_UNSPECIFIED",
1: "TYPE_UNAVALIABLE",
2: "TYPE_AVALIABLE",
}
ProductPriceQuoteEvent_Type_value = map[string]int32{
"TYPE_UNSPECIFIED": 0,
"TYPE_UNAVALIABLE": 1,
"TYPE_AVALIABLE": 2,
}
)
func (x ProductPriceQuoteEvent_Type) Enum() *ProductPriceQuoteEvent_Type {
p := new(ProductPriceQuoteEvent_Type)
*p = x
return p
}
func (x ProductPriceQuoteEvent_Type) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ProductPriceQuoteEvent_Type) Descriptor() protoreflect.EnumDescriptor {
return file_stocklet_events_v1_product_proto_enumTypes[0].Descriptor()
}
func (ProductPriceQuoteEvent_Type) Type() protoreflect.EnumType {
return &file_stocklet_events_v1_product_proto_enumTypes[0]
}
func (x ProductPriceQuoteEvent_Type) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ProductPriceQuoteEvent_Type.Descriptor instead.
func (ProductPriceQuoteEvent_Type) EnumDescriptor() ([]byte, []int) {
return file_stocklet_events_v1_product_proto_rawDescGZIP(), []int{3, 0}
}
type ProductCreatedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
ProductId string `protobuf:"bytes,2,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
Price float32 `protobuf:"fixed32,5,opt,name=price,proto3" json:"price,omitempty"`
}
func (x *ProductCreatedEvent) Reset() {
*x = ProductCreatedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_product_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ProductCreatedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ProductCreatedEvent) ProtoMessage() {}
func (x *ProductCreatedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_product_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ProductCreatedEvent.ProtoReflect.Descriptor instead.
func (*ProductCreatedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_product_proto_rawDescGZIP(), []int{0}
}
func (x *ProductCreatedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *ProductCreatedEvent) GetProductId() string {
if x != nil {
return x.ProductId
}
return ""
}
func (x *ProductCreatedEvent) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *ProductCreatedEvent) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *ProductCreatedEvent) GetPrice() float32 {
if x != nil {
return x.Price
}
return 0
}
type ProductPriceUpdatedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
ProductId string `protobuf:"bytes,2,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
Price float32 `protobuf:"fixed32,3,opt,name=price,proto3" json:"price,omitempty"`
}
func (x *ProductPriceUpdatedEvent) Reset() {
*x = ProductPriceUpdatedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_product_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ProductPriceUpdatedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ProductPriceUpdatedEvent) ProtoMessage() {}
func (x *ProductPriceUpdatedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_product_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ProductPriceUpdatedEvent.ProtoReflect.Descriptor instead.
func (*ProductPriceUpdatedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_product_proto_rawDescGZIP(), []int{1}
}
func (x *ProductPriceUpdatedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *ProductPriceUpdatedEvent) GetProductId() string {
if x != nil {
return x.ProductId
}
return ""
}
func (x *ProductPriceUpdatedEvent) GetPrice() float32 {
if x != nil {
return x.Price
}
return 0
}
type ProductDeletedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
ProductId string `protobuf:"bytes,2,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
}
func (x *ProductDeletedEvent) Reset() {
*x = ProductDeletedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_product_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ProductDeletedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ProductDeletedEvent) ProtoMessage() {}
func (x *ProductDeletedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_product_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ProductDeletedEvent.ProtoReflect.Descriptor instead.
func (*ProductDeletedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_product_proto_rawDescGZIP(), []int{2}
}
func (x *ProductDeletedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *ProductDeletedEvent) GetProductId() string {
if x != nil {
return x.ProductId
}
return ""
}
type ProductPriceQuoteEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
Type ProductPriceQuoteEvent_Type `protobuf:"varint,2,opt,name=type,proto3,enum=stocklet.events.v1.ProductPriceQuoteEvent_Type" json:"type,omitempty"`
OrderId string `protobuf:"bytes,3,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
// Product ID: Quantity
ProductQuantities map[string]int32 `protobuf:"bytes,4,rep,name=product_quantities,json=productQuantities,proto3" json:"product_quantities,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
// Product ID: Unit Price
ProductPrices map[string]float32 `protobuf:"bytes,5,rep,name=product_prices,json=productPrices,proto3" json:"product_prices,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"`
TotalPrice float32 `protobuf:"fixed32,6,opt,name=total_price,json=totalPrice,proto3" json:"total_price,omitempty"`
}
func (x *ProductPriceQuoteEvent) Reset() {
*x = ProductPriceQuoteEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_product_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ProductPriceQuoteEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ProductPriceQuoteEvent) ProtoMessage() {}
func (x *ProductPriceQuoteEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_product_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ProductPriceQuoteEvent.ProtoReflect.Descriptor instead.
func (*ProductPriceQuoteEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_product_proto_rawDescGZIP(), []int{3}
}
func (x *ProductPriceQuoteEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *ProductPriceQuoteEvent) GetType() ProductPriceQuoteEvent_Type {
if x != nil {
return x.Type
}
return ProductPriceQuoteEvent_TYPE_UNSPECIFIED
}
func (x *ProductPriceQuoteEvent) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *ProductPriceQuoteEvent) GetProductQuantities() map[string]int32 {
if x != nil {
return x.ProductQuantities
}
return nil
}
func (x *ProductPriceQuoteEvent) GetProductPrices() map[string]float32 {
if x != nil {
return x.ProductPrices
}
return nil
}
func (x *ProductPriceQuoteEvent) GetTotalPrice() float32 {
if x != nil {
return x.TotalPrice
}
return 0
}
var File_stocklet_events_v1_product_proto protoreflect.FileDescriptor
var file_stocklet_events_v1_product_proto_rawDesc = []byte{
0x0a, 0x20, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x12, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65,
0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x22, 0x9c, 0x01, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a,
0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72,
0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a,
0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05,
0x70, 0x72, 0x69, 0x63, 0x65, 0x22, 0x6b, 0x0a, 0x18, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x50, 0x72, 0x69, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e,
0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a,
0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05,
0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x70, 0x72, 0x69,
0x63, 0x65, 0x22, 0x50, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76,
0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x76,
0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x49, 0x64, 0x22, 0xdd, 0x04, 0x0a, 0x16, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x50, 0x72, 0x69, 0x63, 0x65, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12,
0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x43, 0x0a, 0x04, 0x74,
0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x73, 0x74, 0x6f, 0x63,
0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50,
0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x51, 0x75, 0x6f, 0x74, 0x65,
0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x70, 0x0a, 0x12, 0x70,
0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65,
0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c,
0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f,
0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x45, 0x76,
0x65, 0x6e, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x51, 0x75, 0x61, 0x6e, 0x74,
0x69, 0x74, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x70, 0x72, 0x6f, 0x64,
0x75, 0x63, 0x74, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x64, 0x0a,
0x0e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, 0x18,
0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74,
0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e,
0x74, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69,
0x63, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x69,
0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50,
0x72, 0x69, 0x63, 0x65, 0x1a, 0x44, 0x0a, 0x16, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x51,
0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79,
0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x40, 0x0a, 0x12, 0x50, 0x72,
0x6f, 0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x02, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x46, 0x0a, 0x04,
0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53,
0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59,
0x50, 0x45, 0x5f, 0x55, 0x4e, 0x41, 0x56, 0x41, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x10, 0x01,
0x12, 0x12, 0x0a, 0x0e, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x56, 0x41, 0x4c, 0x49, 0x41, 0x42,
0x4c, 0x45, 0x10, 0x02, 0x42, 0x47, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67,
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73,
0x2f, 0x76, 0x31, 0x3b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_events_v1_product_proto_rawDescOnce sync.Once
file_stocklet_events_v1_product_proto_rawDescData = file_stocklet_events_v1_product_proto_rawDesc
)
func file_stocklet_events_v1_product_proto_rawDescGZIP() []byte {
file_stocklet_events_v1_product_proto_rawDescOnce.Do(func() {
file_stocklet_events_v1_product_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_events_v1_product_proto_rawDescData)
})
return file_stocklet_events_v1_product_proto_rawDescData
}
var file_stocklet_events_v1_product_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_stocklet_events_v1_product_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_stocklet_events_v1_product_proto_goTypes = []interface{}{
(ProductPriceQuoteEvent_Type)(0), // 0: stocklet.events.v1.ProductPriceQuoteEvent.Type
(*ProductCreatedEvent)(nil), // 1: stocklet.events.v1.ProductCreatedEvent
(*ProductPriceUpdatedEvent)(nil), // 2: stocklet.events.v1.ProductPriceUpdatedEvent
(*ProductDeletedEvent)(nil), // 3: stocklet.events.v1.ProductDeletedEvent
(*ProductPriceQuoteEvent)(nil), // 4: stocklet.events.v1.ProductPriceQuoteEvent
nil, // 5: stocklet.events.v1.ProductPriceQuoteEvent.ProductQuantitiesEntry
nil, // 6: stocklet.events.v1.ProductPriceQuoteEvent.ProductPricesEntry
}
var file_stocklet_events_v1_product_proto_depIdxs = []int32{
0, // 0: stocklet.events.v1.ProductPriceQuoteEvent.type:type_name -> stocklet.events.v1.ProductPriceQuoteEvent.Type
5, // 1: stocklet.events.v1.ProductPriceQuoteEvent.product_quantities:type_name -> stocklet.events.v1.ProductPriceQuoteEvent.ProductQuantitiesEntry
6, // 2: stocklet.events.v1.ProductPriceQuoteEvent.product_prices:type_name -> stocklet.events.v1.ProductPriceQuoteEvent.ProductPricesEntry
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_stocklet_events_v1_product_proto_init() }
func file_stocklet_events_v1_product_proto_init() {
if File_stocklet_events_v1_product_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_events_v1_product_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ProductCreatedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_product_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ProductPriceUpdatedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_product_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ProductDeletedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_product_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ProductPriceQuoteEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_events_v1_product_proto_rawDesc,
NumEnums: 1,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_events_v1_product_proto_goTypes,
DependencyIndexes: file_stocklet_events_v1_product_proto_depIdxs,
EnumInfos: file_stocklet_events_v1_product_proto_enumTypes,
MessageInfos: file_stocklet_events_v1_product_proto_msgTypes,
}.Build()
File_stocklet_events_v1_product_proto = out.File
file_stocklet_events_v1_product_proto_rawDesc = nil
file_stocklet_events_v1_product_proto_goTypes = nil
file_stocklet_events_v1_product_proto_depIdxs = nil
}

View File

@@ -0,0 +1,482 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/events/v1/shipping.proto
package events_v1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ShipmentAllocationEvent_Type int32
const (
ShipmentAllocationEvent_TYPE_UNSPECIFIED ShipmentAllocationEvent_Type = 0
ShipmentAllocationEvent_TYPE_FAILED ShipmentAllocationEvent_Type = 1
ShipmentAllocationEvent_TYPE_ALLOCATED ShipmentAllocationEvent_Type = 2
ShipmentAllocationEvent_TYPE_ALLOCATION_RELEASED ShipmentAllocationEvent_Type = 3
)
// Enum value maps for ShipmentAllocationEvent_Type.
var (
ShipmentAllocationEvent_Type_name = map[int32]string{
0: "TYPE_UNSPECIFIED",
1: "TYPE_FAILED",
2: "TYPE_ALLOCATED",
3: "TYPE_ALLOCATION_RELEASED",
}
ShipmentAllocationEvent_Type_value = map[string]int32{
"TYPE_UNSPECIFIED": 0,
"TYPE_FAILED": 1,
"TYPE_ALLOCATED": 2,
"TYPE_ALLOCATION_RELEASED": 3,
}
)
func (x ShipmentAllocationEvent_Type) Enum() *ShipmentAllocationEvent_Type {
p := new(ShipmentAllocationEvent_Type)
*p = x
return p
}
func (x ShipmentAllocationEvent_Type) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ShipmentAllocationEvent_Type) Descriptor() protoreflect.EnumDescriptor {
return file_stocklet_events_v1_shipping_proto_enumTypes[0].Descriptor()
}
func (ShipmentAllocationEvent_Type) Type() protoreflect.EnumType {
return &file_stocklet_events_v1_shipping_proto_enumTypes[0]
}
func (x ShipmentAllocationEvent_Type) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ShipmentAllocationEvent_Type.Descriptor instead.
func (ShipmentAllocationEvent_Type) EnumDescriptor() ([]byte, []int) {
return file_stocklet_events_v1_shipping_proto_rawDescGZIP(), []int{0, 0}
}
type ShipmentAllocationEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
Type ShipmentAllocationEvent_Type `protobuf:"varint,2,opt,name=type,proto3,enum=stocklet.events.v1.ShipmentAllocationEvent_Type" json:"type,omitempty"`
OrderId string `protobuf:"bytes,3,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
OrderMetadata *ShipmentAllocationEvent_OrderMetadata `protobuf:"bytes,4,opt,name=order_metadata,json=orderMetadata,proto3" json:"order_metadata,omitempty"`
ShipmentId string `protobuf:"bytes,5,opt,name=shipment_id,json=shipmentId,proto3" json:"shipment_id,omitempty"` // provided with type enum value 2+
ProductQuantities map[string]int32 `protobuf:"bytes,6,rep,name=product_quantities,json=productQuantities,proto3" json:"product_quantities,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
}
func (x *ShipmentAllocationEvent) Reset() {
*x = ShipmentAllocationEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_shipping_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ShipmentAllocationEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ShipmentAllocationEvent) ProtoMessage() {}
func (x *ShipmentAllocationEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_shipping_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ShipmentAllocationEvent.ProtoReflect.Descriptor instead.
func (*ShipmentAllocationEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_shipping_proto_rawDescGZIP(), []int{0}
}
func (x *ShipmentAllocationEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *ShipmentAllocationEvent) GetType() ShipmentAllocationEvent_Type {
if x != nil {
return x.Type
}
return ShipmentAllocationEvent_TYPE_UNSPECIFIED
}
func (x *ShipmentAllocationEvent) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *ShipmentAllocationEvent) GetOrderMetadata() *ShipmentAllocationEvent_OrderMetadata {
if x != nil {
return x.OrderMetadata
}
return nil
}
func (x *ShipmentAllocationEvent) GetShipmentId() string {
if x != nil {
return x.ShipmentId
}
return ""
}
func (x *ShipmentAllocationEvent) GetProductQuantities() map[string]int32 {
if x != nil {
return x.ProductQuantities
}
return nil
}
type ShipmentDispatchedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
ShipmentId string `protobuf:"bytes,2,opt,name=shipment_id,json=shipmentId,proto3" json:"shipment_id,omitempty"`
OrderId string `protobuf:"bytes,3,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
ProductQuantities map[string]int32 `protobuf:"bytes,4,rep,name=product_quantities,json=productQuantities,proto3" json:"product_quantities,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
}
func (x *ShipmentDispatchedEvent) Reset() {
*x = ShipmentDispatchedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_shipping_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ShipmentDispatchedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ShipmentDispatchedEvent) ProtoMessage() {}
func (x *ShipmentDispatchedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_shipping_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ShipmentDispatchedEvent.ProtoReflect.Descriptor instead.
func (*ShipmentDispatchedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_shipping_proto_rawDescGZIP(), []int{1}
}
func (x *ShipmentDispatchedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *ShipmentDispatchedEvent) GetShipmentId() string {
if x != nil {
return x.ShipmentId
}
return ""
}
func (x *ShipmentDispatchedEvent) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *ShipmentDispatchedEvent) GetProductQuantities() map[string]int32 {
if x != nil {
return x.ProductQuantities
}
return nil
}
type ShipmentAllocationEvent_OrderMetadata struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CustomerId string `protobuf:"bytes,1,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
ItemsPrice float32 `protobuf:"fixed32,2,opt,name=items_price,json=itemsPrice,proto3" json:"items_price,omitempty"`
TotalPrice float32 `protobuf:"fixed32,3,opt,name=total_price,json=totalPrice,proto3" json:"total_price,omitempty"`
}
func (x *ShipmentAllocationEvent_OrderMetadata) Reset() {
*x = ShipmentAllocationEvent_OrderMetadata{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_shipping_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ShipmentAllocationEvent_OrderMetadata) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ShipmentAllocationEvent_OrderMetadata) ProtoMessage() {}
func (x *ShipmentAllocationEvent_OrderMetadata) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_shipping_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ShipmentAllocationEvent_OrderMetadata.ProtoReflect.Descriptor instead.
func (*ShipmentAllocationEvent_OrderMetadata) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_shipping_proto_rawDescGZIP(), []int{0, 0}
}
func (x *ShipmentAllocationEvent_OrderMetadata) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
func (x *ShipmentAllocationEvent_OrderMetadata) GetItemsPrice() float32 {
if x != nil {
return x.ItemsPrice
}
return 0
}
func (x *ShipmentAllocationEvent_OrderMetadata) GetTotalPrice() float32 {
if x != nil {
return x.TotalPrice
}
return 0
}
var File_stocklet_events_v1_shipping_proto protoreflect.FileDescriptor
var file_stocklet_events_v1_shipping_proto_rawDesc = []byte{
0x0a, 0x21, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x12, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76,
0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x22, 0xa7, 0x05, 0x0a, 0x17, 0x53, 0x68, 0x69, 0x70,
0x6d, 0x65, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76,
0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12,
0x44, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e,
0x76, 0x31, 0x2e, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52,
0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69,
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64,
0x12, 0x60, 0x0a, 0x0e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61,
0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68,
0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64,
0x61, 0x74, 0x61, 0x52, 0x0d, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
0x74, 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69,
0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e,
0x74, 0x49, 0x64, 0x12, 0x71, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x71,
0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x42, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x6c, 0x6c,
0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x50, 0x72, 0x6f,
0x64, 0x75, 0x63, 0x74, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x45, 0x6e,
0x74, 0x72, 0x79, 0x52, 0x11, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x51, 0x75, 0x61, 0x6e,
0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x72, 0x0a, 0x0d, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x4d,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f,
0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x75,
0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x74, 0x65, 0x6d,
0x73, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x69,
0x74, 0x65, 0x6d, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74,
0x61, 0x6c, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a,
0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x1a, 0x44, 0x0a, 0x16, 0x50, 0x72,
0x6f, 0x64, 0x75, 0x63, 0x74, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
0x22, 0x5f, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45,
0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0f,
0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12,
0x12, 0x0a, 0x0e, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x4c, 0x4c, 0x4f, 0x43, 0x41, 0x54, 0x45,
0x44, 0x10, 0x02, 0x12, 0x1c, 0x0a, 0x18, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x4c, 0x4c, 0x4f,
0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x4c, 0x45, 0x41, 0x53, 0x45, 0x44, 0x10,
0x03, 0x22, 0xaa, 0x02, 0x0a, 0x17, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x69,
0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a,
0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x68, 0x69,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72,
0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72,
0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x71, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x5f, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x42, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65,
0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x44,
0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x50,
0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x51, 0x75,
0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x44, 0x0a, 0x16, 0x50, 0x72, 0x6f, 0x64,
0x75, 0x63, 0x74, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x47,
0x5a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x65, 0x78,
0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x6e,
0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x67, 0x65, 0x6e, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x76,
0x65, 0x6e, 0x74, 0x73, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_events_v1_shipping_proto_rawDescOnce sync.Once
file_stocklet_events_v1_shipping_proto_rawDescData = file_stocklet_events_v1_shipping_proto_rawDesc
)
func file_stocklet_events_v1_shipping_proto_rawDescGZIP() []byte {
file_stocklet_events_v1_shipping_proto_rawDescOnce.Do(func() {
file_stocklet_events_v1_shipping_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_events_v1_shipping_proto_rawDescData)
})
return file_stocklet_events_v1_shipping_proto_rawDescData
}
var file_stocklet_events_v1_shipping_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_stocklet_events_v1_shipping_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_stocklet_events_v1_shipping_proto_goTypes = []interface{}{
(ShipmentAllocationEvent_Type)(0), // 0: stocklet.events.v1.ShipmentAllocationEvent.Type
(*ShipmentAllocationEvent)(nil), // 1: stocklet.events.v1.ShipmentAllocationEvent
(*ShipmentDispatchedEvent)(nil), // 2: stocklet.events.v1.ShipmentDispatchedEvent
(*ShipmentAllocationEvent_OrderMetadata)(nil), // 3: stocklet.events.v1.ShipmentAllocationEvent.OrderMetadata
nil, // 4: stocklet.events.v1.ShipmentAllocationEvent.ProductQuantitiesEntry
nil, // 5: stocklet.events.v1.ShipmentDispatchedEvent.ProductQuantitiesEntry
}
var file_stocklet_events_v1_shipping_proto_depIdxs = []int32{
0, // 0: stocklet.events.v1.ShipmentAllocationEvent.type:type_name -> stocklet.events.v1.ShipmentAllocationEvent.Type
3, // 1: stocklet.events.v1.ShipmentAllocationEvent.order_metadata:type_name -> stocklet.events.v1.ShipmentAllocationEvent.OrderMetadata
4, // 2: stocklet.events.v1.ShipmentAllocationEvent.product_quantities:type_name -> stocklet.events.v1.ShipmentAllocationEvent.ProductQuantitiesEntry
5, // 3: stocklet.events.v1.ShipmentDispatchedEvent.product_quantities:type_name -> stocklet.events.v1.ShipmentDispatchedEvent.ProductQuantitiesEntry
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_stocklet_events_v1_shipping_proto_init() }
func file_stocklet_events_v1_shipping_proto_init() {
if File_stocklet_events_v1_shipping_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_events_v1_shipping_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ShipmentAllocationEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_shipping_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ShipmentDispatchedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_shipping_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ShipmentAllocationEvent_OrderMetadata); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_events_v1_shipping_proto_rawDesc,
NumEnums: 1,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_events_v1_shipping_proto_goTypes,
DependencyIndexes: file_stocklet_events_v1_shipping_proto_depIdxs,
EnumInfos: file_stocklet_events_v1_shipping_proto_enumTypes,
MessageInfos: file_stocklet_events_v1_shipping_proto_msgTypes,
}.Build()
File_stocklet_events_v1_shipping_proto = out.File
file_stocklet_events_v1_shipping_proto_rawDesc = nil
file_stocklet_events_v1_shipping_proto_goTypes = nil
file_stocklet_events_v1_shipping_proto_depIdxs = nil
}

View File

@@ -0,0 +1,366 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/events/v1/user.proto
package events_v1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type UserCreatedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
FirstName string `protobuf:"bytes,4,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"`
LastName string `protobuf:"bytes,5,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"`
}
func (x *UserCreatedEvent) Reset() {
*x = UserCreatedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_user_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserCreatedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserCreatedEvent) ProtoMessage() {}
func (x *UserCreatedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_user_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UserCreatedEvent.ProtoReflect.Descriptor instead.
func (*UserCreatedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_user_proto_rawDescGZIP(), []int{0}
}
func (x *UserCreatedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *UserCreatedEvent) GetUserId() string {
if x != nil {
return x.UserId
}
return ""
}
func (x *UserCreatedEvent) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
func (x *UserCreatedEvent) GetFirstName() string {
if x != nil {
return x.FirstName
}
return ""
}
func (x *UserCreatedEvent) GetLastName() string {
if x != nil {
return x.LastName
}
return ""
}
type UserEmailUpdatedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
}
func (x *UserEmailUpdatedEvent) Reset() {
*x = UserEmailUpdatedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_user_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserEmailUpdatedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserEmailUpdatedEvent) ProtoMessage() {}
func (x *UserEmailUpdatedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_user_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UserEmailUpdatedEvent.ProtoReflect.Descriptor instead.
func (*UserEmailUpdatedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_user_proto_rawDescGZIP(), []int{1}
}
func (x *UserEmailUpdatedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *UserEmailUpdatedEvent) GetUserId() string {
if x != nil {
return x.UserId
}
return ""
}
func (x *UserEmailUpdatedEvent) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
type UserDeletedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
}
func (x *UserDeletedEvent) Reset() {
*x = UserDeletedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_user_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserDeletedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserDeletedEvent) ProtoMessage() {}
func (x *UserDeletedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_user_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UserDeletedEvent.ProtoReflect.Descriptor instead.
func (*UserDeletedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_user_proto_rawDescGZIP(), []int{2}
}
func (x *UserDeletedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *UserDeletedEvent) GetUserId() string {
if x != nil {
return x.UserId
}
return ""
}
func (x *UserDeletedEvent) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
var File_stocklet_events_v1_user_proto protoreflect.FileDescriptor
var file_stocklet_events_v1_user_proto_rawDesc = []byte{
0x0a, 0x1d, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x12, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73,
0x2e, 0x76, 0x31, 0x22, 0x99, 0x01, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x43, 0x72, 0x65, 0x61,
0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69,
0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69,
0x73, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a,
0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d,
0x61, 0x69, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61,
0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22,
0x62, 0x0a, 0x15, 0x55, 0x73, 0x65, 0x72, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69,
0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69,
0x73, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a,
0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d,
0x61, 0x69, 0x6c, 0x22, 0x5d, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74,
0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73,
0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73,
0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05,
0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61,
0x69, 0x6c, 0x42, 0x47, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65,
0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76,
0x31, 0x3b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
file_stocklet_events_v1_user_proto_rawDescOnce sync.Once
file_stocklet_events_v1_user_proto_rawDescData = file_stocklet_events_v1_user_proto_rawDesc
)
func file_stocklet_events_v1_user_proto_rawDescGZIP() []byte {
file_stocklet_events_v1_user_proto_rawDescOnce.Do(func() {
file_stocklet_events_v1_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_events_v1_user_proto_rawDescData)
})
return file_stocklet_events_v1_user_proto_rawDescData
}
var file_stocklet_events_v1_user_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_stocklet_events_v1_user_proto_goTypes = []interface{}{
(*UserCreatedEvent)(nil), // 0: stocklet.events.v1.UserCreatedEvent
(*UserEmailUpdatedEvent)(nil), // 1: stocklet.events.v1.UserEmailUpdatedEvent
(*UserDeletedEvent)(nil), // 2: stocklet.events.v1.UserDeletedEvent
}
var file_stocklet_events_v1_user_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_stocklet_events_v1_user_proto_init() }
func file_stocklet_events_v1_user_proto_init() {
if File_stocklet_events_v1_user_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_events_v1_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserCreatedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserEmailUpdatedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserDeletedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_events_v1_user_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_events_v1_user_proto_goTypes,
DependencyIndexes: file_stocklet_events_v1_user_proto_depIdxs,
MessageInfos: file_stocklet_events_v1_user_proto_msgTypes,
}.Build()
File_stocklet_events_v1_user_proto = out.File
file_stocklet_events_v1_user_proto_rawDesc = nil
file_stocklet_events_v1_user_proto_goTypes = nil
file_stocklet_events_v1_user_proto_depIdxs = nil
}

View File

@@ -0,0 +1,671 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/events/v1/warehouse.proto
package events_v1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type StockReservationEvent_Type int32
const (
StockReservationEvent_TYPE_UNSPECIFIED StockReservationEvent_Type = 0
StockReservationEvent_TYPE_INSUFFICIENT_STOCK StockReservationEvent_Type = 1
StockReservationEvent_TYPE_STOCK_RESERVED StockReservationEvent_Type = 2
StockReservationEvent_TYPE_STOCK_RETURNED StockReservationEvent_Type = 3
StockReservationEvent_TYPE_STOCK_CONSUMED StockReservationEvent_Type = 4
)
// Enum value maps for StockReservationEvent_Type.
var (
StockReservationEvent_Type_name = map[int32]string{
0: "TYPE_UNSPECIFIED",
1: "TYPE_INSUFFICIENT_STOCK",
2: "TYPE_STOCK_RESERVED",
3: "TYPE_STOCK_RETURNED",
4: "TYPE_STOCK_CONSUMED",
}
StockReservationEvent_Type_value = map[string]int32{
"TYPE_UNSPECIFIED": 0,
"TYPE_INSUFFICIENT_STOCK": 1,
"TYPE_STOCK_RESERVED": 2,
"TYPE_STOCK_RETURNED": 3,
"TYPE_STOCK_CONSUMED": 4,
}
)
func (x StockReservationEvent_Type) Enum() *StockReservationEvent_Type {
p := new(StockReservationEvent_Type)
*p = x
return p
}
func (x StockReservationEvent_Type) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (StockReservationEvent_Type) Descriptor() protoreflect.EnumDescriptor {
return file_stocklet_events_v1_warehouse_proto_enumTypes[0].Descriptor()
}
func (StockReservationEvent_Type) Type() protoreflect.EnumType {
return &file_stocklet_events_v1_warehouse_proto_enumTypes[0]
}
func (x StockReservationEvent_Type) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use StockReservationEvent_Type.Descriptor instead.
func (StockReservationEvent_Type) EnumDescriptor() ([]byte, []int) {
return file_stocklet_events_v1_warehouse_proto_rawDescGZIP(), []int{3, 0}
}
type StockCreatedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
ProductId string `protobuf:"bytes,2,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
Quantity int32 `protobuf:"varint,3,opt,name=quantity,proto3" json:"quantity,omitempty"`
}
func (x *StockCreatedEvent) Reset() {
*x = StockCreatedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_warehouse_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StockCreatedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StockCreatedEvent) ProtoMessage() {}
func (x *StockCreatedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_warehouse_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StockCreatedEvent.ProtoReflect.Descriptor instead.
func (*StockCreatedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_warehouse_proto_rawDescGZIP(), []int{0}
}
func (x *StockCreatedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *StockCreatedEvent) GetProductId() string {
if x != nil {
return x.ProductId
}
return ""
}
func (x *StockCreatedEvent) GetQuantity() int32 {
if x != nil {
return x.Quantity
}
return 0
}
type StockAddedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
ProductId string `protobuf:"bytes,2,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
Amount int32 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"`
// If the stock is returned as a result of a stock reservation outcome,
// then the reservation id will be included for reference.
ReservationId *string `protobuf:"bytes,4,opt,name=reservation_id,json=reservationId,proto3,oneof" json:"reservation_id,omitempty"`
}
func (x *StockAddedEvent) Reset() {
*x = StockAddedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_warehouse_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StockAddedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StockAddedEvent) ProtoMessage() {}
func (x *StockAddedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_warehouse_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StockAddedEvent.ProtoReflect.Descriptor instead.
func (*StockAddedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_warehouse_proto_rawDescGZIP(), []int{1}
}
func (x *StockAddedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *StockAddedEvent) GetProductId() string {
if x != nil {
return x.ProductId
}
return ""
}
func (x *StockAddedEvent) GetAmount() int32 {
if x != nil {
return x.Amount
}
return 0
}
func (x *StockAddedEvent) GetReservationId() string {
if x != nil && x.ReservationId != nil {
return *x.ReservationId
}
return ""
}
type StockRemovedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
ProductId string `protobuf:"bytes,2,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
Amount int32 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"`
// If the stock is removed as a result of a stock reservation being closed,
// then the reservation id will be included for reference.
ReservationId *string `protobuf:"bytes,4,opt,name=reservation_id,json=reservationId,proto3,oneof" json:"reservation_id,omitempty"`
}
func (x *StockRemovedEvent) Reset() {
*x = StockRemovedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_warehouse_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StockRemovedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StockRemovedEvent) ProtoMessage() {}
func (x *StockRemovedEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_warehouse_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StockRemovedEvent.ProtoReflect.Descriptor instead.
func (*StockRemovedEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_warehouse_proto_rawDescGZIP(), []int{2}
}
func (x *StockRemovedEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *StockRemovedEvent) GetProductId() string {
if x != nil {
return x.ProductId
}
return ""
}
func (x *StockRemovedEvent) GetAmount() int32 {
if x != nil {
return x.Amount
}
return 0
}
func (x *StockRemovedEvent) GetReservationId() string {
if x != nil && x.ReservationId != nil {
return *x.ReservationId
}
return ""
}
type StockReservationEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
Type StockReservationEvent_Type `protobuf:"varint,2,opt,name=type,proto3,enum=stocklet.events.v1.StockReservationEvent_Type" json:"type,omitempty"`
OrderId string `protobuf:"bytes,3,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
OrderMetadata *StockReservationEvent_OrderMetadata `protobuf:"bytes,4,opt,name=order_metadata,json=orderMetadata,proto3" json:"order_metadata,omitempty"`
ReservationId string `protobuf:"bytes,5,opt,name=reservation_id,json=reservationId,proto3" json:"reservation_id,omitempty"` // provided with type enum value 2+
ReservationStock map[string]int32 `protobuf:"bytes,6,rep,name=reservation_stock,json=reservationStock,proto3" json:"reservation_stock,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // Product ID: Quantity (provided with type enum value 2+)
InsufficientStock []string `protobuf:"bytes,7,rep,name=insufficient_stock,json=insufficientStock,proto3" json:"insufficient_stock,omitempty"` // Product IDs (only provided with TYPE_INSUFFICIENT_STOCK)
}
func (x *StockReservationEvent) Reset() {
*x = StockReservationEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_warehouse_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StockReservationEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StockReservationEvent) ProtoMessage() {}
func (x *StockReservationEvent) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_warehouse_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StockReservationEvent.ProtoReflect.Descriptor instead.
func (*StockReservationEvent) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_warehouse_proto_rawDescGZIP(), []int{3}
}
func (x *StockReservationEvent) GetRevision() int32 {
if x != nil {
return x.Revision
}
return 0
}
func (x *StockReservationEvent) GetType() StockReservationEvent_Type {
if x != nil {
return x.Type
}
return StockReservationEvent_TYPE_UNSPECIFIED
}
func (x *StockReservationEvent) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *StockReservationEvent) GetOrderMetadata() *StockReservationEvent_OrderMetadata {
if x != nil {
return x.OrderMetadata
}
return nil
}
func (x *StockReservationEvent) GetReservationId() string {
if x != nil {
return x.ReservationId
}
return ""
}
func (x *StockReservationEvent) GetReservationStock() map[string]int32 {
if x != nil {
return x.ReservationStock
}
return nil
}
func (x *StockReservationEvent) GetInsufficientStock() []string {
if x != nil {
return x.InsufficientStock
}
return nil
}
type StockReservationEvent_OrderMetadata struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CustomerId string `protobuf:"bytes,1,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
ItemsPrice float32 `protobuf:"fixed32,2,opt,name=items_price,json=itemsPrice,proto3" json:"items_price,omitempty"`
TotalPrice float32 `protobuf:"fixed32,3,opt,name=total_price,json=totalPrice,proto3" json:"total_price,omitempty"`
}
func (x *StockReservationEvent_OrderMetadata) Reset() {
*x = StockReservationEvent_OrderMetadata{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_events_v1_warehouse_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StockReservationEvent_OrderMetadata) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StockReservationEvent_OrderMetadata) ProtoMessage() {}
func (x *StockReservationEvent_OrderMetadata) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_events_v1_warehouse_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StockReservationEvent_OrderMetadata.ProtoReflect.Descriptor instead.
func (*StockReservationEvent_OrderMetadata) Descriptor() ([]byte, []int) {
return file_stocklet_events_v1_warehouse_proto_rawDescGZIP(), []int{3, 0}
}
func (x *StockReservationEvent_OrderMetadata) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
func (x *StockReservationEvent_OrderMetadata) GetItemsPrice() float32 {
if x != nil {
return x.ItemsPrice
}
return 0
}
func (x *StockReservationEvent_OrderMetadata) GetTotalPrice() float32 {
if x != nil {
return x.TotalPrice
}
return 0
}
var File_stocklet_events_v1_warehouse_proto protoreflect.FileDescriptor
var file_stocklet_events_v1_warehouse_proto_rawDesc = []byte{
0x0a, 0x22, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65,
0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x22, 0x6a, 0x0a, 0x11, 0x53, 0x74, 0x6f, 0x63,
0x6b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a,
0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f,
0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70,
0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e,
0x74, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e,
0x74, 0x69, 0x74, 0x79, 0x22, 0xa3, 0x01, 0x0a, 0x0f, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x41, 0x64,
0x64, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69,
0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69,
0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f,
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20,
0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x0e, 0x72,
0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x49, 0x64, 0x88, 0x01, 0x01, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x72, 0x65, 0x73, 0x65,
0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x22, 0xa5, 0x01, 0x0a, 0x11, 0x53,
0x74, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74,
0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a,
0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61,
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x6d, 0x6f,
0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0d, 0x72,
0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x88, 0x01, 0x01, 0x42,
0x11, 0x0a, 0x0f, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
0x69, 0x64, 0x22, 0xf6, 0x05, 0x0a, 0x15, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x65,
0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08,
0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65,
0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x63,
0x6b, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e,
0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08,
0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x5e, 0x0a, 0x0e, 0x6f, 0x72, 0x64, 0x65, 0x72,
0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x37, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0d, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x4d,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72,
0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x6c,
0x0a, 0x11, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74,
0x6f, 0x63, 0x6b, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x73, 0x74, 0x6f, 0x63,
0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53,
0x74, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45,
0x76, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x53, 0x74, 0x6f, 0x63, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, 0x72, 0x65, 0x73, 0x65,
0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x12, 0x2d, 0x0a, 0x12,
0x69, 0x6e, 0x73, 0x75, 0x66, 0x66, 0x69, 0x63, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x6f,
0x63, 0x6b, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x69, 0x6e, 0x73, 0x75, 0x66, 0x66,
0x69, 0x63, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x1a, 0x72, 0x0a, 0x0d, 0x4f,
0x72, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x0b,
0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a,
0x0b, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x02, 0x52, 0x0a, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1f,
0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x02, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x1a,
0x43, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74,
0x6f, 0x63, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x3a, 0x02, 0x38, 0x01, 0x22, 0x84, 0x01, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a,
0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45,
0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x53, 0x55,
0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x53, 0x54, 0x4f, 0x43, 0x4b, 0x10, 0x01,
0x12, 0x17, 0x0a, 0x13, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x4f, 0x43, 0x4b, 0x5f, 0x52,
0x45, 0x53, 0x45, 0x52, 0x56, 0x45, 0x44, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x59, 0x50,
0x45, 0x5f, 0x53, 0x54, 0x4f, 0x43, 0x4b, 0x5f, 0x52, 0x45, 0x54, 0x55, 0x52, 0x4e, 0x45, 0x44,
0x10, 0x03, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x4f, 0x43, 0x4b,
0x5f, 0x43, 0x4f, 0x4e, 0x53, 0x55, 0x4d, 0x45, 0x44, 0x10, 0x04, 0x42, 0x47, 0x5a, 0x45, 0x67,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61,
0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72,
0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e,
0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_events_v1_warehouse_proto_rawDescOnce sync.Once
file_stocklet_events_v1_warehouse_proto_rawDescData = file_stocklet_events_v1_warehouse_proto_rawDesc
)
func file_stocklet_events_v1_warehouse_proto_rawDescGZIP() []byte {
file_stocklet_events_v1_warehouse_proto_rawDescOnce.Do(func() {
file_stocklet_events_v1_warehouse_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_events_v1_warehouse_proto_rawDescData)
})
return file_stocklet_events_v1_warehouse_proto_rawDescData
}
var file_stocklet_events_v1_warehouse_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_stocklet_events_v1_warehouse_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_stocklet_events_v1_warehouse_proto_goTypes = []interface{}{
(StockReservationEvent_Type)(0), // 0: stocklet.events.v1.StockReservationEvent.Type
(*StockCreatedEvent)(nil), // 1: stocklet.events.v1.StockCreatedEvent
(*StockAddedEvent)(nil), // 2: stocklet.events.v1.StockAddedEvent
(*StockRemovedEvent)(nil), // 3: stocklet.events.v1.StockRemovedEvent
(*StockReservationEvent)(nil), // 4: stocklet.events.v1.StockReservationEvent
(*StockReservationEvent_OrderMetadata)(nil), // 5: stocklet.events.v1.StockReservationEvent.OrderMetadata
nil, // 6: stocklet.events.v1.StockReservationEvent.ReservationStockEntry
}
var file_stocklet_events_v1_warehouse_proto_depIdxs = []int32{
0, // 0: stocklet.events.v1.StockReservationEvent.type:type_name -> stocklet.events.v1.StockReservationEvent.Type
5, // 1: stocklet.events.v1.StockReservationEvent.order_metadata:type_name -> stocklet.events.v1.StockReservationEvent.OrderMetadata
6, // 2: stocklet.events.v1.StockReservationEvent.reservation_stock:type_name -> stocklet.events.v1.StockReservationEvent.ReservationStockEntry
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_stocklet_events_v1_warehouse_proto_init() }
func file_stocklet_events_v1_warehouse_proto_init() {
if File_stocklet_events_v1_warehouse_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_events_v1_warehouse_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StockCreatedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_warehouse_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StockAddedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_warehouse_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StockRemovedEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_warehouse_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StockReservationEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_events_v1_warehouse_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StockReservationEvent_OrderMetadata); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_stocklet_events_v1_warehouse_proto_msgTypes[1].OneofWrappers = []interface{}{}
file_stocklet_events_v1_warehouse_proto_msgTypes[2].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_events_v1_warehouse_proto_rawDesc,
NumEnums: 1,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_events_v1_warehouse_proto_goTypes,
DependencyIndexes: file_stocklet_events_v1_warehouse_proto_depIdxs,
EnumInfos: file_stocklet_events_v1_warehouse_proto_enumTypes,
MessageInfos: file_stocklet_events_v1_warehouse_proto_msgTypes,
}.Build()
File_stocklet_events_v1_warehouse_proto = out.File
file_stocklet_events_v1_warehouse_proto_rawDesc = nil
file_stocklet_events_v1_warehouse_proto_goTypes = nil
file_stocklet_events_v1_warehouse_proto_depIdxs = nil
}

View File

@@ -0,0 +1,753 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/order/v1/service.proto
package order_v1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
v11 "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1"
_ "google.golang.org/genproto/googleapis/api/annotations"
_ "google.golang.org/genproto/googleapis/api/visibility"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ViewOrderRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
OrderId string `protobuf:"bytes,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
}
func (x *ViewOrderRequest) Reset() {
*x = ViewOrderRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_order_v1_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewOrderRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewOrderRequest) ProtoMessage() {}
func (x *ViewOrderRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_order_v1_service_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewOrderRequest.ProtoReflect.Descriptor instead.
func (*ViewOrderRequest) Descriptor() ([]byte, []int) {
return file_stocklet_order_v1_service_proto_rawDescGZIP(), []int{0}
}
func (x *ViewOrderRequest) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
type ViewOrderResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Order *Order `protobuf:"bytes,1,opt,name=order,proto3" json:"order,omitempty"`
}
func (x *ViewOrderResponse) Reset() {
*x = ViewOrderResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_order_v1_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewOrderResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewOrderResponse) ProtoMessage() {}
func (x *ViewOrderResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_order_v1_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewOrderResponse.ProtoReflect.Descriptor instead.
func (*ViewOrderResponse) Descriptor() ([]byte, []int) {
return file_stocklet_order_v1_service_proto_rawDescGZIP(), []int{1}
}
func (x *ViewOrderResponse) GetOrder() *Order {
if x != nil {
return x.Order
}
return nil
}
type ViewOrdersRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CustomerId string `protobuf:"bytes,1,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
}
func (x *ViewOrdersRequest) Reset() {
*x = ViewOrdersRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_order_v1_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewOrdersRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewOrdersRequest) ProtoMessage() {}
func (x *ViewOrdersRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_order_v1_service_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewOrdersRequest.ProtoReflect.Descriptor instead.
func (*ViewOrdersRequest) Descriptor() ([]byte, []int) {
return file_stocklet_order_v1_service_proto_rawDescGZIP(), []int{2}
}
func (x *ViewOrdersRequest) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
type ViewOrdersResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Orders []*Order `protobuf:"bytes,1,rep,name=orders,proto3" json:"orders,omitempty"`
}
func (x *ViewOrdersResponse) Reset() {
*x = ViewOrdersResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_order_v1_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewOrdersResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewOrdersResponse) ProtoMessage() {}
func (x *ViewOrdersResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_order_v1_service_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewOrdersResponse.ProtoReflect.Descriptor instead.
func (*ViewOrdersResponse) Descriptor() ([]byte, []int) {
return file_stocklet_order_v1_service_proto_rawDescGZIP(), []int{3}
}
func (x *ViewOrdersResponse) GetOrders() []*Order {
if x != nil {
return x.Orders
}
return nil
}
type GetOrderItemsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (x *GetOrderItemsRequest) Reset() {
*x = GetOrderItemsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_order_v1_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetOrderItemsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetOrderItemsRequest) ProtoMessage() {}
func (x *GetOrderItemsRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_order_v1_service_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetOrderItemsRequest.ProtoReflect.Descriptor instead.
func (*GetOrderItemsRequest) Descriptor() ([]byte, []int) {
return file_stocklet_order_v1_service_proto_rawDescGZIP(), []int{4}
}
func (x *GetOrderItemsRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
type GetOrderItemsResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Items map[string]int32 `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
}
func (x *GetOrderItemsResponse) Reset() {
*x = GetOrderItemsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_order_v1_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetOrderItemsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetOrderItemsResponse) ProtoMessage() {}
func (x *GetOrderItemsResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_order_v1_service_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetOrderItemsResponse.ProtoReflect.Descriptor instead.
func (*GetOrderItemsResponse) Descriptor() ([]byte, []int) {
return file_stocklet_order_v1_service_proto_rawDescGZIP(), []int{5}
}
func (x *GetOrderItemsResponse) GetItems() map[string]int32 {
if x != nil {
return x.Items
}
return nil
}
type PlaceOrderRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Cart map[string]int32 `protobuf:"bytes,1,rep,name=cart,proto3" json:"cart,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
CustomerId string `protobuf:"bytes,2,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
}
func (x *PlaceOrderRequest) Reset() {
*x = PlaceOrderRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_order_v1_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PlaceOrderRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PlaceOrderRequest) ProtoMessage() {}
func (x *PlaceOrderRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_order_v1_service_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PlaceOrderRequest.ProtoReflect.Descriptor instead.
func (*PlaceOrderRequest) Descriptor() ([]byte, []int) {
return file_stocklet_order_v1_service_proto_rawDescGZIP(), []int{6}
}
func (x *PlaceOrderRequest) GetCart() map[string]int32 {
if x != nil {
return x.Cart
}
return nil
}
func (x *PlaceOrderRequest) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
type PlaceOrderResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Order *Order `protobuf:"bytes,1,opt,name=order,proto3" json:"order,omitempty"`
}
func (x *PlaceOrderResponse) Reset() {
*x = PlaceOrderResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_order_v1_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PlaceOrderResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PlaceOrderResponse) ProtoMessage() {}
func (x *PlaceOrderResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_order_v1_service_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PlaceOrderResponse.ProtoReflect.Descriptor instead.
func (*PlaceOrderResponse) Descriptor() ([]byte, []int) {
return file_stocklet_order_v1_service_proto_rawDescGZIP(), []int{7}
}
func (x *PlaceOrderResponse) GetOrder() *Order {
if x != nil {
return x.Order
}
return nil
}
var File_stocklet_order_v1_service_proto protoreflect.FileDescriptor
var file_stocklet_order_v1_service_proto_rawDesc = []byte{
0x0a, 0x1f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72,
0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x11, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x6f, 0x72, 0x64, 0x65,
0x72, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61,
0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e,
0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x69, 0x73, 0x69,
0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d,
0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x73, 0x74,
0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31,
0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f,
0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x21, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76,
0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65,
0x74, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x36, 0x0a, 0x10, 0x56, 0x69, 0x65, 0x77, 0x4f, 0x72,
0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x08, 0x6f, 0x72,
0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48,
0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x22, 0x43,
0x0a, 0x11, 0x56, 0x69, 0x65, 0x77, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x6f, 0x72,
0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72,
0x64, 0x65, 0x72, 0x22, 0x3d, 0x0a, 0x11, 0x56, 0x69, 0x65, 0x77, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74,
0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba,
0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72,
0x49, 0x64, 0x22, 0x46, 0x0a, 0x12, 0x56, 0x69, 0x65, 0x77, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x6f, 0x72, 0x64, 0x65,
0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x72, 0x64,
0x65, 0x72, 0x52, 0x06, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x22, 0x2f, 0x0a, 0x14, 0x47, 0x65,
0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07,
0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x02, 0x69, 0x64, 0x22, 0xaa, 0x01, 0x0a, 0x15,
0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e,
0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65,
0x72, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49,
0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x0c, 0xba, 0x48, 0x09, 0x9a, 0x01,
0x06, 0x2a, 0x04, 0x1a, 0x02, 0x20, 0x00, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x38,
0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xbf, 0x01, 0x0a, 0x11, 0x50, 0x6c, 0x61,
0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x50,
0x0a, 0x04, 0x63, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x73,
0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31,
0x2e, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x2e, 0x43, 0x61, 0x72, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x0c, 0xba, 0x48,
0x09, 0x9a, 0x01, 0x06, 0x2a, 0x04, 0x1a, 0x02, 0x20, 0x00, 0x52, 0x04, 0x63, 0x61, 0x72, 0x74,
0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49,
0x64, 0x1a, 0x37, 0x0a, 0x09, 0x43, 0x61, 0x72, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79,
0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x44, 0x0a, 0x12, 0x50, 0x6c,
0x61, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x2e, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x18, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72,
0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72,
0x32, 0xcd, 0x07, 0x0a, 0x0c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x79, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f,
0x12, 0x26, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66,
0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x6f,
0x72, 0x64, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7b, 0x0a, 0x09,
0x56, 0x69, 0x65, 0x77, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x73, 0x74, 0x6f, 0x63,
0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69,
0x65, 0x77, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24,
0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e,
0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x76,
0x31, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x2f, 0x7b,
0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x71, 0x0a, 0x0a, 0x56, 0x69, 0x65,
0x77, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x12, 0x24, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c,
0x65, 0x74, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77,
0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x76,
0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x76,
0x31, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x78, 0x0a, 0x0a,
0x50, 0x6c, 0x61, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x24, 0x2e, 0x73, 0x74, 0x6f,
0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x50,
0x6c, 0x61, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x25, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x6f, 0x72, 0x64, 0x65,
0x72, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x3a,
0x04, 0x63, 0x61, 0x72, 0x74, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72,
0x2f, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x12, 0x75, 0x0a, 0x1d, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73,
0x73, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x51, 0x75, 0x6f,
0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x2a, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c,
0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f,
0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x45, 0x76,
0x65, 0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x10, 0xfa, 0xd2, 0xe4,
0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x12, 0x73, 0x0a,
0x1c, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73,
0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x2e,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e,
0x76, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
0x22, 0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e,
0x41, 0x4c, 0x12, 0x77, 0x0a, 0x1e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x68, 0x69,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45,
0x76, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e,
0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65,
0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e,
0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02,
0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x12, 0x73, 0x0a, 0x1c, 0x50,
0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f,
0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x2e, 0x73, 0x74,
0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31,
0x2e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65,
0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x10,
0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c,
0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68,
0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f,
0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x6f,
0x72, 0x64, 0x65, 0x72, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_order_v1_service_proto_rawDescOnce sync.Once
file_stocklet_order_v1_service_proto_rawDescData = file_stocklet_order_v1_service_proto_rawDesc
)
func file_stocklet_order_v1_service_proto_rawDescGZIP() []byte {
file_stocklet_order_v1_service_proto_rawDescOnce.Do(func() {
file_stocklet_order_v1_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_order_v1_service_proto_rawDescData)
})
return file_stocklet_order_v1_service_proto_rawDescData
}
var file_stocklet_order_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_stocklet_order_v1_service_proto_goTypes = []interface{}{
(*ViewOrderRequest)(nil), // 0: stocklet.order.v1.ViewOrderRequest
(*ViewOrderResponse)(nil), // 1: stocklet.order.v1.ViewOrderResponse
(*ViewOrdersRequest)(nil), // 2: stocklet.order.v1.ViewOrdersRequest
(*ViewOrdersResponse)(nil), // 3: stocklet.order.v1.ViewOrdersResponse
(*GetOrderItemsRequest)(nil), // 4: stocklet.order.v1.GetOrderItemsRequest
(*GetOrderItemsResponse)(nil), // 5: stocklet.order.v1.GetOrderItemsResponse
(*PlaceOrderRequest)(nil), // 6: stocklet.order.v1.PlaceOrderRequest
(*PlaceOrderResponse)(nil), // 7: stocklet.order.v1.PlaceOrderResponse
nil, // 8: stocklet.order.v1.GetOrderItemsResponse.ItemsEntry
nil, // 9: stocklet.order.v1.PlaceOrderRequest.CartEntry
(*Order)(nil), // 10: stocklet.order.v1.Order
(*v1.ServiceInfoRequest)(nil), // 11: stocklet.common.v1.ServiceInfoRequest
(*v11.ProductPriceQuoteEvent)(nil), // 12: stocklet.events.v1.ProductPriceQuoteEvent
(*v11.StockReservationEvent)(nil), // 13: stocklet.events.v1.StockReservationEvent
(*v11.ShipmentAllocationEvent)(nil), // 14: stocklet.events.v1.ShipmentAllocationEvent
(*v11.PaymentProcessedEvent)(nil), // 15: stocklet.events.v1.PaymentProcessedEvent
(*v1.ServiceInfoResponse)(nil), // 16: stocklet.common.v1.ServiceInfoResponse
(*emptypb.Empty)(nil), // 17: google.protobuf.Empty
}
var file_stocklet_order_v1_service_proto_depIdxs = []int32{
10, // 0: stocklet.order.v1.ViewOrderResponse.order:type_name -> stocklet.order.v1.Order
10, // 1: stocklet.order.v1.ViewOrdersResponse.orders:type_name -> stocklet.order.v1.Order
8, // 2: stocklet.order.v1.GetOrderItemsResponse.items:type_name -> stocklet.order.v1.GetOrderItemsResponse.ItemsEntry
9, // 3: stocklet.order.v1.PlaceOrderRequest.cart:type_name -> stocklet.order.v1.PlaceOrderRequest.CartEntry
10, // 4: stocklet.order.v1.PlaceOrderResponse.order:type_name -> stocklet.order.v1.Order
11, // 5: stocklet.order.v1.OrderService.ServiceInfo:input_type -> stocklet.common.v1.ServiceInfoRequest
0, // 6: stocklet.order.v1.OrderService.ViewOrder:input_type -> stocklet.order.v1.ViewOrderRequest
2, // 7: stocklet.order.v1.OrderService.ViewOrders:input_type -> stocklet.order.v1.ViewOrdersRequest
6, // 8: stocklet.order.v1.OrderService.PlaceOrder:input_type -> stocklet.order.v1.PlaceOrderRequest
12, // 9: stocklet.order.v1.OrderService.ProcessProductPriceQuoteEvent:input_type -> stocklet.events.v1.ProductPriceQuoteEvent
13, // 10: stocklet.order.v1.OrderService.ProcessStockReservationEvent:input_type -> stocklet.events.v1.StockReservationEvent
14, // 11: stocklet.order.v1.OrderService.ProcessShipmentAllocationEvent:input_type -> stocklet.events.v1.ShipmentAllocationEvent
15, // 12: stocklet.order.v1.OrderService.ProcessPaymentProcessedEvent:input_type -> stocklet.events.v1.PaymentProcessedEvent
16, // 13: stocklet.order.v1.OrderService.ServiceInfo:output_type -> stocklet.common.v1.ServiceInfoResponse
1, // 14: stocklet.order.v1.OrderService.ViewOrder:output_type -> stocklet.order.v1.ViewOrderResponse
3, // 15: stocklet.order.v1.OrderService.ViewOrders:output_type -> stocklet.order.v1.ViewOrdersResponse
7, // 16: stocklet.order.v1.OrderService.PlaceOrder:output_type -> stocklet.order.v1.PlaceOrderResponse
17, // 17: stocklet.order.v1.OrderService.ProcessProductPriceQuoteEvent:output_type -> google.protobuf.Empty
17, // 18: stocklet.order.v1.OrderService.ProcessStockReservationEvent:output_type -> google.protobuf.Empty
17, // 19: stocklet.order.v1.OrderService.ProcessShipmentAllocationEvent:output_type -> google.protobuf.Empty
17, // 20: stocklet.order.v1.OrderService.ProcessPaymentProcessedEvent:output_type -> google.protobuf.Empty
13, // [13:21] is the sub-list for method output_type
5, // [5:13] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_stocklet_order_v1_service_proto_init() }
func file_stocklet_order_v1_service_proto_init() {
if File_stocklet_order_v1_service_proto != nil {
return
}
file_stocklet_order_v1_types_proto_init()
if !protoimpl.UnsafeEnabled {
file_stocklet_order_v1_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewOrderRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_order_v1_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewOrderResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_order_v1_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewOrdersRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_order_v1_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewOrdersResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_order_v1_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetOrderItemsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_order_v1_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetOrderItemsResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_order_v1_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PlaceOrderRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_order_v1_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PlaceOrderResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_order_v1_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 10,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_stocklet_order_v1_service_proto_goTypes,
DependencyIndexes: file_stocklet_order_v1_service_proto_depIdxs,
MessageInfos: file_stocklet_order_v1_service_proto_msgTypes,
}.Build()
File_stocklet_order_v1_service_proto = out.File
file_stocklet_order_v1_service_proto_rawDesc = nil
file_stocklet_order_v1_service_proto_goTypes = nil
file_stocklet_order_v1_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,449 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: stocklet/order/v1/service.proto
/*
Package order_v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package order_v1
import (
"context"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = metadata.Join
func request_OrderService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, client OrderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := client.ServiceInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_OrderService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, server OrderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := server.ServiceInfo(ctx, &protoReq)
return msg, metadata, err
}
func request_OrderService_ViewOrder_0(ctx context.Context, marshaler runtime.Marshaler, client OrderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewOrderRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["order_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "order_id")
}
protoReq.OrderId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "order_id", err)
}
msg, err := client.ViewOrder(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_OrderService_ViewOrder_0(ctx context.Context, marshaler runtime.Marshaler, server OrderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewOrderRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["order_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "order_id")
}
protoReq.OrderId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "order_id", err)
}
msg, err := server.ViewOrder(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_OrderService_ViewOrders_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_OrderService_ViewOrders_0(ctx context.Context, marshaler runtime.Marshaler, client OrderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewOrdersRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_OrderService_ViewOrders_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ViewOrders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_OrderService_ViewOrders_0(ctx context.Context, marshaler runtime.Marshaler, server OrderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewOrdersRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_OrderService_ViewOrders_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ViewOrders(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_OrderService_PlaceOrder_0 = &utilities.DoubleArray{Encoding: map[string]int{"cart": 0}, Base: []int{1, 2, 0, 0}, Check: []int{0, 1, 2, 2}}
)
func request_OrderService_PlaceOrder_0(ctx context.Context, marshaler runtime.Marshaler, client OrderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq PlaceOrderRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Cart); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_OrderService_PlaceOrder_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.PlaceOrder(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_OrderService_PlaceOrder_0(ctx context.Context, marshaler runtime.Marshaler, server OrderServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq PlaceOrderRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Cart); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_OrderService_PlaceOrder_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.PlaceOrder(ctx, &protoReq)
return msg, metadata, err
}
// RegisterOrderServiceHandlerServer registers the http handlers for service OrderService to "mux".
// UnaryRPC :call OrderServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterOrderServiceHandlerFromEndpoint instead.
func RegisterOrderServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OrderServiceServer) error {
mux.Handle("GET", pattern_OrderService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.order.v1.OrderService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/order/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_OrderService_ServiceInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_OrderService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_OrderService_ViewOrder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.order.v1.OrderService/ViewOrder", runtime.WithHTTPPathPattern("/v1/order/orders/{order_id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_OrderService_ViewOrder_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_OrderService_ViewOrder_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_OrderService_ViewOrders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.order.v1.OrderService/ViewOrders", runtime.WithHTTPPathPattern("/v1/order/list"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_OrderService_ViewOrders_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_OrderService_ViewOrders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_OrderService_PlaceOrder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.order.v1.OrderService/PlaceOrder", runtime.WithHTTPPathPattern("/v1/order/place"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_OrderService_PlaceOrder_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_OrderService_PlaceOrder_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterOrderServiceHandlerFromEndpoint is same as RegisterOrderServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterOrderServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.DialContext(ctx, endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterOrderServiceHandler(ctx, mux, conn)
}
// RegisterOrderServiceHandler registers the http handlers for service OrderService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterOrderServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOrderServiceHandlerClient(ctx, mux, NewOrderServiceClient(conn))
}
// RegisterOrderServiceHandlerClient registers the http handlers for service OrderService
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "OrderServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "OrderServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "OrderServiceClient" to call the correct interceptors.
func RegisterOrderServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OrderServiceClient) error {
mux.Handle("GET", pattern_OrderService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.order.v1.OrderService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/order/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_OrderService_ServiceInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_OrderService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_OrderService_ViewOrder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.order.v1.OrderService/ViewOrder", runtime.WithHTTPPathPattern("/v1/order/orders/{order_id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_OrderService_ViewOrder_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_OrderService_ViewOrder_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_OrderService_ViewOrders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.order.v1.OrderService/ViewOrders", runtime.WithHTTPPathPattern("/v1/order/list"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_OrderService_ViewOrders_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_OrderService_ViewOrders_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_OrderService_PlaceOrder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.order.v1.OrderService/PlaceOrder", runtime.WithHTTPPathPattern("/v1/order/place"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_OrderService_PlaceOrder_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_OrderService_PlaceOrder_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_OrderService_ServiceInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "order", "service"}, ""))
pattern_OrderService_ViewOrder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "order", "orders", "order_id"}, ""))
pattern_OrderService_ViewOrders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "order", "list"}, ""))
pattern_OrderService_PlaceOrder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "order", "place"}, ""))
)
var (
forward_OrderService_ServiceInfo_0 = runtime.ForwardResponseMessage
forward_OrderService_ViewOrder_0 = runtime.ForwardResponseMessage
forward_OrderService_ViewOrders_0 = runtime.ForwardResponseMessage
forward_OrderService_PlaceOrder_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,436 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: stocklet/order/v1/service.proto
package order_v1
import (
context "context"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
v11 "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
OrderService_ServiceInfo_FullMethodName = "/stocklet.order.v1.OrderService/ServiceInfo"
OrderService_ViewOrder_FullMethodName = "/stocklet.order.v1.OrderService/ViewOrder"
OrderService_ViewOrders_FullMethodName = "/stocklet.order.v1.OrderService/ViewOrders"
OrderService_PlaceOrder_FullMethodName = "/stocklet.order.v1.OrderService/PlaceOrder"
OrderService_ProcessProductPriceQuoteEvent_FullMethodName = "/stocklet.order.v1.OrderService/ProcessProductPriceQuoteEvent"
OrderService_ProcessStockReservationEvent_FullMethodName = "/stocklet.order.v1.OrderService/ProcessStockReservationEvent"
OrderService_ProcessShipmentAllocationEvent_FullMethodName = "/stocklet.order.v1.OrderService/ProcessShipmentAllocationEvent"
OrderService_ProcessPaymentProcessedEvent_FullMethodName = "/stocklet.order.v1.OrderService/ProcessPaymentProcessedEvent"
)
// OrderServiceClient is the client API for OrderService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type OrderServiceClient interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error)
ViewOrder(ctx context.Context, in *ViewOrderRequest, opts ...grpc.CallOption) (*ViewOrderResponse, error)
// Get a list of a customer's orders.
// If accessed through the gateway - shows the current user's orders.
ViewOrders(ctx context.Context, in *ViewOrdersRequest, opts ...grpc.CallOption) (*ViewOrdersResponse, error)
PlaceOrder(ctx context.Context, in *PlaceOrderRequest, opts ...grpc.CallOption) (*PlaceOrderResponse, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessProductPriceQuoteEvent(ctx context.Context, in *v11.ProductPriceQuoteEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessStockReservationEvent(ctx context.Context, in *v11.StockReservationEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessShipmentAllocationEvent(ctx context.Context, in *v11.ShipmentAllocationEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessPaymentProcessedEvent(ctx context.Context, in *v11.PaymentProcessedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type orderServiceClient struct {
cc grpc.ClientConnInterface
}
func NewOrderServiceClient(cc grpc.ClientConnInterface) OrderServiceClient {
return &orderServiceClient{cc}
}
func (c *orderServiceClient) ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error) {
out := new(v1.ServiceInfoResponse)
err := c.cc.Invoke(ctx, OrderService_ServiceInfo_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *orderServiceClient) ViewOrder(ctx context.Context, in *ViewOrderRequest, opts ...grpc.CallOption) (*ViewOrderResponse, error) {
out := new(ViewOrderResponse)
err := c.cc.Invoke(ctx, OrderService_ViewOrder_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *orderServiceClient) ViewOrders(ctx context.Context, in *ViewOrdersRequest, opts ...grpc.CallOption) (*ViewOrdersResponse, error) {
out := new(ViewOrdersResponse)
err := c.cc.Invoke(ctx, OrderService_ViewOrders_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *orderServiceClient) PlaceOrder(ctx context.Context, in *PlaceOrderRequest, opts ...grpc.CallOption) (*PlaceOrderResponse, error) {
out := new(PlaceOrderResponse)
err := c.cc.Invoke(ctx, OrderService_PlaceOrder_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *orderServiceClient) ProcessProductPriceQuoteEvent(ctx context.Context, in *v11.ProductPriceQuoteEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, OrderService_ProcessProductPriceQuoteEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *orderServiceClient) ProcessStockReservationEvent(ctx context.Context, in *v11.StockReservationEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, OrderService_ProcessStockReservationEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *orderServiceClient) ProcessShipmentAllocationEvent(ctx context.Context, in *v11.ShipmentAllocationEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, OrderService_ProcessShipmentAllocationEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *orderServiceClient) ProcessPaymentProcessedEvent(ctx context.Context, in *v11.PaymentProcessedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, OrderService_ProcessPaymentProcessedEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// OrderServiceServer is the server API for OrderService service.
// All implementations must embed UnimplementedOrderServiceServer
// for forward compatibility
type OrderServiceServer interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error)
ViewOrder(context.Context, *ViewOrderRequest) (*ViewOrderResponse, error)
// Get a list of a customer's orders.
// If accessed through the gateway - shows the current user's orders.
ViewOrders(context.Context, *ViewOrdersRequest) (*ViewOrdersResponse, error)
PlaceOrder(context.Context, *PlaceOrderRequest) (*PlaceOrderResponse, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessProductPriceQuoteEvent(context.Context, *v11.ProductPriceQuoteEvent) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessStockReservationEvent(context.Context, *v11.StockReservationEvent) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessShipmentAllocationEvent(context.Context, *v11.ShipmentAllocationEvent) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessPaymentProcessedEvent(context.Context, *v11.PaymentProcessedEvent) (*emptypb.Empty, error)
mustEmbedUnimplementedOrderServiceServer()
}
// UnimplementedOrderServiceServer must be embedded to have forward compatible implementations.
type UnimplementedOrderServiceServer struct {
}
func (UnimplementedOrderServiceServer) ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ServiceInfo not implemented")
}
func (UnimplementedOrderServiceServer) ViewOrder(context.Context, *ViewOrderRequest) (*ViewOrderResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ViewOrder not implemented")
}
func (UnimplementedOrderServiceServer) ViewOrders(context.Context, *ViewOrdersRequest) (*ViewOrdersResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ViewOrders not implemented")
}
func (UnimplementedOrderServiceServer) PlaceOrder(context.Context, *PlaceOrderRequest) (*PlaceOrderResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PlaceOrder not implemented")
}
func (UnimplementedOrderServiceServer) ProcessProductPriceQuoteEvent(context.Context, *v11.ProductPriceQuoteEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessProductPriceQuoteEvent not implemented")
}
func (UnimplementedOrderServiceServer) ProcessStockReservationEvent(context.Context, *v11.StockReservationEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessStockReservationEvent not implemented")
}
func (UnimplementedOrderServiceServer) ProcessShipmentAllocationEvent(context.Context, *v11.ShipmentAllocationEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessShipmentAllocationEvent not implemented")
}
func (UnimplementedOrderServiceServer) ProcessPaymentProcessedEvent(context.Context, *v11.PaymentProcessedEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessPaymentProcessedEvent not implemented")
}
func (UnimplementedOrderServiceServer) mustEmbedUnimplementedOrderServiceServer() {}
// UnsafeOrderServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to OrderServiceServer will
// result in compilation errors.
type UnsafeOrderServiceServer interface {
mustEmbedUnimplementedOrderServiceServer()
}
func RegisterOrderServiceServer(s grpc.ServiceRegistrar, srv OrderServiceServer) {
s.RegisterService(&OrderService_ServiceDesc, srv)
}
func _OrderService_ServiceInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v1.ServiceInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OrderServiceServer).ServiceInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: OrderService_ServiceInfo_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OrderServiceServer).ServiceInfo(ctx, req.(*v1.ServiceInfoRequest))
}
return interceptor(ctx, in, info, handler)
}
func _OrderService_ViewOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ViewOrderRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OrderServiceServer).ViewOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: OrderService_ViewOrder_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OrderServiceServer).ViewOrder(ctx, req.(*ViewOrderRequest))
}
return interceptor(ctx, in, info, handler)
}
func _OrderService_ViewOrders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ViewOrdersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OrderServiceServer).ViewOrders(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: OrderService_ViewOrders_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OrderServiceServer).ViewOrders(ctx, req.(*ViewOrdersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _OrderService_PlaceOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PlaceOrderRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OrderServiceServer).PlaceOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: OrderService_PlaceOrder_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OrderServiceServer).PlaceOrder(ctx, req.(*PlaceOrderRequest))
}
return interceptor(ctx, in, info, handler)
}
func _OrderService_ProcessProductPriceQuoteEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.ProductPriceQuoteEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OrderServiceServer).ProcessProductPriceQuoteEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: OrderService_ProcessProductPriceQuoteEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OrderServiceServer).ProcessProductPriceQuoteEvent(ctx, req.(*v11.ProductPriceQuoteEvent))
}
return interceptor(ctx, in, info, handler)
}
func _OrderService_ProcessStockReservationEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.StockReservationEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OrderServiceServer).ProcessStockReservationEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: OrderService_ProcessStockReservationEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OrderServiceServer).ProcessStockReservationEvent(ctx, req.(*v11.StockReservationEvent))
}
return interceptor(ctx, in, info, handler)
}
func _OrderService_ProcessShipmentAllocationEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.ShipmentAllocationEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OrderServiceServer).ProcessShipmentAllocationEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: OrderService_ProcessShipmentAllocationEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OrderServiceServer).ProcessShipmentAllocationEvent(ctx, req.(*v11.ShipmentAllocationEvent))
}
return interceptor(ctx, in, info, handler)
}
func _OrderService_ProcessPaymentProcessedEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.PaymentProcessedEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OrderServiceServer).ProcessPaymentProcessedEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: OrderService_ProcessPaymentProcessedEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OrderServiceServer).ProcessPaymentProcessedEvent(ctx, req.(*v11.PaymentProcessedEvent))
}
return interceptor(ctx, in, info, handler)
}
// OrderService_ServiceDesc is the grpc.ServiceDesc for OrderService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var OrderService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "stocklet.order.v1.OrderService",
HandlerType: (*OrderServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ServiceInfo",
Handler: _OrderService_ServiceInfo_Handler,
},
{
MethodName: "ViewOrder",
Handler: _OrderService_ViewOrder_Handler,
},
{
MethodName: "ViewOrders",
Handler: _OrderService_ViewOrders_Handler,
},
{
MethodName: "PlaceOrder",
Handler: _OrderService_PlaceOrder_Handler,
},
{
MethodName: "ProcessProductPriceQuoteEvent",
Handler: _OrderService_ProcessProductPriceQuoteEvent_Handler,
},
{
MethodName: "ProcessStockReservationEvent",
Handler: _OrderService_ProcessStockReservationEvent_Handler,
},
{
MethodName: "ProcessShipmentAllocationEvent",
Handler: _OrderService_ProcessShipmentAllocationEvent_Handler,
},
{
MethodName: "ProcessPaymentProcessedEvent",
Handler: _OrderService_ProcessPaymentProcessedEvent_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "stocklet/order/v1/service.proto",
}

View File

@@ -0,0 +1,327 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/order/v1/types.proto
package order_v1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type OrderStatus int32
const (
OrderStatus_ORDER_STATUS_UNSPECIFIED OrderStatus = 0
OrderStatus_ORDER_STATUS_PROCESSING OrderStatus = 1 // awaiting price quotes for products
OrderStatus_ORDER_STATUS_PENDING OrderStatus = 2 // awaiting stock allocation, shipping allotment and payment
OrderStatus_ORDER_STATUS_REJECTED OrderStatus = 3
OrderStatus_ORDER_STATUS_APPROVED OrderStatus = 4
OrderStatus_ORDER_STATUS_COMPLETED OrderStatus = 5
)
// Enum value maps for OrderStatus.
var (
OrderStatus_name = map[int32]string{
0: "ORDER_STATUS_UNSPECIFIED",
1: "ORDER_STATUS_PROCESSING",
2: "ORDER_STATUS_PENDING",
3: "ORDER_STATUS_REJECTED",
4: "ORDER_STATUS_APPROVED",
5: "ORDER_STATUS_COMPLETED",
}
OrderStatus_value = map[string]int32{
"ORDER_STATUS_UNSPECIFIED": 0,
"ORDER_STATUS_PROCESSING": 1,
"ORDER_STATUS_PENDING": 2,
"ORDER_STATUS_REJECTED": 3,
"ORDER_STATUS_APPROVED": 4,
"ORDER_STATUS_COMPLETED": 5,
}
)
func (x OrderStatus) Enum() *OrderStatus {
p := new(OrderStatus)
*p = x
return p
}
func (x OrderStatus) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (OrderStatus) Descriptor() protoreflect.EnumDescriptor {
return file_stocklet_order_v1_types_proto_enumTypes[0].Descriptor()
}
func (OrderStatus) Type() protoreflect.EnumType {
return &file_stocklet_order_v1_types_proto_enumTypes[0]
}
func (x OrderStatus) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use OrderStatus.Descriptor instead.
func (OrderStatus) EnumDescriptor() ([]byte, []int) {
return file_stocklet_order_v1_types_proto_rawDescGZIP(), []int{0}
}
type Order struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Status OrderStatus `protobuf:"varint,2,opt,name=status,proto3,enum=stocklet.order.v1.OrderStatus" json:"status,omitempty"`
// 'items' consists of a mapping of Product ID to Quantity.
Items map[string]int32 `protobuf:"bytes,3,rep,name=items,proto3" json:"items,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
CustomerId string `protobuf:"bytes,4,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
TransactionId *string `protobuf:"bytes,5,opt,name=transaction_id,json=transactionId,proto3,oneof" json:"transaction_id,omitempty"`
ShippingId *string `protobuf:"bytes,6,opt,name=shipping_id,json=shippingId,proto3,oneof" json:"shipping_id,omitempty"`
CreatedAt int64 `protobuf:"varint,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
UpdatedAt *int64 `protobuf:"varint,8,opt,name=updated_at,json=updatedAt,proto3,oneof" json:"updated_at,omitempty"`
}
func (x *Order) Reset() {
*x = Order{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_order_v1_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Order) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Order) ProtoMessage() {}
func (x *Order) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_order_v1_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Order.ProtoReflect.Descriptor instead.
func (*Order) Descriptor() ([]byte, []int) {
return file_stocklet_order_v1_types_proto_rawDescGZIP(), []int{0}
}
func (x *Order) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *Order) GetStatus() OrderStatus {
if x != nil {
return x.Status
}
return OrderStatus_ORDER_STATUS_UNSPECIFIED
}
func (x *Order) GetItems() map[string]int32 {
if x != nil {
return x.Items
}
return nil
}
func (x *Order) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
func (x *Order) GetTransactionId() string {
if x != nil && x.TransactionId != nil {
return *x.TransactionId
}
return ""
}
func (x *Order) GetShippingId() string {
if x != nil && x.ShippingId != nil {
return *x.ShippingId
}
return ""
}
func (x *Order) GetCreatedAt() int64 {
if x != nil {
return x.CreatedAt
}
return 0
}
func (x *Order) GetUpdatedAt() int64 {
if x != nil && x.UpdatedAt != nil {
return *x.UpdatedAt
}
return 0
}
var File_stocklet_order_v1_types_proto protoreflect.FileDescriptor
var file_stocklet_order_v1_types_proto_rawDesc = []byte{
0x0a, 0x1d, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72,
0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x11, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e,
0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65,
0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0xeb, 0x03, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x02,
0x69, 0x64, 0x12, 0x43, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x6f, 0x72,
0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74,
0x75, 0x73, 0x42, 0x0b, 0xba, 0x48, 0x08, 0x82, 0x01, 0x05, 0x10, 0x01, 0x22, 0x01, 0x00, 0x52,
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x47, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73,
0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65,
0x74, 0x2e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x0c, 0xba, 0x48, 0x09,
0x9a, 0x01, 0x06, 0x2a, 0x04, 0x1a, 0x02, 0x20, 0x00, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73,
0x12, 0x28, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0a,
0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x0e, 0x74, 0x72,
0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01,
0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x0d, 0x74,
0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12,
0x2d, 0x0a, 0x0b, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x06,
0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x48, 0x01, 0x52,
0x0a, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1d,
0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01,
0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x22, 0x0a,
0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28,
0x03, 0x48, 0x02, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x88, 0x01,
0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65,
0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x11, 0x0a, 0x0f, 0x5f,
0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x0e,
0x0a, 0x0c, 0x5f, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x42, 0x0d,
0x0a, 0x0b, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x2a, 0xb4, 0x01,
0x0a, 0x0b, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a,
0x18, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e,
0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x4f,
0x52, 0x44, 0x45, 0x52, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x50, 0x52, 0x4f, 0x43,
0x45, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x4f, 0x52, 0x44, 0x45,
0x52, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47,
0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x5f, 0x53, 0x54, 0x41, 0x54,
0x55, 0x53, 0x5f, 0x52, 0x45, 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x19, 0x0a,
0x15, 0x4f, 0x52, 0x44, 0x45, 0x52, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x41, 0x50,
0x50, 0x52, 0x4f, 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x52, 0x44, 0x45,
0x52, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54,
0x45, 0x44, 0x10, 0x05, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67,
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2f,
0x76, 0x31, 0x3b, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
file_stocklet_order_v1_types_proto_rawDescOnce sync.Once
file_stocklet_order_v1_types_proto_rawDescData = file_stocklet_order_v1_types_proto_rawDesc
)
func file_stocklet_order_v1_types_proto_rawDescGZIP() []byte {
file_stocklet_order_v1_types_proto_rawDescOnce.Do(func() {
file_stocklet_order_v1_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_order_v1_types_proto_rawDescData)
})
return file_stocklet_order_v1_types_proto_rawDescData
}
var file_stocklet_order_v1_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_stocklet_order_v1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_stocklet_order_v1_types_proto_goTypes = []interface{}{
(OrderStatus)(0), // 0: stocklet.order.v1.OrderStatus
(*Order)(nil), // 1: stocklet.order.v1.Order
nil, // 2: stocklet.order.v1.Order.ItemsEntry
}
var file_stocklet_order_v1_types_proto_depIdxs = []int32{
0, // 0: stocklet.order.v1.Order.status:type_name -> stocklet.order.v1.OrderStatus
2, // 1: stocklet.order.v1.Order.items:type_name -> stocklet.order.v1.Order.ItemsEntry
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_stocklet_order_v1_types_proto_init() }
func file_stocklet_order_v1_types_proto_init() {
if File_stocklet_order_v1_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_order_v1_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Order); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_stocklet_order_v1_types_proto_msgTypes[0].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_order_v1_types_proto_rawDesc,
NumEnums: 1,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_order_v1_types_proto_goTypes,
DependencyIndexes: file_stocklet_order_v1_types_proto_depIdxs,
EnumInfos: file_stocklet_order_v1_types_proto_enumTypes,
MessageInfos: file_stocklet_order_v1_types_proto_msgTypes,
}.Build()
File_stocklet_order_v1_types_proto = out.File
file_stocklet_order_v1_types_proto_rawDesc = nil
file_stocklet_order_v1_types_proto_goTypes = nil
file_stocklet_order_v1_types_proto_depIdxs = nil
}

View File

@@ -0,0 +1,454 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/payment/v1/service.proto
package payment_v1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
v11 "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1"
_ "google.golang.org/genproto/googleapis/api/annotations"
_ "google.golang.org/genproto/googleapis/api/visibility"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ViewTransactionRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TransactionId string `protobuf:"bytes,1,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"`
}
func (x *ViewTransactionRequest) Reset() {
*x = ViewTransactionRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_payment_v1_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewTransactionRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewTransactionRequest) ProtoMessage() {}
func (x *ViewTransactionRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_payment_v1_service_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewTransactionRequest.ProtoReflect.Descriptor instead.
func (*ViewTransactionRequest) Descriptor() ([]byte, []int) {
return file_stocklet_payment_v1_service_proto_rawDescGZIP(), []int{0}
}
func (x *ViewTransactionRequest) GetTransactionId() string {
if x != nil {
return x.TransactionId
}
return ""
}
type ViewTransactionResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Transaction *Transaction `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"`
}
func (x *ViewTransactionResponse) Reset() {
*x = ViewTransactionResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_payment_v1_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewTransactionResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewTransactionResponse) ProtoMessage() {}
func (x *ViewTransactionResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_payment_v1_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewTransactionResponse.ProtoReflect.Descriptor instead.
func (*ViewTransactionResponse) Descriptor() ([]byte, []int) {
return file_stocklet_payment_v1_service_proto_rawDescGZIP(), []int{1}
}
func (x *ViewTransactionResponse) GetTransaction() *Transaction {
if x != nil {
return x.Transaction
}
return nil
}
type ViewBalanceRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CustomerId string `protobuf:"bytes,1,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
}
func (x *ViewBalanceRequest) Reset() {
*x = ViewBalanceRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_payment_v1_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewBalanceRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewBalanceRequest) ProtoMessage() {}
func (x *ViewBalanceRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_payment_v1_service_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewBalanceRequest.ProtoReflect.Descriptor instead.
func (*ViewBalanceRequest) Descriptor() ([]byte, []int) {
return file_stocklet_payment_v1_service_proto_rawDescGZIP(), []int{2}
}
func (x *ViewBalanceRequest) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
type ViewBalanceResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Balance *CustomerBalance `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"`
}
func (x *ViewBalanceResponse) Reset() {
*x = ViewBalanceResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_payment_v1_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewBalanceResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewBalanceResponse) ProtoMessage() {}
func (x *ViewBalanceResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_payment_v1_service_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewBalanceResponse.ProtoReflect.Descriptor instead.
func (*ViewBalanceResponse) Descriptor() ([]byte, []int) {
return file_stocklet_payment_v1_service_proto_rawDescGZIP(), []int{3}
}
func (x *ViewBalanceResponse) GetBalance() *CustomerBalance {
if x != nil {
return x.Balance
}
return nil
}
var File_stocklet_payment_v1_service_proto protoreflect.FileDescriptor
var file_stocklet_payment_v1_service_proto_rawDesc = []byte{
0x0a, 0x21, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65,
0x6e, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x13, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x70, 0x61,
0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70,
0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x73,
0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76,
0x31, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x21, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76,
0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x1a, 0x1f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x70, 0x61, 0x79,
0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0x48, 0x0a, 0x16, 0x56, 0x69, 0x65, 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73,
0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a,
0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0d,
0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x5d, 0x0a,
0x17, 0x56, 0x69, 0x65, 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0b, 0x74, 0x72, 0x61, 0x6e,
0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74,
0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52,
0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3e, 0x0a, 0x12,
0x56, 0x69, 0x65, 0x77, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x28, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01,
0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x22, 0x55, 0x0a, 0x13,
0x56, 0x69, 0x65, 0x77, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e,
0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f,
0x6d, 0x65, 0x72, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61,
0x6e, 0x63, 0x65, 0x32, 0x8b, 0x06, 0x0a, 0x0e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7b, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74,
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x13,
0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x73, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x12, 0x9e, 0x01, 0x0a, 0x0f, 0x56, 0x69, 0x65, 0x77, 0x54, 0x72, 0x61, 0x6e,
0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c,
0x65, 0x74, 0x2e, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69,
0x65, 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e,
0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x54,
0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x76, 0x31, 0x2f,
0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x2f, 0x7b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x5f, 0x69, 0x64, 0x7d, 0x12, 0x8b, 0x01, 0x0a, 0x0b, 0x56, 0x69, 0x65, 0x77, 0x42, 0x61, 0x6c,
0x61, 0x6e, 0x63, 0x65, 0x12, 0x27, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e,
0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x42,
0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74,
0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x12,
0x21, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x62, 0x61, 0x6c,
0x61, 0x6e, 0x63, 0x65, 0x2f, 0x7b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69,
0x64, 0x7d, 0x12, 0x69, 0x0a, 0x17, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x55, 0x73, 0x65,
0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x24, 0x2e,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e,
0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x76,
0x65, 0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x10, 0xfa, 0xd2, 0xe4,
0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x12, 0x69, 0x0a,
0x17, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65,
0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x24, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73,
0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x16,
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08,
0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x12, 0x77, 0x0a, 0x1e, 0x50, 0x72, 0x6f, 0x63,
0x65, 0x73, 0x73, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x2e, 0x73, 0x74, 0x6f,
0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e,
0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22,
0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41,
0x4c, 0x42, 0x49, 0x5a, 0x47, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74,
0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x76,
0x31, 0x3b, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_payment_v1_service_proto_rawDescOnce sync.Once
file_stocklet_payment_v1_service_proto_rawDescData = file_stocklet_payment_v1_service_proto_rawDesc
)
func file_stocklet_payment_v1_service_proto_rawDescGZIP() []byte {
file_stocklet_payment_v1_service_proto_rawDescOnce.Do(func() {
file_stocklet_payment_v1_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_payment_v1_service_proto_rawDescData)
})
return file_stocklet_payment_v1_service_proto_rawDescData
}
var file_stocklet_payment_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_stocklet_payment_v1_service_proto_goTypes = []interface{}{
(*ViewTransactionRequest)(nil), // 0: stocklet.payment.v1.ViewTransactionRequest
(*ViewTransactionResponse)(nil), // 1: stocklet.payment.v1.ViewTransactionResponse
(*ViewBalanceRequest)(nil), // 2: stocklet.payment.v1.ViewBalanceRequest
(*ViewBalanceResponse)(nil), // 3: stocklet.payment.v1.ViewBalanceResponse
(*Transaction)(nil), // 4: stocklet.payment.v1.Transaction
(*CustomerBalance)(nil), // 5: stocklet.payment.v1.CustomerBalance
(*v1.ServiceInfoRequest)(nil), // 6: stocklet.common.v1.ServiceInfoRequest
(*v11.UserCreatedEvent)(nil), // 7: stocklet.events.v1.UserCreatedEvent
(*v11.UserDeletedEvent)(nil), // 8: stocklet.events.v1.UserDeletedEvent
(*v11.ShipmentAllocationEvent)(nil), // 9: stocklet.events.v1.ShipmentAllocationEvent
(*v1.ServiceInfoResponse)(nil), // 10: stocklet.common.v1.ServiceInfoResponse
(*emptypb.Empty)(nil), // 11: google.protobuf.Empty
}
var file_stocklet_payment_v1_service_proto_depIdxs = []int32{
4, // 0: stocklet.payment.v1.ViewTransactionResponse.transaction:type_name -> stocklet.payment.v1.Transaction
5, // 1: stocklet.payment.v1.ViewBalanceResponse.balance:type_name -> stocklet.payment.v1.CustomerBalance
6, // 2: stocklet.payment.v1.PaymentService.ServiceInfo:input_type -> stocklet.common.v1.ServiceInfoRequest
0, // 3: stocklet.payment.v1.PaymentService.ViewTransaction:input_type -> stocklet.payment.v1.ViewTransactionRequest
2, // 4: stocklet.payment.v1.PaymentService.ViewBalance:input_type -> stocklet.payment.v1.ViewBalanceRequest
7, // 5: stocklet.payment.v1.PaymentService.ProcessUserCreatedEvent:input_type -> stocklet.events.v1.UserCreatedEvent
8, // 6: stocklet.payment.v1.PaymentService.ProcessUserDeletedEvent:input_type -> stocklet.events.v1.UserDeletedEvent
9, // 7: stocklet.payment.v1.PaymentService.ProcessShipmentAllocationEvent:input_type -> stocklet.events.v1.ShipmentAllocationEvent
10, // 8: stocklet.payment.v1.PaymentService.ServiceInfo:output_type -> stocklet.common.v1.ServiceInfoResponse
1, // 9: stocklet.payment.v1.PaymentService.ViewTransaction:output_type -> stocklet.payment.v1.ViewTransactionResponse
3, // 10: stocklet.payment.v1.PaymentService.ViewBalance:output_type -> stocklet.payment.v1.ViewBalanceResponse
11, // 11: stocklet.payment.v1.PaymentService.ProcessUserCreatedEvent:output_type -> google.protobuf.Empty
11, // 12: stocklet.payment.v1.PaymentService.ProcessUserDeletedEvent:output_type -> google.protobuf.Empty
11, // 13: stocklet.payment.v1.PaymentService.ProcessShipmentAllocationEvent:output_type -> google.protobuf.Empty
8, // [8:14] is the sub-list for method output_type
2, // [2:8] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_stocklet_payment_v1_service_proto_init() }
func file_stocklet_payment_v1_service_proto_init() {
if File_stocklet_payment_v1_service_proto != nil {
return
}
file_stocklet_payment_v1_types_proto_init()
if !protoimpl.UnsafeEnabled {
file_stocklet_payment_v1_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewTransactionRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_payment_v1_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewTransactionResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_payment_v1_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewBalanceRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_payment_v1_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewBalanceResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_payment_v1_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_stocklet_payment_v1_service_proto_goTypes,
DependencyIndexes: file_stocklet_payment_v1_service_proto_depIdxs,
MessageInfos: file_stocklet_payment_v1_service_proto_msgTypes,
}.Build()
File_stocklet_payment_v1_service_proto = out.File
file_stocklet_payment_v1_service_proto_rawDesc = nil
file_stocklet_payment_v1_service_proto_goTypes = nil
file_stocklet_payment_v1_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,362 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: stocklet/payment/v1/service.proto
/*
Package payment_v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package payment_v1
import (
"context"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = metadata.Join
func request_PaymentService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, client PaymentServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := client.ServiceInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_PaymentService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, server PaymentServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := server.ServiceInfo(ctx, &protoReq)
return msg, metadata, err
}
func request_PaymentService_ViewTransaction_0(ctx context.Context, marshaler runtime.Marshaler, client PaymentServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewTransactionRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["transaction_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "transaction_id")
}
protoReq.TransactionId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "transaction_id", err)
}
msg, err := client.ViewTransaction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_PaymentService_ViewTransaction_0(ctx context.Context, marshaler runtime.Marshaler, server PaymentServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewTransactionRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["transaction_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "transaction_id")
}
protoReq.TransactionId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "transaction_id", err)
}
msg, err := server.ViewTransaction(ctx, &protoReq)
return msg, metadata, err
}
func request_PaymentService_ViewBalance_0(ctx context.Context, marshaler runtime.Marshaler, client PaymentServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewBalanceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["customer_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "customer_id")
}
protoReq.CustomerId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "customer_id", err)
}
msg, err := client.ViewBalance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_PaymentService_ViewBalance_0(ctx context.Context, marshaler runtime.Marshaler, server PaymentServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewBalanceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["customer_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "customer_id")
}
protoReq.CustomerId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "customer_id", err)
}
msg, err := server.ViewBalance(ctx, &protoReq)
return msg, metadata, err
}
// RegisterPaymentServiceHandlerServer registers the http handlers for service PaymentService to "mux".
// UnaryRPC :call PaymentServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterPaymentServiceHandlerFromEndpoint instead.
func RegisterPaymentServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PaymentServiceServer) error {
mux.Handle("GET", pattern_PaymentService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.payment.v1.PaymentService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/payment/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_PaymentService_ServiceInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_PaymentService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_PaymentService_ViewTransaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.payment.v1.PaymentService/ViewTransaction", runtime.WithHTTPPathPattern("/v1/payment/transaction/{transaction_id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_PaymentService_ViewTransaction_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_PaymentService_ViewTransaction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_PaymentService_ViewBalance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.payment.v1.PaymentService/ViewBalance", runtime.WithHTTPPathPattern("/v1/payment/balance/{customer_id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_PaymentService_ViewBalance_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_PaymentService_ViewBalance_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterPaymentServiceHandlerFromEndpoint is same as RegisterPaymentServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterPaymentServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.DialContext(ctx, endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterPaymentServiceHandler(ctx, mux, conn)
}
// RegisterPaymentServiceHandler registers the http handlers for service PaymentService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterPaymentServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterPaymentServiceHandlerClient(ctx, mux, NewPaymentServiceClient(conn))
}
// RegisterPaymentServiceHandlerClient registers the http handlers for service PaymentService
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PaymentServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PaymentServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "PaymentServiceClient" to call the correct interceptors.
func RegisterPaymentServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PaymentServiceClient) error {
mux.Handle("GET", pattern_PaymentService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.payment.v1.PaymentService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/payment/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_PaymentService_ServiceInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_PaymentService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_PaymentService_ViewTransaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.payment.v1.PaymentService/ViewTransaction", runtime.WithHTTPPathPattern("/v1/payment/transaction/{transaction_id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_PaymentService_ViewTransaction_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_PaymentService_ViewTransaction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_PaymentService_ViewBalance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.payment.v1.PaymentService/ViewBalance", runtime.WithHTTPPathPattern("/v1/payment/balance/{customer_id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_PaymentService_ViewBalance_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_PaymentService_ViewBalance_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_PaymentService_ServiceInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "payment", "service"}, ""))
pattern_PaymentService_ViewTransaction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "payment", "transaction", "transaction_id"}, ""))
pattern_PaymentService_ViewBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "payment", "balance", "customer_id"}, ""))
)
var (
forward_PaymentService_ServiceInfo_0 = runtime.ForwardResponseMessage
forward_PaymentService_ViewTransaction_0 = runtime.ForwardResponseMessage
forward_PaymentService_ViewBalance_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,348 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: stocklet/payment/v1/service.proto
package payment_v1
import (
context "context"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
v11 "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
PaymentService_ServiceInfo_FullMethodName = "/stocklet.payment.v1.PaymentService/ServiceInfo"
PaymentService_ViewTransaction_FullMethodName = "/stocklet.payment.v1.PaymentService/ViewTransaction"
PaymentService_ViewBalance_FullMethodName = "/stocklet.payment.v1.PaymentService/ViewBalance"
PaymentService_ProcessUserCreatedEvent_FullMethodName = "/stocklet.payment.v1.PaymentService/ProcessUserCreatedEvent"
PaymentService_ProcessUserDeletedEvent_FullMethodName = "/stocklet.payment.v1.PaymentService/ProcessUserDeletedEvent"
PaymentService_ProcessShipmentAllocationEvent_FullMethodName = "/stocklet.payment.v1.PaymentService/ProcessShipmentAllocationEvent"
)
// PaymentServiceClient is the client API for PaymentService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PaymentServiceClient interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error)
ViewTransaction(ctx context.Context, in *ViewTransactionRequest, opts ...grpc.CallOption) (*ViewTransactionResponse, error)
ViewBalance(ctx context.Context, in *ViewBalanceRequest, opts ...grpc.CallOption) (*ViewBalanceResponse, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessUserCreatedEvent(ctx context.Context, in *v11.UserCreatedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessUserDeletedEvent(ctx context.Context, in *v11.UserDeletedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessShipmentAllocationEvent(ctx context.Context, in *v11.ShipmentAllocationEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type paymentServiceClient struct {
cc grpc.ClientConnInterface
}
func NewPaymentServiceClient(cc grpc.ClientConnInterface) PaymentServiceClient {
return &paymentServiceClient{cc}
}
func (c *paymentServiceClient) ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error) {
out := new(v1.ServiceInfoResponse)
err := c.cc.Invoke(ctx, PaymentService_ServiceInfo_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *paymentServiceClient) ViewTransaction(ctx context.Context, in *ViewTransactionRequest, opts ...grpc.CallOption) (*ViewTransactionResponse, error) {
out := new(ViewTransactionResponse)
err := c.cc.Invoke(ctx, PaymentService_ViewTransaction_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *paymentServiceClient) ViewBalance(ctx context.Context, in *ViewBalanceRequest, opts ...grpc.CallOption) (*ViewBalanceResponse, error) {
out := new(ViewBalanceResponse)
err := c.cc.Invoke(ctx, PaymentService_ViewBalance_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *paymentServiceClient) ProcessUserCreatedEvent(ctx context.Context, in *v11.UserCreatedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, PaymentService_ProcessUserCreatedEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *paymentServiceClient) ProcessUserDeletedEvent(ctx context.Context, in *v11.UserDeletedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, PaymentService_ProcessUserDeletedEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *paymentServiceClient) ProcessShipmentAllocationEvent(ctx context.Context, in *v11.ShipmentAllocationEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, PaymentService_ProcessShipmentAllocationEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// PaymentServiceServer is the server API for PaymentService service.
// All implementations must embed UnimplementedPaymentServiceServer
// for forward compatibility
type PaymentServiceServer interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error)
ViewTransaction(context.Context, *ViewTransactionRequest) (*ViewTransactionResponse, error)
ViewBalance(context.Context, *ViewBalanceRequest) (*ViewBalanceResponse, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessUserCreatedEvent(context.Context, *v11.UserCreatedEvent) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessUserDeletedEvent(context.Context, *v11.UserDeletedEvent) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessShipmentAllocationEvent(context.Context, *v11.ShipmentAllocationEvent) (*emptypb.Empty, error)
mustEmbedUnimplementedPaymentServiceServer()
}
// UnimplementedPaymentServiceServer must be embedded to have forward compatible implementations.
type UnimplementedPaymentServiceServer struct {
}
func (UnimplementedPaymentServiceServer) ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ServiceInfo not implemented")
}
func (UnimplementedPaymentServiceServer) ViewTransaction(context.Context, *ViewTransactionRequest) (*ViewTransactionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ViewTransaction not implemented")
}
func (UnimplementedPaymentServiceServer) ViewBalance(context.Context, *ViewBalanceRequest) (*ViewBalanceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ViewBalance not implemented")
}
func (UnimplementedPaymentServiceServer) ProcessUserCreatedEvent(context.Context, *v11.UserCreatedEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessUserCreatedEvent not implemented")
}
func (UnimplementedPaymentServiceServer) ProcessUserDeletedEvent(context.Context, *v11.UserDeletedEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessUserDeletedEvent not implemented")
}
func (UnimplementedPaymentServiceServer) ProcessShipmentAllocationEvent(context.Context, *v11.ShipmentAllocationEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessShipmentAllocationEvent not implemented")
}
func (UnimplementedPaymentServiceServer) mustEmbedUnimplementedPaymentServiceServer() {}
// UnsafePaymentServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PaymentServiceServer will
// result in compilation errors.
type UnsafePaymentServiceServer interface {
mustEmbedUnimplementedPaymentServiceServer()
}
func RegisterPaymentServiceServer(s grpc.ServiceRegistrar, srv PaymentServiceServer) {
s.RegisterService(&PaymentService_ServiceDesc, srv)
}
func _PaymentService_ServiceInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v1.ServiceInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentServiceServer).ServiceInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PaymentService_ServiceInfo_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentServiceServer).ServiceInfo(ctx, req.(*v1.ServiceInfoRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PaymentService_ViewTransaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ViewTransactionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentServiceServer).ViewTransaction(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PaymentService_ViewTransaction_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentServiceServer).ViewTransaction(ctx, req.(*ViewTransactionRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PaymentService_ViewBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ViewBalanceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentServiceServer).ViewBalance(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PaymentService_ViewBalance_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentServiceServer).ViewBalance(ctx, req.(*ViewBalanceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PaymentService_ProcessUserCreatedEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.UserCreatedEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentServiceServer).ProcessUserCreatedEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PaymentService_ProcessUserCreatedEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentServiceServer).ProcessUserCreatedEvent(ctx, req.(*v11.UserCreatedEvent))
}
return interceptor(ctx, in, info, handler)
}
func _PaymentService_ProcessUserDeletedEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.UserDeletedEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentServiceServer).ProcessUserDeletedEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PaymentService_ProcessUserDeletedEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentServiceServer).ProcessUserDeletedEvent(ctx, req.(*v11.UserDeletedEvent))
}
return interceptor(ctx, in, info, handler)
}
func _PaymentService_ProcessShipmentAllocationEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.ShipmentAllocationEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PaymentServiceServer).ProcessShipmentAllocationEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PaymentService_ProcessShipmentAllocationEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PaymentServiceServer).ProcessShipmentAllocationEvent(ctx, req.(*v11.ShipmentAllocationEvent))
}
return interceptor(ctx, in, info, handler)
}
// PaymentService_ServiceDesc is the grpc.ServiceDesc for PaymentService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PaymentService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "stocklet.payment.v1.PaymentService",
HandlerType: (*PaymentServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ServiceInfo",
Handler: _PaymentService_ServiceInfo_Handler,
},
{
MethodName: "ViewTransaction",
Handler: _PaymentService_ViewTransaction_Handler,
},
{
MethodName: "ViewBalance",
Handler: _PaymentService_ViewBalance_Handler,
},
{
MethodName: "ProcessUserCreatedEvent",
Handler: _PaymentService_ProcessUserCreatedEvent_Handler,
},
{
MethodName: "ProcessUserDeletedEvent",
Handler: _PaymentService_ProcessUserDeletedEvent_Handler,
},
{
MethodName: "ProcessShipmentAllocationEvent",
Handler: _PaymentService_ProcessShipmentAllocationEvent_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "stocklet/payment/v1/service.proto",
}

View File

@@ -0,0 +1,294 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/payment/v1/types.proto
package payment_v1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Transaction struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Amount float32 `protobuf:"fixed32,2,opt,name=amount,proto3" json:"amount,omitempty"`
OrderId string `protobuf:"bytes,3,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
CustomerId string `protobuf:"bytes,4,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
// Optional - If set, then the transaction has been refunded.
ReversedAt *int64 `protobuf:"varint,5,opt,name=reversed_at,json=reversedAt,proto3,oneof" json:"reversed_at,omitempty"`
ProcessedAt int64 `protobuf:"varint,6,opt,name=processed_at,json=processedAt,proto3" json:"processed_at,omitempty"`
}
func (x *Transaction) Reset() {
*x = Transaction{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_payment_v1_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Transaction) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Transaction) ProtoMessage() {}
func (x *Transaction) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_payment_v1_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Transaction.ProtoReflect.Descriptor instead.
func (*Transaction) Descriptor() ([]byte, []int) {
return file_stocklet_payment_v1_types_proto_rawDescGZIP(), []int{0}
}
func (x *Transaction) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *Transaction) GetAmount() float32 {
if x != nil {
return x.Amount
}
return 0
}
func (x *Transaction) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *Transaction) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
func (x *Transaction) GetReversedAt() int64 {
if x != nil && x.ReversedAt != nil {
return *x.ReversedAt
}
return 0
}
func (x *Transaction) GetProcessedAt() int64 {
if x != nil {
return x.ProcessedAt
}
return 0
}
type CustomerBalance struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CustomerId string `protobuf:"bytes,1,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
Balance float32 `protobuf:"fixed32,2,opt,name=balance,proto3" json:"balance,omitempty"`
}
func (x *CustomerBalance) Reset() {
*x = CustomerBalance{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_payment_v1_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CustomerBalance) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CustomerBalance) ProtoMessage() {}
func (x *CustomerBalance) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_payment_v1_types_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CustomerBalance.ProtoReflect.Descriptor instead.
func (*CustomerBalance) Descriptor() ([]byte, []int) {
return file_stocklet_payment_v1_types_proto_rawDescGZIP(), []int{1}
}
func (x *CustomerBalance) GetCustomerId() string {
if x != nil {
return x.CustomerId
}
return ""
}
func (x *CustomerBalance) GetBalance() float32 {
if x != nil {
return x.Balance
}
return 0
}
var File_stocklet_payment_v1_types_proto protoreflect.FileDescriptor
var file_stocklet_payment_v1_types_proto_rawDesc = []byte{
0x0a, 0x1f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65,
0x6e, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x13, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x70, 0x61, 0x79, 0x6d,
0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69,
0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0xf1, 0x01, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42,
0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x06,
0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x42, 0x0a, 0xba, 0x48,
0x07, 0x0a, 0x05, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
0x12, 0x22, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x6f, 0x72, 0x64,
0x65, 0x72, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72,
0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02,
0x10, 0x01, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x12, 0x24,
0x0a, 0x0b, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20,
0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0a, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x64, 0x41,
0x74, 0x88, 0x01, 0x01, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65,
0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x63,
0x65, 0x73, 0x73, 0x65, 0x64, 0x41, 0x74, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x72, 0x65, 0x76, 0x65,
0x72, 0x73, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x22, 0x61, 0x0a, 0x0f, 0x43, 0x75, 0x73, 0x74, 0x6f,
0x6d, 0x65, 0x72, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x0b, 0x63, 0x75,
0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42,
0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d,
0x65, 0x72, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x02, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x0a, 0x05, 0x2d, 0x00, 0x00, 0x00,
0x00, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x42, 0x49, 0x5a, 0x47, 0x67, 0x69,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e,
0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e,
0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f,
0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x76, 0x31, 0x3b, 0x70, 0x61, 0x79, 0x6d, 0x65,
0x6e, 0x74, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_payment_v1_types_proto_rawDescOnce sync.Once
file_stocklet_payment_v1_types_proto_rawDescData = file_stocklet_payment_v1_types_proto_rawDesc
)
func file_stocklet_payment_v1_types_proto_rawDescGZIP() []byte {
file_stocklet_payment_v1_types_proto_rawDescOnce.Do(func() {
file_stocklet_payment_v1_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_payment_v1_types_proto_rawDescData)
})
return file_stocklet_payment_v1_types_proto_rawDescData
}
var file_stocklet_payment_v1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_stocklet_payment_v1_types_proto_goTypes = []interface{}{
(*Transaction)(nil), // 0: stocklet.payment.v1.Transaction
(*CustomerBalance)(nil), // 1: stocklet.payment.v1.CustomerBalance
}
var file_stocklet_payment_v1_types_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_stocklet_payment_v1_types_proto_init() }
func file_stocklet_payment_v1_types_proto_init() {
if File_stocklet_payment_v1_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_payment_v1_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Transaction); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_payment_v1_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CustomerBalance); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_stocklet_payment_v1_types_proto_msgTypes[0].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_payment_v1_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_payment_v1_types_proto_goTypes,
DependencyIndexes: file_stocklet_payment_v1_types_proto_depIdxs,
MessageInfos: file_stocklet_payment_v1_types_proto_msgTypes,
}.Build()
File_stocklet_payment_v1_types_proto = out.File
file_stocklet_payment_v1_types_proto_rawDesc = nil
file_stocklet_payment_v1_types_proto_goTypes = nil
file_stocklet_payment_v1_types_proto_depIdxs = nil
}

View File

@@ -0,0 +1,413 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/product/v1/service.proto
package product_v1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
v11 "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1"
_ "google.golang.org/genproto/googleapis/api/annotations"
_ "google.golang.org/genproto/googleapis/api/visibility"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ViewProductRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (x *ViewProductRequest) Reset() {
*x = ViewProductRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_product_v1_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewProductRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewProductRequest) ProtoMessage() {}
func (x *ViewProductRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_product_v1_service_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewProductRequest.ProtoReflect.Descriptor instead.
func (*ViewProductRequest) Descriptor() ([]byte, []int) {
return file_stocklet_product_v1_service_proto_rawDescGZIP(), []int{0}
}
func (x *ViewProductRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
type ViewProductResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Product *Product `protobuf:"bytes,1,opt,name=product,proto3" json:"product,omitempty"`
}
func (x *ViewProductResponse) Reset() {
*x = ViewProductResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_product_v1_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewProductResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewProductResponse) ProtoMessage() {}
func (x *ViewProductResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_product_v1_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewProductResponse.ProtoReflect.Descriptor instead.
func (*ViewProductResponse) Descriptor() ([]byte, []int) {
return file_stocklet_product_v1_service_proto_rawDescGZIP(), []int{1}
}
func (x *ViewProductResponse) GetProduct() *Product {
if x != nil {
return x.Product
}
return nil
}
type ViewProductsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ViewProductsRequest) Reset() {
*x = ViewProductsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_product_v1_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewProductsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewProductsRequest) ProtoMessage() {}
func (x *ViewProductsRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_product_v1_service_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewProductsRequest.ProtoReflect.Descriptor instead.
func (*ViewProductsRequest) Descriptor() ([]byte, []int) {
return file_stocklet_product_v1_service_proto_rawDescGZIP(), []int{2}
}
type ViewProductsResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"`
}
func (x *ViewProductsResponse) Reset() {
*x = ViewProductsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_product_v1_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewProductsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewProductsResponse) ProtoMessage() {}
func (x *ViewProductsResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_product_v1_service_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewProductsResponse.ProtoReflect.Descriptor instead.
func (*ViewProductsResponse) Descriptor() ([]byte, []int) {
return file_stocklet_product_v1_service_proto_rawDescGZIP(), []int{3}
}
func (x *ViewProductsResponse) GetProducts() []*Product {
if x != nil {
return x.Products
}
return nil
}
var File_stocklet_product_v1_service_proto protoreflect.FileDescriptor
var file_stocklet_product_v1_service_proto_rawDesc = []byte{
0x0a, 0x21, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x13, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x70, 0x72,
0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70,
0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x73,
0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76,
0x31, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x1e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x1f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0x2d, 0x0a, 0x12, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x02, 0x69, 0x64,
0x22, 0x4d, 0x0a, 0x13, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50,
0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x22,
0x15, 0x0a, 0x13, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x50, 0x0a, 0x14, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72,
0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38,
0x0a, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x1c, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x64,
0x75, 0x63, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x08,
0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x32, 0xf5, 0x03, 0x0a, 0x0e, 0x50, 0x72, 0x6f,
0x64, 0x75, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7b, 0x0a, 0x0b, 0x53,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x73, 0x74, 0x6f,
0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x63, 0x6f,
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4,
0x93, 0x02, 0x15, 0x12, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7a, 0x0a, 0x0b, 0x56, 0x69, 0x65, 0x77,
0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x27, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c,
0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69,
0x65, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x28, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x64,
0x75, 0x63, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93,
0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2f,
0x7b, 0x69, 0x64, 0x7d, 0x12, 0x7d, 0x0a, 0x0c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x64,
0x75, 0x63, 0x74, 0x73, 0x12, 0x28, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e,
0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x50,
0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29,
0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
0x74, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02,
0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2f, 0x6c,
0x69, 0x73, 0x74, 0x12, 0x6b, 0x0a, 0x18, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x4f, 0x72,
0x64, 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12,
0x25, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x10,
0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c,
0x42, 0x49, 0x5a, 0x47, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68,
0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f,
0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2f, 0x76, 0x31,
0x3b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
file_stocklet_product_v1_service_proto_rawDescOnce sync.Once
file_stocklet_product_v1_service_proto_rawDescData = file_stocklet_product_v1_service_proto_rawDesc
)
func file_stocklet_product_v1_service_proto_rawDescGZIP() []byte {
file_stocklet_product_v1_service_proto_rawDescOnce.Do(func() {
file_stocklet_product_v1_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_product_v1_service_proto_rawDescData)
})
return file_stocklet_product_v1_service_proto_rawDescData
}
var file_stocklet_product_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_stocklet_product_v1_service_proto_goTypes = []interface{}{
(*ViewProductRequest)(nil), // 0: stocklet.product.v1.ViewProductRequest
(*ViewProductResponse)(nil), // 1: stocklet.product.v1.ViewProductResponse
(*ViewProductsRequest)(nil), // 2: stocklet.product.v1.ViewProductsRequest
(*ViewProductsResponse)(nil), // 3: stocklet.product.v1.ViewProductsResponse
(*Product)(nil), // 4: stocklet.product.v1.Product
(*v1.ServiceInfoRequest)(nil), // 5: stocklet.common.v1.ServiceInfoRequest
(*v11.OrderCreatedEvent)(nil), // 6: stocklet.events.v1.OrderCreatedEvent
(*v1.ServiceInfoResponse)(nil), // 7: stocklet.common.v1.ServiceInfoResponse
(*emptypb.Empty)(nil), // 8: google.protobuf.Empty
}
var file_stocklet_product_v1_service_proto_depIdxs = []int32{
4, // 0: stocklet.product.v1.ViewProductResponse.product:type_name -> stocklet.product.v1.Product
4, // 1: stocklet.product.v1.ViewProductsResponse.products:type_name -> stocklet.product.v1.Product
5, // 2: stocklet.product.v1.ProductService.ServiceInfo:input_type -> stocklet.common.v1.ServiceInfoRequest
0, // 3: stocklet.product.v1.ProductService.ViewProduct:input_type -> stocklet.product.v1.ViewProductRequest
2, // 4: stocklet.product.v1.ProductService.ViewProducts:input_type -> stocklet.product.v1.ViewProductsRequest
6, // 5: stocklet.product.v1.ProductService.ProcessOrderCreatedEvent:input_type -> stocklet.events.v1.OrderCreatedEvent
7, // 6: stocklet.product.v1.ProductService.ServiceInfo:output_type -> stocklet.common.v1.ServiceInfoResponse
1, // 7: stocklet.product.v1.ProductService.ViewProduct:output_type -> stocklet.product.v1.ViewProductResponse
3, // 8: stocklet.product.v1.ProductService.ViewProducts:output_type -> stocklet.product.v1.ViewProductsResponse
8, // 9: stocklet.product.v1.ProductService.ProcessOrderCreatedEvent:output_type -> google.protobuf.Empty
6, // [6:10] is the sub-list for method output_type
2, // [2:6] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_stocklet_product_v1_service_proto_init() }
func file_stocklet_product_v1_service_proto_init() {
if File_stocklet_product_v1_service_proto != nil {
return
}
file_stocklet_product_v1_types_proto_init()
if !protoimpl.UnsafeEnabled {
file_stocklet_product_v1_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewProductRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_product_v1_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewProductResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_product_v1_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewProductsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_product_v1_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewProductsResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_product_v1_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_stocklet_product_v1_service_proto_goTypes,
DependencyIndexes: file_stocklet_product_v1_service_proto_depIdxs,
MessageInfos: file_stocklet_product_v1_service_proto_msgTypes,
}.Build()
File_stocklet_product_v1_service_proto = out.File
file_stocklet_product_v1_service_proto_rawDesc = nil
file_stocklet_product_v1_service_proto_goTypes = nil
file_stocklet_product_v1_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,328 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: stocklet/product/v1/service.proto
/*
Package product_v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package product_v1
import (
"context"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = metadata.Join
func request_ProductService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, client ProductServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := client.ServiceInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_ProductService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, server ProductServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := server.ServiceInfo(ctx, &protoReq)
return msg, metadata, err
}
func request_ProductService_ViewProduct_0(ctx context.Context, marshaler runtime.Marshaler, client ProductServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewProductRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := client.ViewProduct(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_ProductService_ViewProduct_0(ctx context.Context, marshaler runtime.Marshaler, server ProductServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewProductRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := server.ViewProduct(ctx, &protoReq)
return msg, metadata, err
}
func request_ProductService_ViewProducts_0(ctx context.Context, marshaler runtime.Marshaler, client ProductServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewProductsRequest
var metadata runtime.ServerMetadata
msg, err := client.ViewProducts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_ProductService_ViewProducts_0(ctx context.Context, marshaler runtime.Marshaler, server ProductServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewProductsRequest
var metadata runtime.ServerMetadata
msg, err := server.ViewProducts(ctx, &protoReq)
return msg, metadata, err
}
// RegisterProductServiceHandlerServer registers the http handlers for service ProductService to "mux".
// UnaryRPC :call ProductServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterProductServiceHandlerFromEndpoint instead.
func RegisterProductServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ProductServiceServer) error {
mux.Handle("GET", pattern_ProductService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.product.v1.ProductService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/product/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_ProductService_ServiceInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_ProductService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_ProductService_ViewProduct_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.product.v1.ProductService/ViewProduct", runtime.WithHTTPPathPattern("/v1/product/{id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_ProductService_ViewProduct_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_ProductService_ViewProduct_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_ProductService_ViewProducts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.product.v1.ProductService/ViewProducts", runtime.WithHTTPPathPattern("/v1/product/list"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_ProductService_ViewProducts_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_ProductService_ViewProducts_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterProductServiceHandlerFromEndpoint is same as RegisterProductServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterProductServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.DialContext(ctx, endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterProductServiceHandler(ctx, mux, conn)
}
// RegisterProductServiceHandler registers the http handlers for service ProductService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterProductServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterProductServiceHandlerClient(ctx, mux, NewProductServiceClient(conn))
}
// RegisterProductServiceHandlerClient registers the http handlers for service ProductService
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ProductServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ProductServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "ProductServiceClient" to call the correct interceptors.
func RegisterProductServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ProductServiceClient) error {
mux.Handle("GET", pattern_ProductService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.product.v1.ProductService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/product/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_ProductService_ServiceInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_ProductService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_ProductService_ViewProduct_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.product.v1.ProductService/ViewProduct", runtime.WithHTTPPathPattern("/v1/product/{id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_ProductService_ViewProduct_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_ProductService_ViewProduct_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_ProductService_ViewProducts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.product.v1.ProductService/ViewProducts", runtime.WithHTTPPathPattern("/v1/product/list"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_ProductService_ViewProducts_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_ProductService_ViewProducts_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_ProductService_ServiceInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "product", "service"}, ""))
pattern_ProductService_ViewProduct_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "product", "id"}, ""))
pattern_ProductService_ViewProducts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "product", "list"}, ""))
)
var (
forward_ProductService_ServiceInfo_0 = runtime.ForwardResponseMessage
forward_ProductService_ViewProduct_0 = runtime.ForwardResponseMessage
forward_ProductService_ViewProducts_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,254 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: stocklet/product/v1/service.proto
package product_v1
import (
context "context"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
v11 "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
ProductService_ServiceInfo_FullMethodName = "/stocklet.product.v1.ProductService/ServiceInfo"
ProductService_ViewProduct_FullMethodName = "/stocklet.product.v1.ProductService/ViewProduct"
ProductService_ViewProducts_FullMethodName = "/stocklet.product.v1.ProductService/ViewProducts"
ProductService_ProcessOrderCreatedEvent_FullMethodName = "/stocklet.product.v1.ProductService/ProcessOrderCreatedEvent"
)
// ProductServiceClient is the client API for ProductService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ProductServiceClient interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error)
ViewProduct(ctx context.Context, in *ViewProductRequest, opts ...grpc.CallOption) (*ViewProductResponse, error)
ViewProducts(ctx context.Context, in *ViewProductsRequest, opts ...grpc.CallOption) (*ViewProductsResponse, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessOrderCreatedEvent(ctx context.Context, in *v11.OrderCreatedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type productServiceClient struct {
cc grpc.ClientConnInterface
}
func NewProductServiceClient(cc grpc.ClientConnInterface) ProductServiceClient {
return &productServiceClient{cc}
}
func (c *productServiceClient) ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error) {
out := new(v1.ServiceInfoResponse)
err := c.cc.Invoke(ctx, ProductService_ServiceInfo_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *productServiceClient) ViewProduct(ctx context.Context, in *ViewProductRequest, opts ...grpc.CallOption) (*ViewProductResponse, error) {
out := new(ViewProductResponse)
err := c.cc.Invoke(ctx, ProductService_ViewProduct_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *productServiceClient) ViewProducts(ctx context.Context, in *ViewProductsRequest, opts ...grpc.CallOption) (*ViewProductsResponse, error) {
out := new(ViewProductsResponse)
err := c.cc.Invoke(ctx, ProductService_ViewProducts_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *productServiceClient) ProcessOrderCreatedEvent(ctx context.Context, in *v11.OrderCreatedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, ProductService_ProcessOrderCreatedEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ProductServiceServer is the server API for ProductService service.
// All implementations must embed UnimplementedProductServiceServer
// for forward compatibility
type ProductServiceServer interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error)
ViewProduct(context.Context, *ViewProductRequest) (*ViewProductResponse, error)
ViewProducts(context.Context, *ViewProductsRequest) (*ViewProductsResponse, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessOrderCreatedEvent(context.Context, *v11.OrderCreatedEvent) (*emptypb.Empty, error)
mustEmbedUnimplementedProductServiceServer()
}
// UnimplementedProductServiceServer must be embedded to have forward compatible implementations.
type UnimplementedProductServiceServer struct {
}
func (UnimplementedProductServiceServer) ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ServiceInfo not implemented")
}
func (UnimplementedProductServiceServer) ViewProduct(context.Context, *ViewProductRequest) (*ViewProductResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ViewProduct not implemented")
}
func (UnimplementedProductServiceServer) ViewProducts(context.Context, *ViewProductsRequest) (*ViewProductsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ViewProducts not implemented")
}
func (UnimplementedProductServiceServer) ProcessOrderCreatedEvent(context.Context, *v11.OrderCreatedEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessOrderCreatedEvent not implemented")
}
func (UnimplementedProductServiceServer) mustEmbedUnimplementedProductServiceServer() {}
// UnsafeProductServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ProductServiceServer will
// result in compilation errors.
type UnsafeProductServiceServer interface {
mustEmbedUnimplementedProductServiceServer()
}
func RegisterProductServiceServer(s grpc.ServiceRegistrar, srv ProductServiceServer) {
s.RegisterService(&ProductService_ServiceDesc, srv)
}
func _ProductService_ServiceInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v1.ServiceInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProductServiceServer).ServiceInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ProductService_ServiceInfo_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProductServiceServer).ServiceInfo(ctx, req.(*v1.ServiceInfoRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ProductService_ViewProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ViewProductRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProductServiceServer).ViewProduct(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ProductService_ViewProduct_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProductServiceServer).ViewProduct(ctx, req.(*ViewProductRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ProductService_ViewProducts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ViewProductsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProductServiceServer).ViewProducts(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ProductService_ViewProducts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProductServiceServer).ViewProducts(ctx, req.(*ViewProductsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ProductService_ProcessOrderCreatedEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.OrderCreatedEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ProductServiceServer).ProcessOrderCreatedEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ProductService_ProcessOrderCreatedEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ProductServiceServer).ProcessOrderCreatedEvent(ctx, req.(*v11.OrderCreatedEvent))
}
return interceptor(ctx, in, info, handler)
}
// ProductService_ServiceDesc is the grpc.ServiceDesc for ProductService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ProductService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "stocklet.product.v1.ProductService",
HandlerType: (*ProductServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ServiceInfo",
Handler: _ProductService_ServiceInfo_Handler,
},
{
MethodName: "ViewProduct",
Handler: _ProductService_ViewProduct_Handler,
},
{
MethodName: "ViewProducts",
Handler: _ProductService_ViewProducts_Handler,
},
{
MethodName: "ProcessOrderCreatedEvent",
Handler: _ProductService_ProcessOrderCreatedEvent_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "stocklet/product/v1/service.proto",
}

View File

@@ -0,0 +1,218 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/product/v1/types.proto
package product_v1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Product struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
Price float32 `protobuf:"fixed32,4,opt,name=price,proto3" json:"price,omitempty"`
CreatedAt int64 `protobuf:"varint,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
UpdatedAt *int64 `protobuf:"varint,6,opt,name=updated_at,json=updatedAt,proto3,oneof" json:"updated_at,omitempty"`
}
func (x *Product) Reset() {
*x = Product{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_product_v1_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Product) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Product) ProtoMessage() {}
func (x *Product) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_product_v1_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Product.ProtoReflect.Descriptor instead.
func (*Product) Descriptor() ([]byte, []int) {
return file_stocklet_product_v1_types_proto_rawDescGZIP(), []int{0}
}
func (x *Product) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *Product) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *Product) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *Product) GetPrice() float32 {
if x != nil {
return x.Price
}
return 0
}
func (x *Product) GetCreatedAt() int64 {
if x != nil {
return x.CreatedAt
}
return 0
}
func (x *Product) GetUpdatedAt() int64 {
if x != nil && x.UpdatedAt != nil {
return *x.UpdatedAt
}
return 0
}
var File_stocklet_product_v1_types_proto protoreflect.FileDescriptor
var file_stocklet_product_v1_types_proto_rawDesc = []byte{
0x0a, 0x1f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x13, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x64,
0x75, 0x63, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69,
0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0xde, 0x01, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12,
0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04,
0x72, 0x02, 0x10, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72,
0x02, 0x10, 0x01, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x20, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x42,
0x0a, 0xba, 0x48, 0x07, 0x0a, 0x05, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x52, 0x05, 0x70, 0x72, 0x69,
0x63, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74,
0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41,
0x74, 0x12, 0x22, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18,
0x06, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64,
0x41, 0x74, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x64, 0x5f, 0x61, 0x74, 0x42, 0x49, 0x5a, 0x47, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67,
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
0x74, 0x2f, 0x76, 0x31, 0x3b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x76, 0x31, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_product_v1_types_proto_rawDescOnce sync.Once
file_stocklet_product_v1_types_proto_rawDescData = file_stocklet_product_v1_types_proto_rawDesc
)
func file_stocklet_product_v1_types_proto_rawDescGZIP() []byte {
file_stocklet_product_v1_types_proto_rawDescOnce.Do(func() {
file_stocklet_product_v1_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_product_v1_types_proto_rawDescData)
})
return file_stocklet_product_v1_types_proto_rawDescData
}
var file_stocklet_product_v1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_stocklet_product_v1_types_proto_goTypes = []interface{}{
(*Product)(nil), // 0: stocklet.product.v1.Product
}
var file_stocklet_product_v1_types_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_stocklet_product_v1_types_proto_init() }
func file_stocklet_product_v1_types_proto_init() {
if File_stocklet_product_v1_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_product_v1_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Product); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_stocklet_product_v1_types_proto_msgTypes[0].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_product_v1_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_product_v1_types_proto_goTypes,
DependencyIndexes: file_stocklet_product_v1_types_proto_depIdxs,
MessageInfos: file_stocklet_product_v1_types_proto_msgTypes,
}.Build()
File_stocklet_product_v1_types_proto = out.File
file_stocklet_product_v1_types_proto_rawDesc = nil
file_stocklet_product_v1_types_proto_goTypes = nil
file_stocklet_product_v1_types_proto_depIdxs = nil
}

View File

@@ -0,0 +1,447 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/shipping/v1/service.proto
package shipping_v1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
v11 "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1"
_ "google.golang.org/genproto/googleapis/api/annotations"
_ "google.golang.org/genproto/googleapis/api/visibility"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ViewShipmentRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ShipmentId string `protobuf:"bytes,1,opt,name=shipment_id,json=shipmentId,proto3" json:"shipment_id,omitempty"`
}
func (x *ViewShipmentRequest) Reset() {
*x = ViewShipmentRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_shipping_v1_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewShipmentRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewShipmentRequest) ProtoMessage() {}
func (x *ViewShipmentRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_shipping_v1_service_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewShipmentRequest.ProtoReflect.Descriptor instead.
func (*ViewShipmentRequest) Descriptor() ([]byte, []int) {
return file_stocklet_shipping_v1_service_proto_rawDescGZIP(), []int{0}
}
func (x *ViewShipmentRequest) GetShipmentId() string {
if x != nil {
return x.ShipmentId
}
return ""
}
type ViewShipmentResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Shipment *Shipment `protobuf:"bytes,1,opt,name=shipment,proto3" json:"shipment,omitempty"`
}
func (x *ViewShipmentResponse) Reset() {
*x = ViewShipmentResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_shipping_v1_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewShipmentResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewShipmentResponse) ProtoMessage() {}
func (x *ViewShipmentResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_shipping_v1_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewShipmentResponse.ProtoReflect.Descriptor instead.
func (*ViewShipmentResponse) Descriptor() ([]byte, []int) {
return file_stocklet_shipping_v1_service_proto_rawDescGZIP(), []int{1}
}
func (x *ViewShipmentResponse) GetShipment() *Shipment {
if x != nil {
return x.Shipment
}
return nil
}
type ViewShipmentManifestRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ShipmentId string `protobuf:"bytes,1,opt,name=shipment_id,json=shipmentId,proto3" json:"shipment_id,omitempty"`
}
func (x *ViewShipmentManifestRequest) Reset() {
*x = ViewShipmentManifestRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_shipping_v1_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewShipmentManifestRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewShipmentManifestRequest) ProtoMessage() {}
func (x *ViewShipmentManifestRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_shipping_v1_service_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewShipmentManifestRequest.ProtoReflect.Descriptor instead.
func (*ViewShipmentManifestRequest) Descriptor() ([]byte, []int) {
return file_stocklet_shipping_v1_service_proto_rawDescGZIP(), []int{2}
}
func (x *ViewShipmentManifestRequest) GetShipmentId() string {
if x != nil {
return x.ShipmentId
}
return ""
}
type ViewShipmentManifestResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Manifest []*ShipmentItem `protobuf:"bytes,1,rep,name=manifest,proto3" json:"manifest,omitempty"`
}
func (x *ViewShipmentManifestResponse) Reset() {
*x = ViewShipmentManifestResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_shipping_v1_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewShipmentManifestResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewShipmentManifestResponse) ProtoMessage() {}
func (x *ViewShipmentManifestResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_shipping_v1_service_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewShipmentManifestResponse.ProtoReflect.Descriptor instead.
func (*ViewShipmentManifestResponse) Descriptor() ([]byte, []int) {
return file_stocklet_shipping_v1_service_proto_rawDescGZIP(), []int{3}
}
func (x *ViewShipmentManifestResponse) GetManifest() []*ShipmentItem {
if x != nil {
return x.Manifest
}
return nil
}
var File_stocklet_shipping_v1_service_proto protoreflect.FileDescriptor
var file_stocklet_shipping_v1_service_proto_rawDesc = []byte{
0x0a, 0x22, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x70,
0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x73,
0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f,
0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70,
0x69, 0x2f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
0x21, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x1a, 0x20, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65, 0x76, 0x65,
0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65,
0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75,
0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c,
0x65, 0x74, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x74,
0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3f, 0x0a, 0x13, 0x56, 0x69,
0x65, 0x77, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x28, 0x0a, 0x0b, 0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52,
0x0a, 0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x52, 0x0a, 0x14, 0x56,
0x69, 0x65, 0x77, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x08, 0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74,
0x2e, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x69,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x22,
0x47, 0x0a, 0x1b, 0x56, 0x69, 0x65, 0x77, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4d,
0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28,
0x0a, 0x0b, 0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x73, 0x68,
0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x5e, 0x0a, 0x1c, 0x56, 0x69, 0x65, 0x77,
0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x08, 0x6d, 0x61, 0x6e, 0x69,
0x66, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x73, 0x74, 0x6f,
0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x76,
0x31, 0x2e, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x08,
0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x32, 0xc4, 0x05, 0x0a, 0x0f, 0x53, 0x68, 0x69,
0x70, 0x70, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7c, 0x0a, 0x0b,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x73, 0x74,
0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31,
0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x63,
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3,
0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69,
0x6e, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x92, 0x01, 0x0a, 0x0c, 0x56,
0x69, 0x65, 0x77, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x2e, 0x73, 0x74,
0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e,
0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65,
0x74, 0x2e, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69,
0x65, 0x77, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x76, 0x31, 0x2f,
0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e,
0x74, 0x2f, 0x7b, 0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x12,
0xb3, 0x01, 0x0a, 0x14, 0x56, 0x69, 0x65, 0x77, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74,
0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x31, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x2e, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e,
0x56, 0x69, 0x65, 0x77, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4d, 0x61, 0x6e, 0x69,
0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x73, 0x74,
0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e,
0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4d,
0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x34, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2e, 0x12, 0x2c, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x68, 0x69,
0x70, 0x70, 0x69, 0x6e, 0x67, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x7b,
0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x6d, 0x61, 0x6e,
0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x73, 0x0a, 0x1c, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73,
0x53, 0x74, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74,
0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x63, 0x6b,
0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74,
0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a,
0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x12, 0x73, 0x0a, 0x1c, 0x50, 0x72,
0x6f, 0x63, 0x65, 0x73, 0x73, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x63,
0x65, 0x73, 0x73, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x2e, 0x73, 0x74, 0x6f,
0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e,
0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64,
0x45, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x10, 0xfa,
0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x42,
0x4b, 0x5a, 0x49, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x65,
0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31,
0x3b, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_shipping_v1_service_proto_rawDescOnce sync.Once
file_stocklet_shipping_v1_service_proto_rawDescData = file_stocklet_shipping_v1_service_proto_rawDesc
)
func file_stocklet_shipping_v1_service_proto_rawDescGZIP() []byte {
file_stocklet_shipping_v1_service_proto_rawDescOnce.Do(func() {
file_stocklet_shipping_v1_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_shipping_v1_service_proto_rawDescData)
})
return file_stocklet_shipping_v1_service_proto_rawDescData
}
var file_stocklet_shipping_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_stocklet_shipping_v1_service_proto_goTypes = []interface{}{
(*ViewShipmentRequest)(nil), // 0: stocklet.shipping.v1.ViewShipmentRequest
(*ViewShipmentResponse)(nil), // 1: stocklet.shipping.v1.ViewShipmentResponse
(*ViewShipmentManifestRequest)(nil), // 2: stocklet.shipping.v1.ViewShipmentManifestRequest
(*ViewShipmentManifestResponse)(nil), // 3: stocklet.shipping.v1.ViewShipmentManifestResponse
(*Shipment)(nil), // 4: stocklet.shipping.v1.Shipment
(*ShipmentItem)(nil), // 5: stocklet.shipping.v1.ShipmentItem
(*v1.ServiceInfoRequest)(nil), // 6: stocklet.common.v1.ServiceInfoRequest
(*v11.StockReservationEvent)(nil), // 7: stocklet.events.v1.StockReservationEvent
(*v11.PaymentProcessedEvent)(nil), // 8: stocklet.events.v1.PaymentProcessedEvent
(*v1.ServiceInfoResponse)(nil), // 9: stocklet.common.v1.ServiceInfoResponse
(*emptypb.Empty)(nil), // 10: google.protobuf.Empty
}
var file_stocklet_shipping_v1_service_proto_depIdxs = []int32{
4, // 0: stocklet.shipping.v1.ViewShipmentResponse.shipment:type_name -> stocklet.shipping.v1.Shipment
5, // 1: stocklet.shipping.v1.ViewShipmentManifestResponse.manifest:type_name -> stocklet.shipping.v1.ShipmentItem
6, // 2: stocklet.shipping.v1.ShippingService.ServiceInfo:input_type -> stocklet.common.v1.ServiceInfoRequest
0, // 3: stocklet.shipping.v1.ShippingService.ViewShipment:input_type -> stocklet.shipping.v1.ViewShipmentRequest
2, // 4: stocklet.shipping.v1.ShippingService.ViewShipmentManifest:input_type -> stocklet.shipping.v1.ViewShipmentManifestRequest
7, // 5: stocklet.shipping.v1.ShippingService.ProcessStockReservationEvent:input_type -> stocklet.events.v1.StockReservationEvent
8, // 6: stocklet.shipping.v1.ShippingService.ProcessPaymentProcessedEvent:input_type -> stocklet.events.v1.PaymentProcessedEvent
9, // 7: stocklet.shipping.v1.ShippingService.ServiceInfo:output_type -> stocklet.common.v1.ServiceInfoResponse
1, // 8: stocklet.shipping.v1.ShippingService.ViewShipment:output_type -> stocklet.shipping.v1.ViewShipmentResponse
3, // 9: stocklet.shipping.v1.ShippingService.ViewShipmentManifest:output_type -> stocklet.shipping.v1.ViewShipmentManifestResponse
10, // 10: stocklet.shipping.v1.ShippingService.ProcessStockReservationEvent:output_type -> google.protobuf.Empty
10, // 11: stocklet.shipping.v1.ShippingService.ProcessPaymentProcessedEvent:output_type -> google.protobuf.Empty
7, // [7:12] is the sub-list for method output_type
2, // [2:7] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_stocklet_shipping_v1_service_proto_init() }
func file_stocklet_shipping_v1_service_proto_init() {
if File_stocklet_shipping_v1_service_proto != nil {
return
}
file_stocklet_shipping_v1_types_proto_init()
if !protoimpl.UnsafeEnabled {
file_stocklet_shipping_v1_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewShipmentRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_shipping_v1_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewShipmentResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_shipping_v1_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewShipmentManifestRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_shipping_v1_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewShipmentManifestResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_shipping_v1_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_stocklet_shipping_v1_service_proto_goTypes,
DependencyIndexes: file_stocklet_shipping_v1_service_proto_depIdxs,
MessageInfos: file_stocklet_shipping_v1_service_proto_msgTypes,
}.Build()
File_stocklet_shipping_v1_service_proto = out.File
file_stocklet_shipping_v1_service_proto_rawDesc = nil
file_stocklet_shipping_v1_service_proto_goTypes = nil
file_stocklet_shipping_v1_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,362 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: stocklet/shipping/v1/service.proto
/*
Package shipping_v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package shipping_v1
import (
"context"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = metadata.Join
func request_ShippingService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, client ShippingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := client.ServiceInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_ShippingService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, server ShippingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := server.ServiceInfo(ctx, &protoReq)
return msg, metadata, err
}
func request_ShippingService_ViewShipment_0(ctx context.Context, marshaler runtime.Marshaler, client ShippingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewShipmentRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["shipment_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shipment_id")
}
protoReq.ShipmentId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shipment_id", err)
}
msg, err := client.ViewShipment(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_ShippingService_ViewShipment_0(ctx context.Context, marshaler runtime.Marshaler, server ShippingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewShipmentRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["shipment_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shipment_id")
}
protoReq.ShipmentId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shipment_id", err)
}
msg, err := server.ViewShipment(ctx, &protoReq)
return msg, metadata, err
}
func request_ShippingService_ViewShipmentManifest_0(ctx context.Context, marshaler runtime.Marshaler, client ShippingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewShipmentManifestRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["shipment_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shipment_id")
}
protoReq.ShipmentId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shipment_id", err)
}
msg, err := client.ViewShipmentManifest(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_ShippingService_ViewShipmentManifest_0(ctx context.Context, marshaler runtime.Marshaler, server ShippingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewShipmentManifestRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["shipment_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shipment_id")
}
protoReq.ShipmentId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shipment_id", err)
}
msg, err := server.ViewShipmentManifest(ctx, &protoReq)
return msg, metadata, err
}
// RegisterShippingServiceHandlerServer registers the http handlers for service ShippingService to "mux".
// UnaryRPC :call ShippingServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterShippingServiceHandlerFromEndpoint instead.
func RegisterShippingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ShippingServiceServer) error {
mux.Handle("GET", pattern_ShippingService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.shipping.v1.ShippingService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/shipping/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_ShippingService_ServiceInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_ShippingService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_ShippingService_ViewShipment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.shipping.v1.ShippingService/ViewShipment", runtime.WithHTTPPathPattern("/v1/shipping/shipment/{shipment_id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_ShippingService_ViewShipment_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_ShippingService_ViewShipment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_ShippingService_ViewShipmentManifest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.shipping.v1.ShippingService/ViewShipmentManifest", runtime.WithHTTPPathPattern("/v1/shipping/shipment/{shipment_id}/manifest"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_ShippingService_ViewShipmentManifest_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_ShippingService_ViewShipmentManifest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterShippingServiceHandlerFromEndpoint is same as RegisterShippingServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterShippingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.DialContext(ctx, endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterShippingServiceHandler(ctx, mux, conn)
}
// RegisterShippingServiceHandler registers the http handlers for service ShippingService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterShippingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterShippingServiceHandlerClient(ctx, mux, NewShippingServiceClient(conn))
}
// RegisterShippingServiceHandlerClient registers the http handlers for service ShippingService
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ShippingServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ShippingServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "ShippingServiceClient" to call the correct interceptors.
func RegisterShippingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ShippingServiceClient) error {
mux.Handle("GET", pattern_ShippingService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.shipping.v1.ShippingService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/shipping/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_ShippingService_ServiceInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_ShippingService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_ShippingService_ViewShipment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.shipping.v1.ShippingService/ViewShipment", runtime.WithHTTPPathPattern("/v1/shipping/shipment/{shipment_id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_ShippingService_ViewShipment_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_ShippingService_ViewShipment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_ShippingService_ViewShipmentManifest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.shipping.v1.ShippingService/ViewShipmentManifest", runtime.WithHTTPPathPattern("/v1/shipping/shipment/{shipment_id}/manifest"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_ShippingService_ViewShipmentManifest_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_ShippingService_ViewShipmentManifest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_ShippingService_ServiceInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "shipping", "service"}, ""))
pattern_ShippingService_ViewShipment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "shipping", "shipment", "shipment_id"}, ""))
pattern_ShippingService_ViewShipmentManifest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"v1", "shipping", "shipment", "shipment_id", "manifest"}, ""))
)
var (
forward_ShippingService_ServiceInfo_0 = runtime.ForwardResponseMessage
forward_ShippingService_ViewShipment_0 = runtime.ForwardResponseMessage
forward_ShippingService_ViewShipmentManifest_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,301 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: stocklet/shipping/v1/service.proto
package shipping_v1
import (
context "context"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
v11 "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
ShippingService_ServiceInfo_FullMethodName = "/stocklet.shipping.v1.ShippingService/ServiceInfo"
ShippingService_ViewShipment_FullMethodName = "/stocklet.shipping.v1.ShippingService/ViewShipment"
ShippingService_ViewShipmentManifest_FullMethodName = "/stocklet.shipping.v1.ShippingService/ViewShipmentManifest"
ShippingService_ProcessStockReservationEvent_FullMethodName = "/stocklet.shipping.v1.ShippingService/ProcessStockReservationEvent"
ShippingService_ProcessPaymentProcessedEvent_FullMethodName = "/stocklet.shipping.v1.ShippingService/ProcessPaymentProcessedEvent"
)
// ShippingServiceClient is the client API for ShippingService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ShippingServiceClient interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error)
ViewShipment(ctx context.Context, in *ViewShipmentRequest, opts ...grpc.CallOption) (*ViewShipmentResponse, error)
ViewShipmentManifest(ctx context.Context, in *ViewShipmentManifestRequest, opts ...grpc.CallOption) (*ViewShipmentManifestResponse, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessStockReservationEvent(ctx context.Context, in *v11.StockReservationEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessPaymentProcessedEvent(ctx context.Context, in *v11.PaymentProcessedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type shippingServiceClient struct {
cc grpc.ClientConnInterface
}
func NewShippingServiceClient(cc grpc.ClientConnInterface) ShippingServiceClient {
return &shippingServiceClient{cc}
}
func (c *shippingServiceClient) ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error) {
out := new(v1.ServiceInfoResponse)
err := c.cc.Invoke(ctx, ShippingService_ServiceInfo_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *shippingServiceClient) ViewShipment(ctx context.Context, in *ViewShipmentRequest, opts ...grpc.CallOption) (*ViewShipmentResponse, error) {
out := new(ViewShipmentResponse)
err := c.cc.Invoke(ctx, ShippingService_ViewShipment_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *shippingServiceClient) ViewShipmentManifest(ctx context.Context, in *ViewShipmentManifestRequest, opts ...grpc.CallOption) (*ViewShipmentManifestResponse, error) {
out := new(ViewShipmentManifestResponse)
err := c.cc.Invoke(ctx, ShippingService_ViewShipmentManifest_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *shippingServiceClient) ProcessStockReservationEvent(ctx context.Context, in *v11.StockReservationEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, ShippingService_ProcessStockReservationEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *shippingServiceClient) ProcessPaymentProcessedEvent(ctx context.Context, in *v11.PaymentProcessedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, ShippingService_ProcessPaymentProcessedEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ShippingServiceServer is the server API for ShippingService service.
// All implementations must embed UnimplementedShippingServiceServer
// for forward compatibility
type ShippingServiceServer interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error)
ViewShipment(context.Context, *ViewShipmentRequest) (*ViewShipmentResponse, error)
ViewShipmentManifest(context.Context, *ViewShipmentManifestRequest) (*ViewShipmentManifestResponse, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessStockReservationEvent(context.Context, *v11.StockReservationEvent) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessPaymentProcessedEvent(context.Context, *v11.PaymentProcessedEvent) (*emptypb.Empty, error)
mustEmbedUnimplementedShippingServiceServer()
}
// UnimplementedShippingServiceServer must be embedded to have forward compatible implementations.
type UnimplementedShippingServiceServer struct {
}
func (UnimplementedShippingServiceServer) ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ServiceInfo not implemented")
}
func (UnimplementedShippingServiceServer) ViewShipment(context.Context, *ViewShipmentRequest) (*ViewShipmentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ViewShipment not implemented")
}
func (UnimplementedShippingServiceServer) ViewShipmentManifest(context.Context, *ViewShipmentManifestRequest) (*ViewShipmentManifestResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ViewShipmentManifest not implemented")
}
func (UnimplementedShippingServiceServer) ProcessStockReservationEvent(context.Context, *v11.StockReservationEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessStockReservationEvent not implemented")
}
func (UnimplementedShippingServiceServer) ProcessPaymentProcessedEvent(context.Context, *v11.PaymentProcessedEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessPaymentProcessedEvent not implemented")
}
func (UnimplementedShippingServiceServer) mustEmbedUnimplementedShippingServiceServer() {}
// UnsafeShippingServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ShippingServiceServer will
// result in compilation errors.
type UnsafeShippingServiceServer interface {
mustEmbedUnimplementedShippingServiceServer()
}
func RegisterShippingServiceServer(s grpc.ServiceRegistrar, srv ShippingServiceServer) {
s.RegisterService(&ShippingService_ServiceDesc, srv)
}
func _ShippingService_ServiceInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v1.ServiceInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ShippingServiceServer).ServiceInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ShippingService_ServiceInfo_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShippingServiceServer).ServiceInfo(ctx, req.(*v1.ServiceInfoRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ShippingService_ViewShipment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ViewShipmentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ShippingServiceServer).ViewShipment(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ShippingService_ViewShipment_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShippingServiceServer).ViewShipment(ctx, req.(*ViewShipmentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ShippingService_ViewShipmentManifest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ViewShipmentManifestRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ShippingServiceServer).ViewShipmentManifest(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ShippingService_ViewShipmentManifest_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShippingServiceServer).ViewShipmentManifest(ctx, req.(*ViewShipmentManifestRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ShippingService_ProcessStockReservationEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.StockReservationEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ShippingServiceServer).ProcessStockReservationEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ShippingService_ProcessStockReservationEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShippingServiceServer).ProcessStockReservationEvent(ctx, req.(*v11.StockReservationEvent))
}
return interceptor(ctx, in, info, handler)
}
func _ShippingService_ProcessPaymentProcessedEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.PaymentProcessedEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ShippingServiceServer).ProcessPaymentProcessedEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ShippingService_ProcessPaymentProcessedEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShippingServiceServer).ProcessPaymentProcessedEvent(ctx, req.(*v11.PaymentProcessedEvent))
}
return interceptor(ctx, in, info, handler)
}
// ShippingService_ServiceDesc is the grpc.ServiceDesc for ShippingService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ShippingService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "stocklet.shipping.v1.ShippingService",
HandlerType: (*ShippingServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ServiceInfo",
Handler: _ShippingService_ServiceInfo_Handler,
},
{
MethodName: "ViewShipment",
Handler: _ShippingService_ViewShipment_Handler,
},
{
MethodName: "ViewShipmentManifest",
Handler: _ShippingService_ViewShipmentManifest_Handler,
},
{
MethodName: "ProcessStockReservationEvent",
Handler: _ShippingService_ProcessStockReservationEvent_Handler,
},
{
MethodName: "ProcessPaymentProcessedEvent",
Handler: _ShippingService_ProcessPaymentProcessedEvent_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "stocklet/shipping/v1/service.proto",
}

View File

@@ -0,0 +1,292 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/shipping/v1/types.proto
package shipping_v1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Shipment struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
OrderId string `protobuf:"bytes,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
Dispatched bool `protobuf:"varint,3,opt,name=dispatched,proto3" json:"dispatched,omitempty"`
CreatedAt int64 `protobuf:"varint,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
UpdatedAt *int64 `protobuf:"varint,6,opt,name=updated_at,json=updatedAt,proto3,oneof" json:"updated_at,omitempty"`
}
func (x *Shipment) Reset() {
*x = Shipment{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_shipping_v1_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Shipment) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Shipment) ProtoMessage() {}
func (x *Shipment) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_shipping_v1_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Shipment.ProtoReflect.Descriptor instead.
func (*Shipment) Descriptor() ([]byte, []int) {
return file_stocklet_shipping_v1_types_proto_rawDescGZIP(), []int{0}
}
func (x *Shipment) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *Shipment) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *Shipment) GetDispatched() bool {
if x != nil {
return x.Dispatched
}
return false
}
func (x *Shipment) GetCreatedAt() int64 {
if x != nil {
return x.CreatedAt
}
return 0
}
func (x *Shipment) GetUpdatedAt() int64 {
if x != nil && x.UpdatedAt != nil {
return *x.UpdatedAt
}
return 0
}
type ShipmentItem struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ShipmentId string `protobuf:"bytes,1,opt,name=shipment_id,json=shipmentId,proto3" json:"shipment_id,omitempty"`
ProductId string `protobuf:"bytes,2,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
Quantity int32 `protobuf:"varint,3,opt,name=quantity,proto3" json:"quantity,omitempty"`
}
func (x *ShipmentItem) Reset() {
*x = ShipmentItem{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_shipping_v1_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ShipmentItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ShipmentItem) ProtoMessage() {}
func (x *ShipmentItem) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_shipping_v1_types_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ShipmentItem.ProtoReflect.Descriptor instead.
func (*ShipmentItem) Descriptor() ([]byte, []int) {
return file_stocklet_shipping_v1_types_proto_rawDescGZIP(), []int{1}
}
func (x *ShipmentItem) GetShipmentId() string {
if x != nil {
return x.ShipmentId
}
return ""
}
func (x *ShipmentItem) GetProductId() string {
if x != nil {
return x.ProductId
}
return ""
}
func (x *ShipmentItem) GetQuantity() int32 {
if x != nil {
return x.Quantity
}
return 0
}
var File_stocklet_shipping_v1_types_proto protoreflect.FileDescriptor
var file_stocklet_shipping_v1_types_proto_rawDesc = []byte{
0x0a, 0x20, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x70,
0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x14, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x73, 0x68, 0x69,
0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb9, 0x01, 0x0a, 0x08, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65,
0x6e, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07,
0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x08, 0x6f,
0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba,
0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12,
0x1e, 0x0a, 0x0a, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, 0x18, 0x03, 0x20,
0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, 0x12,
0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20,
0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x22,
0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01,
0x28, 0x03, 0x48, 0x00, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x88,
0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61,
0x74, 0x22, 0x85, 0x01, 0x0a, 0x0c, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x74,
0x65, 0x6d, 0x12, 0x28, 0x0a, 0x0b, 0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01,
0x52, 0x0a, 0x73, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0a,
0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79,
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x42, 0x07, 0xba, 0x48, 0x04, 0x1a, 0x02, 0x20, 0x00, 0x52,
0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x42, 0x4b, 0x5a, 0x49, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,
0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x73,
0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x68, 0x69, 0x70, 0x70,
0x69, 0x6e, 0x67, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_shipping_v1_types_proto_rawDescOnce sync.Once
file_stocklet_shipping_v1_types_proto_rawDescData = file_stocklet_shipping_v1_types_proto_rawDesc
)
func file_stocklet_shipping_v1_types_proto_rawDescGZIP() []byte {
file_stocklet_shipping_v1_types_proto_rawDescOnce.Do(func() {
file_stocklet_shipping_v1_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_shipping_v1_types_proto_rawDescData)
})
return file_stocklet_shipping_v1_types_proto_rawDescData
}
var file_stocklet_shipping_v1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_stocklet_shipping_v1_types_proto_goTypes = []interface{}{
(*Shipment)(nil), // 0: stocklet.shipping.v1.Shipment
(*ShipmentItem)(nil), // 1: stocklet.shipping.v1.ShipmentItem
}
var file_stocklet_shipping_v1_types_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_stocklet_shipping_v1_types_proto_init() }
func file_stocklet_shipping_v1_types_proto_init() {
if File_stocklet_shipping_v1_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_shipping_v1_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Shipment); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_shipping_v1_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ShipmentItem); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_stocklet_shipping_v1_types_proto_msgTypes[0].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_shipping_v1_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_shipping_v1_types_proto_goTypes,
DependencyIndexes: file_stocklet_shipping_v1_types_proto_depIdxs,
MessageInfos: file_stocklet_shipping_v1_types_proto_msgTypes,
}.Build()
File_stocklet_shipping_v1_types_proto = out.File
file_stocklet_shipping_v1_types_proto_rawDesc = nil
file_stocklet_shipping_v1_types_proto_goTypes = nil
file_stocklet_shipping_v1_types_proto_depIdxs = nil
}

View File

@@ -0,0 +1,96 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/stocklet.proto
// buf:lint:ignore PACKAGE_VERSION_SUFFIX
package protogen
import (
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
var File_stocklet_stocklet_proto protoreflect.FileDescriptor
var file_stocklet_stocklet_proto_rawDesc = []byte{
0x0a, 0x17, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x73, 0x74, 0x6f, 0x63, 0x6b,
0x6c, 0x65, 0x74, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d,
0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x42, 0xd6, 0x01, 0x92, 0x41, 0x9f, 0x01, 0x12, 0x8e, 0x01, 0x0a, 0x08, 0x53,
0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x22, 0x38, 0x0a, 0x11, 0x47, 0x69, 0x74, 0x48, 0x75,
0x62, 0x20, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x23, 0x68, 0x74,
0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65,
0x74, 0x2a, 0x41, 0x0a, 0x08, 0x41, 0x47, 0x50, 0x4c, 0x2d, 0x33, 0x2e, 0x30, 0x12, 0x35, 0x68,
0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c,
0x65, 0x74, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x69, 0x6e, 0x2f, 0x4c, 0x49, 0x43,
0x45, 0x4e, 0x53, 0x45, 0x32, 0x05, 0x30, 0x2e, 0x31, 0x2e, 0x30, 0x1a, 0x09, 0x6c, 0x6f, 0x63,
0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x2a, 0x01, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74,
0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f,
0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var file_stocklet_stocklet_proto_goTypes = []interface{}{}
var file_stocklet_stocklet_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_stocklet_stocklet_proto_init() }
func file_stocklet_stocklet_proto_init() {
if File_stocklet_stocklet_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_stocklet_proto_rawDesc,
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_stocklet_proto_goTypes,
DependencyIndexes: file_stocklet_stocklet_proto_depIdxs,
}.Build()
File_stocklet_stocklet_proto = out.File
file_stocklet_stocklet_proto_rawDesc = nil
file_stocklet_stocklet_proto_goTypes = nil
file_stocklet_stocklet_proto_depIdxs = nil
}

View File

@@ -0,0 +1,434 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/user/v1/service.proto
package user_v1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ViewUserRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (x *ViewUserRequest) Reset() {
*x = ViewUserRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_user_v1_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewUserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewUserRequest) ProtoMessage() {}
func (x *ViewUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_user_v1_service_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewUserRequest.ProtoReflect.Descriptor instead.
func (*ViewUserRequest) Descriptor() ([]byte, []int) {
return file_stocklet_user_v1_service_proto_rawDescGZIP(), []int{0}
}
func (x *ViewUserRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
type ViewUserResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
}
func (x *ViewUserResponse) Reset() {
*x = ViewUserResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_user_v1_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewUserResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewUserResponse) ProtoMessage() {}
func (x *ViewUserResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_user_v1_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewUserResponse.ProtoReflect.Descriptor instead.
func (*ViewUserResponse) Descriptor() ([]byte, []int) {
return file_stocklet_user_v1_service_proto_rawDescGZIP(), []int{1}
}
func (x *ViewUserResponse) GetUser() *User {
if x != nil {
return x.User
}
return nil
}
type RegisterUserRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
FirstName string `protobuf:"bytes,1,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"`
LastName string `protobuf:"bytes,2,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"`
Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"`
}
func (x *RegisterUserRequest) Reset() {
*x = RegisterUserRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_user_v1_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RegisterUserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RegisterUserRequest) ProtoMessage() {}
func (x *RegisterUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_user_v1_service_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RegisterUserRequest.ProtoReflect.Descriptor instead.
func (*RegisterUserRequest) Descriptor() ([]byte, []int) {
return file_stocklet_user_v1_service_proto_rawDescGZIP(), []int{2}
}
func (x *RegisterUserRequest) GetFirstName() string {
if x != nil {
return x.FirstName
}
return ""
}
func (x *RegisterUserRequest) GetLastName() string {
if x != nil {
return x.LastName
}
return ""
}
func (x *RegisterUserRequest) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
func (x *RegisterUserRequest) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
type RegisterUserResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
}
func (x *RegisterUserResponse) Reset() {
*x = RegisterUserResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_user_v1_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RegisterUserResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RegisterUserResponse) ProtoMessage() {}
func (x *RegisterUserResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_user_v1_service_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RegisterUserResponse.ProtoReflect.Descriptor instead.
func (*RegisterUserResponse) Descriptor() ([]byte, []int) {
return file_stocklet_user_v1_service_proto_rawDescGZIP(), []int{3}
}
func (x *RegisterUserResponse) GetUser() *User {
if x != nil {
return x.User
}
return nil
}
var File_stocklet_user_v1_service_proto protoreflect.FileDescriptor
var file_stocklet_user_v1_service_proto_rawDesc = []byte{
0x0a, 0x1e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f,
0x76, 0x31, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x10, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e,
0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65,
0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f,
0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f,
0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f,
0x76, 0x31, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x1c, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x75, 0x73, 0x65, 0x72,
0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x2a, 0x0a, 0x0f, 0x56, 0x69, 0x65, 0x77, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07,
0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x02, 0x69, 0x64, 0x22, 0x3e, 0x0a, 0x10, 0x56,
0x69, 0x65, 0x77, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x2a, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31,
0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0xb9, 0x01, 0x0a, 0x13,
0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x0a, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0c, 0xe0, 0x41, 0x02, 0xba, 0x48, 0x06, 0x72,
0x04, 0x10, 0x01, 0x18, 0x23, 0x52, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65,
0x12, 0x29, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x42, 0x0c, 0xe0, 0x41, 0x02, 0xba, 0x48, 0x06, 0x72, 0x04, 0x10, 0x01, 0x18,
0x23, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x05, 0x65,
0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xe0, 0x41, 0x02, 0xba,
0x48, 0x04, 0x72, 0x02, 0x60, 0x01, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x28, 0x0a,
0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42,
0x0c, 0xe0, 0x41, 0x02, 0xba, 0x48, 0x06, 0x72, 0x04, 0x10, 0x01, 0x18, 0x40, 0x52, 0x08, 0x70,
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x42, 0x0a, 0x14, 0x52, 0x65, 0x67, 0x69, 0x73,
0x74, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x2a, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31,
0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x32, 0xf1, 0x02, 0x0a, 0x0b,
0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x78, 0x0a, 0x0b, 0x53,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x73, 0x74, 0x6f,
0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x63, 0x6f,
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4,
0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x73, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6e, 0x0a, 0x08, 0x56, 0x69, 0x65, 0x77, 0x55, 0x73, 0x65,
0x72, 0x12, 0x21, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x75, 0x73, 0x65,
0x72, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e,
0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x55, 0x73, 0x65, 0x72,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15,
0x12, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73,
0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x78, 0x0a, 0x0c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
0x72, 0x55, 0x73, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74,
0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
0x72, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x73,
0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e,
0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x11, 0x2f, 0x76,
0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x42,
0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x65,
0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x75, 0x73, 0x65,
0x72, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_user_v1_service_proto_rawDescOnce sync.Once
file_stocklet_user_v1_service_proto_rawDescData = file_stocklet_user_v1_service_proto_rawDesc
)
func file_stocklet_user_v1_service_proto_rawDescGZIP() []byte {
file_stocklet_user_v1_service_proto_rawDescOnce.Do(func() {
file_stocklet_user_v1_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_user_v1_service_proto_rawDescData)
})
return file_stocklet_user_v1_service_proto_rawDescData
}
var file_stocklet_user_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_stocklet_user_v1_service_proto_goTypes = []interface{}{
(*ViewUserRequest)(nil), // 0: stocklet.user.v1.ViewUserRequest
(*ViewUserResponse)(nil), // 1: stocklet.user.v1.ViewUserResponse
(*RegisterUserRequest)(nil), // 2: stocklet.user.v1.RegisterUserRequest
(*RegisterUserResponse)(nil), // 3: stocklet.user.v1.RegisterUserResponse
(*User)(nil), // 4: stocklet.user.v1.User
(*v1.ServiceInfoRequest)(nil), // 5: stocklet.common.v1.ServiceInfoRequest
(*v1.ServiceInfoResponse)(nil), // 6: stocklet.common.v1.ServiceInfoResponse
}
var file_stocklet_user_v1_service_proto_depIdxs = []int32{
4, // 0: stocklet.user.v1.ViewUserResponse.user:type_name -> stocklet.user.v1.User
4, // 1: stocklet.user.v1.RegisterUserResponse.user:type_name -> stocklet.user.v1.User
5, // 2: stocklet.user.v1.UserService.ServiceInfo:input_type -> stocklet.common.v1.ServiceInfoRequest
0, // 3: stocklet.user.v1.UserService.ViewUser:input_type -> stocklet.user.v1.ViewUserRequest
2, // 4: stocklet.user.v1.UserService.RegisterUser:input_type -> stocklet.user.v1.RegisterUserRequest
6, // 5: stocklet.user.v1.UserService.ServiceInfo:output_type -> stocklet.common.v1.ServiceInfoResponse
1, // 6: stocklet.user.v1.UserService.ViewUser:output_type -> stocklet.user.v1.ViewUserResponse
3, // 7: stocklet.user.v1.UserService.RegisterUser:output_type -> stocklet.user.v1.RegisterUserResponse
5, // [5:8] is the sub-list for method output_type
2, // [2:5] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_stocklet_user_v1_service_proto_init() }
func file_stocklet_user_v1_service_proto_init() {
if File_stocklet_user_v1_service_proto != nil {
return
}
file_stocklet_user_v1_types_proto_init()
if !protoimpl.UnsafeEnabled {
file_stocklet_user_v1_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewUserRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_user_v1_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewUserResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_user_v1_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RegisterUserRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_user_v1_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RegisterUserResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_user_v1_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_stocklet_user_v1_service_proto_goTypes,
DependencyIndexes: file_stocklet_user_v1_service_proto_depIdxs,
MessageInfos: file_stocklet_user_v1_service_proto_msgTypes,
}.Build()
File_stocklet_user_v1_service_proto = out.File
file_stocklet_user_v1_service_proto_rawDesc = nil
file_stocklet_user_v1_service_proto_goTypes = nil
file_stocklet_user_v1_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,346 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: stocklet/user/v1/service.proto
/*
Package user_v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package user_v1
import (
"context"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = metadata.Join
func request_UserService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := client.ServiceInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_UserService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := server.ServiceInfo(ctx, &protoReq)
return msg, metadata, err
}
func request_UserService_ViewUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewUserRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := client.ViewUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_UserService_ViewUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewUserRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := server.ViewUser(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_UserService_RegisterUser_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_UserService_RegisterUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq RegisterUserRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_RegisterUser_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.RegisterUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_UserService_RegisterUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq RegisterUserRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_RegisterUser_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.RegisterUser(ctx, &protoReq)
return msg, metadata, err
}
// RegisterUserServiceHandlerServer registers the http handlers for service UserService to "mux".
// UnaryRPC :call UserServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUserServiceHandlerFromEndpoint instead.
func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error {
mux.Handle("GET", pattern_UserService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.user.v1.UserService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/user/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_UserService_ServiceInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_UserService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_UserService_ViewUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.user.v1.UserService/ViewUser", runtime.WithHTTPPathPattern("/v1/user/users/{id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_UserService_ViewUser_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_UserService_ViewUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_UserService_RegisterUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.user.v1.UserService/RegisterUser", runtime.WithHTTPPathPattern("/v1/user/register"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_UserService_RegisterUser_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_UserService_RegisterUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterUserServiceHandlerFromEndpoint is same as RegisterUserServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.DialContext(ctx, endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterUserServiceHandler(ctx, mux, conn)
}
// RegisterUserServiceHandler registers the http handlers for service UserService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterUserServiceHandlerClient(ctx, mux, NewUserServiceClient(conn))
}
// RegisterUserServiceHandlerClient registers the http handlers for service UserService
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "UserServiceClient" to call the correct interceptors.
func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error {
mux.Handle("GET", pattern_UserService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.user.v1.UserService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/user/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_UserService_ServiceInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_UserService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_UserService_ViewUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.user.v1.UserService/ViewUser", runtime.WithHTTPPathPattern("/v1/user/users/{id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_UserService_ViewUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_UserService_ViewUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_UserService_RegisterUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.user.v1.UserService/RegisterUser", runtime.WithHTTPPathPattern("/v1/user/register"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_UserService_RegisterUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_UserService_RegisterUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_UserService_ServiceInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "user", "service"}, ""))
pattern_UserService_ViewUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "user", "users", "id"}, ""))
pattern_UserService_RegisterUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "user", "register"}, ""))
)
var (
forward_UserService_ServiceInfo_0 = runtime.ForwardResponseMessage
forward_UserService_ViewUser_0 = runtime.ForwardResponseMessage
forward_UserService_RegisterUser_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,205 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: stocklet/user/v1/service.proto
package user_v1
import (
context "context"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
UserService_ServiceInfo_FullMethodName = "/stocklet.user.v1.UserService/ServiceInfo"
UserService_ViewUser_FullMethodName = "/stocklet.user.v1.UserService/ViewUser"
UserService_RegisterUser_FullMethodName = "/stocklet.user.v1.UserService/RegisterUser"
)
// UserServiceClient is the client API for UserService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type UserServiceClient interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error)
ViewUser(ctx context.Context, in *ViewUserRequest, opts ...grpc.CallOption) (*ViewUserResponse, error)
RegisterUser(ctx context.Context, in *RegisterUserRequest, opts ...grpc.CallOption) (*RegisterUserResponse, error)
}
type userServiceClient struct {
cc grpc.ClientConnInterface
}
func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient {
return &userServiceClient{cc}
}
func (c *userServiceClient) ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error) {
out := new(v1.ServiceInfoResponse)
err := c.cc.Invoke(ctx, UserService_ServiceInfo_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userServiceClient) ViewUser(ctx context.Context, in *ViewUserRequest, opts ...grpc.CallOption) (*ViewUserResponse, error) {
out := new(ViewUserResponse)
err := c.cc.Invoke(ctx, UserService_ViewUser_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userServiceClient) RegisterUser(ctx context.Context, in *RegisterUserRequest, opts ...grpc.CallOption) (*RegisterUserResponse, error) {
out := new(RegisterUserResponse)
err := c.cc.Invoke(ctx, UserService_RegisterUser_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// UserServiceServer is the server API for UserService service.
// All implementations must embed UnimplementedUserServiceServer
// for forward compatibility
type UserServiceServer interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error)
ViewUser(context.Context, *ViewUserRequest) (*ViewUserResponse, error)
RegisterUser(context.Context, *RegisterUserRequest) (*RegisterUserResponse, error)
mustEmbedUnimplementedUserServiceServer()
}
// UnimplementedUserServiceServer must be embedded to have forward compatible implementations.
type UnimplementedUserServiceServer struct {
}
func (UnimplementedUserServiceServer) ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ServiceInfo not implemented")
}
func (UnimplementedUserServiceServer) ViewUser(context.Context, *ViewUserRequest) (*ViewUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ViewUser not implemented")
}
func (UnimplementedUserServiceServer) RegisterUser(context.Context, *RegisterUserRequest) (*RegisterUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RegisterUser not implemented")
}
func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {}
// UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to UserServiceServer will
// result in compilation errors.
type UnsafeUserServiceServer interface {
mustEmbedUnimplementedUserServiceServer()
}
func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) {
s.RegisterService(&UserService_ServiceDesc, srv)
}
func _UserService_ServiceInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v1.ServiceInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserServiceServer).ServiceInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: UserService_ServiceInfo_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).ServiceInfo(ctx, req.(*v1.ServiceInfoRequest))
}
return interceptor(ctx, in, info, handler)
}
func _UserService_ViewUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ViewUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserServiceServer).ViewUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: UserService_ViewUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).ViewUser(ctx, req.(*ViewUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _UserService_RegisterUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RegisterUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserServiceServer).RegisterUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: UserService_RegisterUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).RegisterUser(ctx, req.(*RegisterUserRequest))
}
return interceptor(ctx, in, info, handler)
}
// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var UserService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "stocklet.user.v1.UserService",
HandlerType: (*UserServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ServiceInfo",
Handler: _UserService_ServiceInfo_Handler,
},
{
MethodName: "ViewUser",
Handler: _UserService_ViewUser_Handler,
},
{
MethodName: "RegisterUser",
Handler: _UserService_RegisterUser_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "stocklet/user/v1/service.proto",
}

View File

@@ -0,0 +1,217 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/user/v1/types.proto
package user_v1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type User struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
FirstName string `protobuf:"bytes,3,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"`
LastName string `protobuf:"bytes,4,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"`
CreatedAt int64 `protobuf:"varint,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
UpdatedAt *int64 `protobuf:"varint,6,opt,name=updated_at,json=updatedAt,proto3,oneof" json:"updated_at,omitempty"`
}
func (x *User) Reset() {
*x = User{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_user_v1_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *User) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*User) ProtoMessage() {}
func (x *User) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_user_v1_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use User.ProtoReflect.Descriptor instead.
func (*User) Descriptor() ([]byte, []int) {
return file_stocklet_user_v1_types_proto_rawDescGZIP(), []int{0}
}
func (x *User) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *User) GetEmail() string {
if x != nil {
return x.Email
}
return ""
}
func (x *User) GetFirstName() string {
if x != nil {
return x.FirstName
}
return ""
}
func (x *User) GetLastName() string {
if x != nil {
return x.LastName
}
return ""
}
func (x *User) GetCreatedAt() int64 {
if x != nil {
return x.CreatedAt
}
return 0
}
func (x *User) GetUpdatedAt() int64 {
if x != nil && x.UpdatedAt != nil {
return *x.UpdatedAt
}
return 0
}
var File_stocklet_user_v1_types_proto protoreflect.FileDescriptor
var file_stocklet_user_v1_types_proto_rawDesc = []byte{
0x0a, 0x1c, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f,
0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31,
0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76,
0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe2, 0x01,
0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12,
0x1d, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07,
0xba, 0x48, 0x04, 0x72, 0x02, 0x60, 0x01, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x28,
0x0a, 0x0a, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x42, 0x09, 0xba, 0x48, 0x06, 0x72, 0x04, 0x10, 0x01, 0x18, 0x23, 0x52, 0x09, 0x66,
0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74,
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, 0xba, 0x48, 0x06,
0x72, 0x04, 0x10, 0x01, 0x18, 0x23, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65,
0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05,
0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12,
0x22, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20,
0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74,
0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f,
0x61, 0x74, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65,
0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b,
0x75, 0x73, 0x65, 0x72, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_user_v1_types_proto_rawDescOnce sync.Once
file_stocklet_user_v1_types_proto_rawDescData = file_stocklet_user_v1_types_proto_rawDesc
)
func file_stocklet_user_v1_types_proto_rawDescGZIP() []byte {
file_stocklet_user_v1_types_proto_rawDescOnce.Do(func() {
file_stocklet_user_v1_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_user_v1_types_proto_rawDescData)
})
return file_stocklet_user_v1_types_proto_rawDescData
}
var file_stocklet_user_v1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_stocklet_user_v1_types_proto_goTypes = []interface{}{
(*User)(nil), // 0: stocklet.user.v1.User
}
var file_stocklet_user_v1_types_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_stocklet_user_v1_types_proto_init() }
func file_stocklet_user_v1_types_proto_init() {
if File_stocklet_user_v1_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_user_v1_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*User); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_stocklet_user_v1_types_proto_msgTypes[0].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_user_v1_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_user_v1_types_proto_goTypes,
DependencyIndexes: file_stocklet_user_v1_types_proto_depIdxs,
MessageInfos: file_stocklet_user_v1_types_proto_msgTypes,
}.Build()
File_stocklet_user_v1_types_proto = out.File
file_stocklet_user_v1_types_proto_rawDesc = nil
file_stocklet_user_v1_types_proto_goTypes = nil
file_stocklet_user_v1_types_proto_depIdxs = nil
}

View File

@@ -0,0 +1,472 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/warehouse/v1/service.proto
package warehouse_v1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
v11 "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1"
_ "google.golang.org/genproto/googleapis/api/annotations"
_ "google.golang.org/genproto/googleapis/api/visibility"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ViewProductStockRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
}
func (x *ViewProductStockRequest) Reset() {
*x = ViewProductStockRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_warehouse_v1_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewProductStockRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewProductStockRequest) ProtoMessage() {}
func (x *ViewProductStockRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_warehouse_v1_service_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewProductStockRequest.ProtoReflect.Descriptor instead.
func (*ViewProductStockRequest) Descriptor() ([]byte, []int) {
return file_stocklet_warehouse_v1_service_proto_rawDescGZIP(), []int{0}
}
func (x *ViewProductStockRequest) GetProductId() string {
if x != nil {
return x.ProductId
}
return ""
}
type ViewProductStockResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Stock *ProductStock `protobuf:"bytes,1,opt,name=stock,proto3" json:"stock,omitempty"`
}
func (x *ViewProductStockResponse) Reset() {
*x = ViewProductStockResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_warehouse_v1_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewProductStockResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewProductStockResponse) ProtoMessage() {}
func (x *ViewProductStockResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_warehouse_v1_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewProductStockResponse.ProtoReflect.Descriptor instead.
func (*ViewProductStockResponse) Descriptor() ([]byte, []int) {
return file_stocklet_warehouse_v1_service_proto_rawDescGZIP(), []int{1}
}
func (x *ViewProductStockResponse) GetStock() *ProductStock {
if x != nil {
return x.Stock
}
return nil
}
type ViewReservationRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ReservationId string `protobuf:"bytes,1,opt,name=reservation_id,json=reservationId,proto3" json:"reservation_id,omitempty"`
}
func (x *ViewReservationRequest) Reset() {
*x = ViewReservationRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_warehouse_v1_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewReservationRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewReservationRequest) ProtoMessage() {}
func (x *ViewReservationRequest) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_warehouse_v1_service_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewReservationRequest.ProtoReflect.Descriptor instead.
func (*ViewReservationRequest) Descriptor() ([]byte, []int) {
return file_stocklet_warehouse_v1_service_proto_rawDescGZIP(), []int{2}
}
func (x *ViewReservationRequest) GetReservationId() string {
if x != nil {
return x.ReservationId
}
return ""
}
type ViewReservationResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Reservation *Reservation `protobuf:"bytes,1,opt,name=reservation,proto3" json:"reservation,omitempty"`
}
func (x *ViewReservationResponse) Reset() {
*x = ViewReservationResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_warehouse_v1_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ViewReservationResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ViewReservationResponse) ProtoMessage() {}
func (x *ViewReservationResponse) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_warehouse_v1_service_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ViewReservationResponse.ProtoReflect.Descriptor instead.
func (*ViewReservationResponse) Descriptor() ([]byte, []int) {
return file_stocklet_warehouse_v1_service_proto_rawDescGZIP(), []int{3}
}
func (x *ViewReservationResponse) GetReservation() *Reservation {
if x != nil {
return x.Reservation
}
return nil
}
var File_stocklet_warehouse_v1_service_proto protoreflect.FileDescriptor
var file_stocklet_warehouse_v1_service_proto_rawDesc = []byte{
0x0a, 0x23, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x77, 0x61, 0x72, 0x65, 0x68,
0x6f, 0x75, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e,
0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75,
0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64,
0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x21, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d,
0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65,
0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x65,
0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74,
0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c,
0x65, 0x74, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x68, 0x69,
0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x73, 0x74, 0x6f,
0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x2f,
0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x41,
0x0a, 0x17, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x74, 0x6f,
0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0a, 0x70, 0x72, 0x6f,
0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba,
0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49,
0x64, 0x22, 0x55, 0x0a, 0x18, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x53, 0x74, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a,
0x05, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x73,
0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73,
0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x74, 0x6f, 0x63,
0x6b, 0x52, 0x05, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x22, 0x48, 0x0a, 0x16, 0x56, 0x69, 0x65, 0x77,
0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x2e, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72,
0x02, 0x10, 0x01, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x49, 0x64, 0x22, 0x5f, 0x0a, 0x17, 0x56, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a,
0x0b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x22, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x77, 0x61,
0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72,
0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x32, 0xa6, 0x07, 0x0a, 0x10, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73,
0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7d, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c,
0x65, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x27, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17,
0x12, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x2f,
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9f, 0x01, 0x0a, 0x10, 0x56, 0x69, 0x65, 0x77,
0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x12, 0x2e, 0x2e, 0x73,
0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73,
0x65, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x53, 0x74, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x73,
0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73,
0x65, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x53, 0x74, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x82,
0xd3, 0xe4, 0x93, 0x02, 0x24, 0x12, 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x61, 0x72, 0x65, 0x68,
0x6f, 0x75, 0x73, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2f, 0x7b, 0x70, 0x72,
0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0xa4, 0x01, 0x0a, 0x0f, 0x56, 0x69,
0x65, 0x77, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x2e,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75,
0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x73,
0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73,
0x65, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x82, 0xd3,
0xe4, 0x93, 0x02, 0x2c, 0x12, 0x2a, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f,
0x75, 0x73, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f,
0x7b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x7d,
0x12, 0x6f, 0x0a, 0x1a, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x27,
0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73,
0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74,
0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22,
0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41,
0x4c, 0x12, 0x6b, 0x0a, 0x18, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x4f, 0x72, 0x64, 0x65,
0x72, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x2e,
0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e,
0x76, 0x31, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x45,
0x76, 0x65, 0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x10, 0xfa, 0xd2,
0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x12, 0x77,
0x0a, 0x1e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e,
0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74,
0x12, 0x2b, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e,
0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x6c,
0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x16, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49,
0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x12, 0x73, 0x0a, 0x1c, 0x50, 0x72, 0x6f, 0x63, 0x65,
0x73, 0x73, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73,
0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x2e, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c,
0x65, 0x74, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79,
0x6d, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x45, 0x76, 0x65,
0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x10, 0xfa, 0xd2, 0xe4, 0x93,
0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x42, 0x4d, 0x5a, 0x4b,
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x65, 0x78, 0x6f, 0x6c,
0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65,
0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x65,
0x6e, 0x2f, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x77,
0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
file_stocklet_warehouse_v1_service_proto_rawDescOnce sync.Once
file_stocklet_warehouse_v1_service_proto_rawDescData = file_stocklet_warehouse_v1_service_proto_rawDesc
)
func file_stocklet_warehouse_v1_service_proto_rawDescGZIP() []byte {
file_stocklet_warehouse_v1_service_proto_rawDescOnce.Do(func() {
file_stocklet_warehouse_v1_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_warehouse_v1_service_proto_rawDescData)
})
return file_stocklet_warehouse_v1_service_proto_rawDescData
}
var file_stocklet_warehouse_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_stocklet_warehouse_v1_service_proto_goTypes = []interface{}{
(*ViewProductStockRequest)(nil), // 0: stocklet.warehouse.v1.ViewProductStockRequest
(*ViewProductStockResponse)(nil), // 1: stocklet.warehouse.v1.ViewProductStockResponse
(*ViewReservationRequest)(nil), // 2: stocklet.warehouse.v1.ViewReservationRequest
(*ViewReservationResponse)(nil), // 3: stocklet.warehouse.v1.ViewReservationResponse
(*ProductStock)(nil), // 4: stocklet.warehouse.v1.ProductStock
(*Reservation)(nil), // 5: stocklet.warehouse.v1.Reservation
(*v1.ServiceInfoRequest)(nil), // 6: stocklet.common.v1.ServiceInfoRequest
(*v11.ProductCreatedEvent)(nil), // 7: stocklet.events.v1.ProductCreatedEvent
(*v11.OrderPendingEvent)(nil), // 8: stocklet.events.v1.OrderPendingEvent
(*v11.ShipmentAllocationEvent)(nil), // 9: stocklet.events.v1.ShipmentAllocationEvent
(*v11.PaymentProcessedEvent)(nil), // 10: stocklet.events.v1.PaymentProcessedEvent
(*v1.ServiceInfoResponse)(nil), // 11: stocklet.common.v1.ServiceInfoResponse
(*emptypb.Empty)(nil), // 12: google.protobuf.Empty
}
var file_stocklet_warehouse_v1_service_proto_depIdxs = []int32{
4, // 0: stocklet.warehouse.v1.ViewProductStockResponse.stock:type_name -> stocklet.warehouse.v1.ProductStock
5, // 1: stocklet.warehouse.v1.ViewReservationResponse.reservation:type_name -> stocklet.warehouse.v1.Reservation
6, // 2: stocklet.warehouse.v1.WarehouseService.ServiceInfo:input_type -> stocklet.common.v1.ServiceInfoRequest
0, // 3: stocklet.warehouse.v1.WarehouseService.ViewProductStock:input_type -> stocklet.warehouse.v1.ViewProductStockRequest
2, // 4: stocklet.warehouse.v1.WarehouseService.ViewReservation:input_type -> stocklet.warehouse.v1.ViewReservationRequest
7, // 5: stocklet.warehouse.v1.WarehouseService.ProcessProductCreatedEvent:input_type -> stocklet.events.v1.ProductCreatedEvent
8, // 6: stocklet.warehouse.v1.WarehouseService.ProcessOrderPendingEvent:input_type -> stocklet.events.v1.OrderPendingEvent
9, // 7: stocklet.warehouse.v1.WarehouseService.ProcessShipmentAllocationEvent:input_type -> stocklet.events.v1.ShipmentAllocationEvent
10, // 8: stocklet.warehouse.v1.WarehouseService.ProcessPaymentProcessedEvent:input_type -> stocklet.events.v1.PaymentProcessedEvent
11, // 9: stocklet.warehouse.v1.WarehouseService.ServiceInfo:output_type -> stocklet.common.v1.ServiceInfoResponse
1, // 10: stocklet.warehouse.v1.WarehouseService.ViewProductStock:output_type -> stocklet.warehouse.v1.ViewProductStockResponse
3, // 11: stocklet.warehouse.v1.WarehouseService.ViewReservation:output_type -> stocklet.warehouse.v1.ViewReservationResponse
12, // 12: stocklet.warehouse.v1.WarehouseService.ProcessProductCreatedEvent:output_type -> google.protobuf.Empty
12, // 13: stocklet.warehouse.v1.WarehouseService.ProcessOrderPendingEvent:output_type -> google.protobuf.Empty
12, // 14: stocklet.warehouse.v1.WarehouseService.ProcessShipmentAllocationEvent:output_type -> google.protobuf.Empty
12, // 15: stocklet.warehouse.v1.WarehouseService.ProcessPaymentProcessedEvent:output_type -> google.protobuf.Empty
9, // [9:16] is the sub-list for method output_type
2, // [2:9] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_stocklet_warehouse_v1_service_proto_init() }
func file_stocklet_warehouse_v1_service_proto_init() {
if File_stocklet_warehouse_v1_service_proto != nil {
return
}
file_stocklet_warehouse_v1_types_proto_init()
if !protoimpl.UnsafeEnabled {
file_stocklet_warehouse_v1_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewProductStockRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_warehouse_v1_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewProductStockResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_warehouse_v1_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewReservationRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_warehouse_v1_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ViewReservationResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_warehouse_v1_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_stocklet_warehouse_v1_service_proto_goTypes,
DependencyIndexes: file_stocklet_warehouse_v1_service_proto_depIdxs,
MessageInfos: file_stocklet_warehouse_v1_service_proto_msgTypes,
}.Build()
File_stocklet_warehouse_v1_service_proto = out.File
file_stocklet_warehouse_v1_service_proto_rawDesc = nil
file_stocklet_warehouse_v1_service_proto_goTypes = nil
file_stocklet_warehouse_v1_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,362 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: stocklet/warehouse/v1/service.proto
/*
Package warehouse_v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package warehouse_v1
import (
"context"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = metadata.Join
func request_WarehouseService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, client WarehouseServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := client.ServiceInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_WarehouseService_ServiceInfo_0(ctx context.Context, marshaler runtime.Marshaler, server WarehouseServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq common_v1.ServiceInfoRequest
var metadata runtime.ServerMetadata
msg, err := server.ServiceInfo(ctx, &protoReq)
return msg, metadata, err
}
func request_WarehouseService_ViewProductStock_0(ctx context.Context, marshaler runtime.Marshaler, client WarehouseServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewProductStockRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["product_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "product_id")
}
protoReq.ProductId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "product_id", err)
}
msg, err := client.ViewProductStock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_WarehouseService_ViewProductStock_0(ctx context.Context, marshaler runtime.Marshaler, server WarehouseServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewProductStockRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["product_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "product_id")
}
protoReq.ProductId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "product_id", err)
}
msg, err := server.ViewProductStock(ctx, &protoReq)
return msg, metadata, err
}
func request_WarehouseService_ViewReservation_0(ctx context.Context, marshaler runtime.Marshaler, client WarehouseServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewReservationRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["reservation_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reservation_id")
}
protoReq.ReservationId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reservation_id", err)
}
msg, err := client.ViewReservation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_WarehouseService_ViewReservation_0(ctx context.Context, marshaler runtime.Marshaler, server WarehouseServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ViewReservationRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["reservation_id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reservation_id")
}
protoReq.ReservationId, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reservation_id", err)
}
msg, err := server.ViewReservation(ctx, &protoReq)
return msg, metadata, err
}
// RegisterWarehouseServiceHandlerServer registers the http handlers for service WarehouseService to "mux".
// UnaryRPC :call WarehouseServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWarehouseServiceHandlerFromEndpoint instead.
func RegisterWarehouseServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WarehouseServiceServer) error {
mux.Handle("GET", pattern_WarehouseService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.warehouse.v1.WarehouseService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/warehouse/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_WarehouseService_ServiceInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_WarehouseService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_WarehouseService_ViewProductStock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.warehouse.v1.WarehouseService/ViewProductStock", runtime.WithHTTPPathPattern("/v1/warehouse/product/{product_id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_WarehouseService_ViewProductStock_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_WarehouseService_ViewProductStock_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_WarehouseService_ViewReservation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/stocklet.warehouse.v1.WarehouseService/ViewReservation", runtime.WithHTTPPathPattern("/v1/warehouse/reservation/{reservation_id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_WarehouseService_ViewReservation_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_WarehouseService_ViewReservation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterWarehouseServiceHandlerFromEndpoint is same as RegisterWarehouseServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterWarehouseServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.DialContext(ctx, endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterWarehouseServiceHandler(ctx, mux, conn)
}
// RegisterWarehouseServiceHandler registers the http handlers for service WarehouseService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterWarehouseServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterWarehouseServiceHandlerClient(ctx, mux, NewWarehouseServiceClient(conn))
}
// RegisterWarehouseServiceHandlerClient registers the http handlers for service WarehouseService
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WarehouseServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WarehouseServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "WarehouseServiceClient" to call the correct interceptors.
func RegisterWarehouseServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WarehouseServiceClient) error {
mux.Handle("GET", pattern_WarehouseService_ServiceInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.warehouse.v1.WarehouseService/ServiceInfo", runtime.WithHTTPPathPattern("/v1/warehouse/service"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WarehouseService_ServiceInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_WarehouseService_ServiceInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_WarehouseService_ViewProductStock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.warehouse.v1.WarehouseService/ViewProductStock", runtime.WithHTTPPathPattern("/v1/warehouse/product/{product_id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WarehouseService_ViewProductStock_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_WarehouseService_ViewProductStock_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_WarehouseService_ViewReservation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/stocklet.warehouse.v1.WarehouseService/ViewReservation", runtime.WithHTTPPathPattern("/v1/warehouse/reservation/{reservation_id}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WarehouseService_ViewReservation_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_WarehouseService_ViewReservation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_WarehouseService_ServiceInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "warehouse", "service"}, ""))
pattern_WarehouseService_ViewProductStock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "warehouse", "product", "product_id"}, ""))
pattern_WarehouseService_ViewReservation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "warehouse", "reservation", "reservation_id"}, ""))
)
var (
forward_WarehouseService_ServiceInfo_0 = runtime.ForwardResponseMessage
forward_WarehouseService_ViewProductStock_0 = runtime.ForwardResponseMessage
forward_WarehouseService_ViewReservation_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,395 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: stocklet/warehouse/v1/service.proto
package warehouse_v1
import (
context "context"
v1 "github.com/hexolan/stocklet/internal/pkg/protogen/common/v1"
v11 "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
WarehouseService_ServiceInfo_FullMethodName = "/stocklet.warehouse.v1.WarehouseService/ServiceInfo"
WarehouseService_ViewProductStock_FullMethodName = "/stocklet.warehouse.v1.WarehouseService/ViewProductStock"
WarehouseService_ViewReservation_FullMethodName = "/stocklet.warehouse.v1.WarehouseService/ViewReservation"
WarehouseService_ProcessProductCreatedEvent_FullMethodName = "/stocklet.warehouse.v1.WarehouseService/ProcessProductCreatedEvent"
WarehouseService_ProcessOrderPendingEvent_FullMethodName = "/stocklet.warehouse.v1.WarehouseService/ProcessOrderPendingEvent"
WarehouseService_ProcessShipmentAllocationEvent_FullMethodName = "/stocklet.warehouse.v1.WarehouseService/ProcessShipmentAllocationEvent"
WarehouseService_ProcessPaymentProcessedEvent_FullMethodName = "/stocklet.warehouse.v1.WarehouseService/ProcessPaymentProcessedEvent"
)
// WarehouseServiceClient is the client API for WarehouseService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type WarehouseServiceClient interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error)
ViewProductStock(ctx context.Context, in *ViewProductStockRequest, opts ...grpc.CallOption) (*ViewProductStockResponse, error)
ViewReservation(ctx context.Context, in *ViewReservationRequest, opts ...grpc.CallOption) (*ViewReservationResponse, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessProductCreatedEvent(ctx context.Context, in *v11.ProductCreatedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessOrderPendingEvent(ctx context.Context, in *v11.OrderPendingEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessShipmentAllocationEvent(ctx context.Context, in *v11.ShipmentAllocationEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessPaymentProcessedEvent(ctx context.Context, in *v11.PaymentProcessedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type warehouseServiceClient struct {
cc grpc.ClientConnInterface
}
func NewWarehouseServiceClient(cc grpc.ClientConnInterface) WarehouseServiceClient {
return &warehouseServiceClient{cc}
}
func (c *warehouseServiceClient) ServiceInfo(ctx context.Context, in *v1.ServiceInfoRequest, opts ...grpc.CallOption) (*v1.ServiceInfoResponse, error) {
out := new(v1.ServiceInfoResponse)
err := c.cc.Invoke(ctx, WarehouseService_ServiceInfo_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *warehouseServiceClient) ViewProductStock(ctx context.Context, in *ViewProductStockRequest, opts ...grpc.CallOption) (*ViewProductStockResponse, error) {
out := new(ViewProductStockResponse)
err := c.cc.Invoke(ctx, WarehouseService_ViewProductStock_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *warehouseServiceClient) ViewReservation(ctx context.Context, in *ViewReservationRequest, opts ...grpc.CallOption) (*ViewReservationResponse, error) {
out := new(ViewReservationResponse)
err := c.cc.Invoke(ctx, WarehouseService_ViewReservation_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *warehouseServiceClient) ProcessProductCreatedEvent(ctx context.Context, in *v11.ProductCreatedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, WarehouseService_ProcessProductCreatedEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *warehouseServiceClient) ProcessOrderPendingEvent(ctx context.Context, in *v11.OrderPendingEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, WarehouseService_ProcessOrderPendingEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *warehouseServiceClient) ProcessShipmentAllocationEvent(ctx context.Context, in *v11.ShipmentAllocationEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, WarehouseService_ProcessShipmentAllocationEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *warehouseServiceClient) ProcessPaymentProcessedEvent(ctx context.Context, in *v11.PaymentProcessedEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, WarehouseService_ProcessPaymentProcessedEvent_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// WarehouseServiceServer is the server API for WarehouseService service.
// All implementations must embed UnimplementedWarehouseServiceServer
// for forward compatibility
type WarehouseServiceServer interface {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error)
ViewProductStock(context.Context, *ViewProductStockRequest) (*ViewProductStockResponse, error)
ViewReservation(context.Context, *ViewReservationRequest) (*ViewReservationResponse, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessProductCreatedEvent(context.Context, *v11.ProductCreatedEvent) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessOrderPendingEvent(context.Context, *v11.OrderPendingEvent) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessShipmentAllocationEvent(context.Context, *v11.ShipmentAllocationEvent) (*emptypb.Empty, error)
// A consumer will call this method to process events.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
ProcessPaymentProcessedEvent(context.Context, *v11.PaymentProcessedEvent) (*emptypb.Empty, error)
mustEmbedUnimplementedWarehouseServiceServer()
}
// UnimplementedWarehouseServiceServer must be embedded to have forward compatible implementations.
type UnimplementedWarehouseServiceServer struct {
}
func (UnimplementedWarehouseServiceServer) ServiceInfo(context.Context, *v1.ServiceInfoRequest) (*v1.ServiceInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ServiceInfo not implemented")
}
func (UnimplementedWarehouseServiceServer) ViewProductStock(context.Context, *ViewProductStockRequest) (*ViewProductStockResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ViewProductStock not implemented")
}
func (UnimplementedWarehouseServiceServer) ViewReservation(context.Context, *ViewReservationRequest) (*ViewReservationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ViewReservation not implemented")
}
func (UnimplementedWarehouseServiceServer) ProcessProductCreatedEvent(context.Context, *v11.ProductCreatedEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessProductCreatedEvent not implemented")
}
func (UnimplementedWarehouseServiceServer) ProcessOrderPendingEvent(context.Context, *v11.OrderPendingEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessOrderPendingEvent not implemented")
}
func (UnimplementedWarehouseServiceServer) ProcessShipmentAllocationEvent(context.Context, *v11.ShipmentAllocationEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessShipmentAllocationEvent not implemented")
}
func (UnimplementedWarehouseServiceServer) ProcessPaymentProcessedEvent(context.Context, *v11.PaymentProcessedEvent) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProcessPaymentProcessedEvent not implemented")
}
func (UnimplementedWarehouseServiceServer) mustEmbedUnimplementedWarehouseServiceServer() {}
// UnsafeWarehouseServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to WarehouseServiceServer will
// result in compilation errors.
type UnsafeWarehouseServiceServer interface {
mustEmbedUnimplementedWarehouseServiceServer()
}
func RegisterWarehouseServiceServer(s grpc.ServiceRegistrar, srv WarehouseServiceServer) {
s.RegisterService(&WarehouseService_ServiceDesc, srv)
}
func _WarehouseService_ServiceInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v1.ServiceInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WarehouseServiceServer).ServiceInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WarehouseService_ServiceInfo_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WarehouseServiceServer).ServiceInfo(ctx, req.(*v1.ServiceInfoRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WarehouseService_ViewProductStock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ViewProductStockRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WarehouseServiceServer).ViewProductStock(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WarehouseService_ViewProductStock_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WarehouseServiceServer).ViewProductStock(ctx, req.(*ViewProductStockRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WarehouseService_ViewReservation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ViewReservationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WarehouseServiceServer).ViewReservation(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WarehouseService_ViewReservation_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WarehouseServiceServer).ViewReservation(ctx, req.(*ViewReservationRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WarehouseService_ProcessProductCreatedEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.ProductCreatedEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WarehouseServiceServer).ProcessProductCreatedEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WarehouseService_ProcessProductCreatedEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WarehouseServiceServer).ProcessProductCreatedEvent(ctx, req.(*v11.ProductCreatedEvent))
}
return interceptor(ctx, in, info, handler)
}
func _WarehouseService_ProcessOrderPendingEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.OrderPendingEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WarehouseServiceServer).ProcessOrderPendingEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WarehouseService_ProcessOrderPendingEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WarehouseServiceServer).ProcessOrderPendingEvent(ctx, req.(*v11.OrderPendingEvent))
}
return interceptor(ctx, in, info, handler)
}
func _WarehouseService_ProcessShipmentAllocationEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.ShipmentAllocationEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WarehouseServiceServer).ProcessShipmentAllocationEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WarehouseService_ProcessShipmentAllocationEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WarehouseServiceServer).ProcessShipmentAllocationEvent(ctx, req.(*v11.ShipmentAllocationEvent))
}
return interceptor(ctx, in, info, handler)
}
func _WarehouseService_ProcessPaymentProcessedEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(v11.PaymentProcessedEvent)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WarehouseServiceServer).ProcessPaymentProcessedEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WarehouseService_ProcessPaymentProcessedEvent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WarehouseServiceServer).ProcessPaymentProcessedEvent(ctx, req.(*v11.PaymentProcessedEvent))
}
return interceptor(ctx, in, info, handler)
}
// WarehouseService_ServiceDesc is the grpc.ServiceDesc for WarehouseService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var WarehouseService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "stocklet.warehouse.v1.WarehouseService",
HandlerType: (*WarehouseServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ServiceInfo",
Handler: _WarehouseService_ServiceInfo_Handler,
},
{
MethodName: "ViewProductStock",
Handler: _WarehouseService_ViewProductStock_Handler,
},
{
MethodName: "ViewReservation",
Handler: _WarehouseService_ViewReservation_Handler,
},
{
MethodName: "ProcessProductCreatedEvent",
Handler: _WarehouseService_ProcessProductCreatedEvent_Handler,
},
{
MethodName: "ProcessOrderPendingEvent",
Handler: _WarehouseService_ProcessOrderPendingEvent_Handler,
},
{
MethodName: "ProcessShipmentAllocationEvent",
Handler: _WarehouseService_ProcessShipmentAllocationEvent_Handler,
},
{
MethodName: "ProcessPaymentProcessedEvent",
Handler: _WarehouseService_ProcessPaymentProcessedEvent_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "stocklet/warehouse/v1/service.proto",
}

View File

@@ -0,0 +1,348 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc (unknown)
// source: stocklet/warehouse/v1/types.proto
package warehouse_v1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ProductStock struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
Quantity int32 `protobuf:"varint,2,opt,name=quantity,proto3" json:"quantity,omitempty"`
}
func (x *ProductStock) Reset() {
*x = ProductStock{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_warehouse_v1_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ProductStock) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ProductStock) ProtoMessage() {}
func (x *ProductStock) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_warehouse_v1_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ProductStock.ProtoReflect.Descriptor instead.
func (*ProductStock) Descriptor() ([]byte, []int) {
return file_stocklet_warehouse_v1_types_proto_rawDescGZIP(), []int{0}
}
func (x *ProductStock) GetProductId() string {
if x != nil {
return x.ProductId
}
return ""
}
func (x *ProductStock) GetQuantity() int32 {
if x != nil {
return x.Quantity
}
return 0
}
type Reservation struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
OrderId string `protobuf:"bytes,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
ReservedStock []*ReservationStock `protobuf:"bytes,3,rep,name=reserved_stock,json=reservedStock,proto3" json:"reserved_stock,omitempty"`
CreatedAt int64 `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
}
func (x *Reservation) Reset() {
*x = Reservation{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_warehouse_v1_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Reservation) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Reservation) ProtoMessage() {}
func (x *Reservation) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_warehouse_v1_types_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Reservation.ProtoReflect.Descriptor instead.
func (*Reservation) Descriptor() ([]byte, []int) {
return file_stocklet_warehouse_v1_types_proto_rawDescGZIP(), []int{1}
}
func (x *Reservation) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *Reservation) GetOrderId() string {
if x != nil {
return x.OrderId
}
return ""
}
func (x *Reservation) GetReservedStock() []*ReservationStock {
if x != nil {
return x.ReservedStock
}
return nil
}
func (x *Reservation) GetCreatedAt() int64 {
if x != nil {
return x.CreatedAt
}
return 0
}
type ReservationStock struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
Quantity int32 `protobuf:"varint,2,opt,name=quantity,proto3" json:"quantity,omitempty"`
}
func (x *ReservationStock) Reset() {
*x = ReservationStock{}
if protoimpl.UnsafeEnabled {
mi := &file_stocklet_warehouse_v1_types_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReservationStock) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReservationStock) ProtoMessage() {}
func (x *ReservationStock) ProtoReflect() protoreflect.Message {
mi := &file_stocklet_warehouse_v1_types_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReservationStock.ProtoReflect.Descriptor instead.
func (*ReservationStock) Descriptor() ([]byte, []int) {
return file_stocklet_warehouse_v1_types_proto_rawDescGZIP(), []int{2}
}
func (x *ReservationStock) GetProductId() string {
if x != nil {
return x.ProductId
}
return ""
}
func (x *ReservationStock) GetQuantity() int32 {
if x != nil {
return x.Quantity
}
return 0
}
var File_stocklet_warehouse_v1_types_proto protoreflect.FileDescriptor
var file_stocklet_warehouse_v1_types_proto_rawDesc = []byte{
0x0a, 0x21, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2f, 0x77, 0x61, 0x72, 0x65, 0x68,
0x6f, 0x75, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x15, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x77, 0x61,
0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f,
0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5b, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x53, 0x74, 0x6f, 0x63, 0x6b, 0x12, 0x26, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04,
0x72, 0x02, 0x10, 0x01, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12,
0x23, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28,
0x05, 0x42, 0x07, 0xba, 0x48, 0x04, 0x1a, 0x02, 0x28, 0x00, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e,
0x74, 0x69, 0x74, 0x79, 0x22, 0xb9, 0x01, 0x0a, 0x0b, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a,
0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42,
0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49,
0x64, 0x12, 0x4e, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x73, 0x74,
0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x73, 0x74, 0x6f, 0x63,
0x6b, 0x6c, 0x65, 0x74, 0x2e, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x2e, 0x76,
0x31, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x6f,
0x63, 0x6b, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, 0x74, 0x6f, 0x63,
0x6b, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18,
0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74,
0x22, 0x5f, 0x0a, 0x10, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53,
0x74, 0x6f, 0x63, 0x6b, 0x12, 0x26, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10,
0x01, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x08,
0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x42, 0x07,
0xba, 0x48, 0x04, 0x1a, 0x02, 0x28, 0x00, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74,
0x79, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x68, 0x65, 0x78, 0x6f, 0x6c, 0x61, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x6c, 0x65, 0x74,
0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x67, 0x65, 0x6e, 0x2f, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65,
0x2f, 0x76, 0x31, 0x3b, 0x77, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x5f, 0x76, 0x31,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_stocklet_warehouse_v1_types_proto_rawDescOnce sync.Once
file_stocklet_warehouse_v1_types_proto_rawDescData = file_stocklet_warehouse_v1_types_proto_rawDesc
)
func file_stocklet_warehouse_v1_types_proto_rawDescGZIP() []byte {
file_stocklet_warehouse_v1_types_proto_rawDescOnce.Do(func() {
file_stocklet_warehouse_v1_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_stocklet_warehouse_v1_types_proto_rawDescData)
})
return file_stocklet_warehouse_v1_types_proto_rawDescData
}
var file_stocklet_warehouse_v1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_stocklet_warehouse_v1_types_proto_goTypes = []interface{}{
(*ProductStock)(nil), // 0: stocklet.warehouse.v1.ProductStock
(*Reservation)(nil), // 1: stocklet.warehouse.v1.Reservation
(*ReservationStock)(nil), // 2: stocklet.warehouse.v1.ReservationStock
}
var file_stocklet_warehouse_v1_types_proto_depIdxs = []int32{
2, // 0: stocklet.warehouse.v1.Reservation.reserved_stock:type_name -> stocklet.warehouse.v1.ReservationStock
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_stocklet_warehouse_v1_types_proto_init() }
func file_stocklet_warehouse_v1_types_proto_init() {
if File_stocklet_warehouse_v1_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_stocklet_warehouse_v1_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ProductStock); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_warehouse_v1_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Reservation); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_stocklet_warehouse_v1_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReservationStock); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_stocklet_warehouse_v1_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_stocklet_warehouse_v1_types_proto_goTypes,
DependencyIndexes: file_stocklet_warehouse_v1_types_proto_depIdxs,
MessageInfos: file_stocklet_warehouse_v1_types_proto_msgTypes,
}.Build()
File_stocklet_warehouse_v1_types_proto = out.File
file_stocklet_warehouse_v1_types_proto_rawDesc = nil
file_stocklet_warehouse_v1_types_proto_goTypes = nil
file_stocklet_warehouse_v1_types_proto_depIdxs = nil
}

View File

@@ -0,0 +1,114 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package serve
import (
"context"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/rs/zerolog/log"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/metadata"
"github.com/hexolan/stocklet/internal/pkg/config"
"github.com/hexolan/stocklet/internal/pkg/gwauth"
)
func withGatewayErrorHandler() runtime.ServeMuxOption {
return runtime.WithErrorHandler(
func(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, r *http.Request, err error) {
runtime.DefaultHTTPErrorHandler(ctx, mux, marshaler, w, r, err)
log.Error().Err(err).Stack().Str("path", r.URL.Path).Str("reqURI", r.RequestURI).Str("remoteAddr", r.RemoteAddr).Msg("")
},
)
}
func withGatewayMetadataOpt() runtime.ServeMuxOption {
return runtime.WithMetadata(
func(ctx context.Context, req *http.Request) metadata.MD {
return metadata.MD{"from-gateway": {"true"}}
},
)
}
func withGatewayHeaderOpt() runtime.ServeMuxOption {
return runtime.WithIncomingHeaderMatcher(
func(key string) (string, bool) {
switch key {
case gwauth.JWTPayloadHeader:
// Envoy will validate JWT tokens and provide a payload header
// containing a base64 string of the token claims.
return "jwt-payload", true
default:
return key, false
}
},
)
}
func withGatewayLogger(h http.Handler) http.Handler {
return http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
h.ServeHTTP(w, r)
log.Info().Str("path", r.URL.Path).Str("reqURI", r.RequestURI).Str("remoteAddr", r.RemoteAddr).Msg("")
},
)
}
func NewGatewayServeBase(cfg *config.SharedConfig) (*runtime.ServeMux, []grpc.DialOption) {
// Create the base runtime ServeMux
mux := runtime.NewServeMux(
withGatewayErrorHandler(),
withGatewayMetadataOpt(),
withGatewayHeaderOpt(),
)
// Attach open telemetry instrumentation through the gRPC client options
clientOpts := []grpc.DialOption{
grpc.WithStatsHandler(
otelgrpc.NewClientHandler(),
),
grpc.WithTransportCredentials(insecure.NewCredentials()),
}
return mux, clientOpts
}
func Gateway(mux *runtime.ServeMux) error {
// Create OTEL instrumentation handler
handler := otelhttp.NewHandler(
mux,
"grpc-gateway",
otelhttp.WithSpanNameFormatter(
func(operation string, r *http.Request) string {
return operation + ": " + r.RequestURI
},
),
)
// Create gateway HTTP server
svr := &http.Server{
Addr: GetAddrToGateway("0.0.0.0"),
Handler: withGatewayLogger(handler),
}
return svr.ListenAndServe()
}

View File

@@ -0,0 +1,62 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package serve
import (
"net"
"github.com/rs/zerolog/log"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"google.golang.org/grpc"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/reflection"
"github.com/hexolan/stocklet/internal/pkg/config"
)
func NewGrpcServeBase(cfg *config.SharedConfig) *grpc.Server {
// Attach OTEL metrics middleware
svr := grpc.NewServer(
grpc.StatsHandler(
otelgrpc.NewServerHandler(),
),
)
// Attach the health service
svc := health.NewServer()
grpc_health_v1.RegisterHealthServer(svr, svc)
// Enable reflection in dev mode
// Eases usage of tools like grpcurl and grpcui
if cfg.DevMode {
reflection.Register(svr)
}
return svr
}
func Grpc(svr *grpc.Server) {
lis, err := net.Listen("tcp", GetAddrToGrpc("0.0.0.0"))
if err != nil {
log.Panic().Err(err).Str("port", grpcPort).Msg("failed to listen on gRPC port")
}
err = svr.Serve(lis)
if err != nil {
log.Panic().Err(err).Msg("failed to serve gRPC server")
}
}

View File

@@ -0,0 +1,32 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package serve
// Port Definitions
const (
grpcPort string = "9090"
gatewayPort string = "90"
)
// Get an address to a gRPC server using the standard port
func GetAddrToGrpc(host string) string {
return host + ":" + grpcPort
}
// Get an address to a gRPC-gateway interface using the standard port
func GetAddrToGateway(host string) string {
return host + ":" + gatewayPort
}

View File

@@ -0,0 +1,37 @@
// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package storage
import (
"context"
"time"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/hexolan/stocklet/internal/pkg/config"
"github.com/hexolan/stocklet/internal/pkg/errors"
)
func NewPostgresConn(conf *config.PostgresConfig) (*pgxpool.Pool, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*45)
defer cancel()
pCl, err := pgxpool.New(ctx, conf.GetDSN())
if err != nil {
return nil, errors.WrapServiceError(errors.ErrCodeExtService, "failed to connect to postgres", err)
}
return pCl, nil
}