order_v1

package
v0.0.0-...-531b5da Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package order_v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
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"
)

Variables

View Source
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,
	}
)

Enum value maps for OrderStatus.

View Source
var File_stocklet_order_v1_service_proto protoreflect.FileDescriptor
View Source
var File_stocklet_order_v1_types_proto protoreflect.FileDescriptor
View Source
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",
}

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)

Functions

func RegisterOrderServiceHandler

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

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

func RegisterOrderServiceHandlerClient

func RegisterOrderServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OrderServiceClient) error

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 RegisterOrderServiceHandlerFromEndpoint

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

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

func RegisterOrderServiceHandlerServer

func RegisterOrderServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OrderServiceServer) error

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 RegisterOrderServiceServer

func RegisterOrderServiceServer(s grpc.ServiceRegistrar, srv OrderServiceServer)

Types

type GetOrderItemsRequest

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

func (*GetOrderItemsRequest) Descriptor deprecated

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

Deprecated: Use GetOrderItemsRequest.ProtoReflect.Descriptor instead.

func (*GetOrderItemsRequest) GetId

func (x *GetOrderItemsRequest) GetId() string

func (*GetOrderItemsRequest) ProtoMessage

func (*GetOrderItemsRequest) ProtoMessage()

func (*GetOrderItemsRequest) ProtoReflect

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

func (*GetOrderItemsRequest) Reset

func (x *GetOrderItemsRequest) Reset()

func (*GetOrderItemsRequest) String

func (x *GetOrderItemsRequest) String() string

type GetOrderItemsResponse

type GetOrderItemsResponse struct {
	Items map[string]int32 `` /* 152-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*GetOrderItemsResponse) Descriptor deprecated

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

Deprecated: Use GetOrderItemsResponse.ProtoReflect.Descriptor instead.

func (*GetOrderItemsResponse) GetItems

func (x *GetOrderItemsResponse) GetItems() map[string]int32

func (*GetOrderItemsResponse) ProtoMessage

func (*GetOrderItemsResponse) ProtoMessage()

func (*GetOrderItemsResponse) ProtoReflect

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

func (*GetOrderItemsResponse) Reset

func (x *GetOrderItemsResponse) Reset()

func (*GetOrderItemsResponse) String

func (x *GetOrderItemsResponse) String() string

type Order

type Order struct {
	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 `` /* 152-byte string literal not displayed */
	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"`
	// contains filtered or unexported fields
}

func (*Order) Descriptor deprecated

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

Deprecated: Use Order.ProtoReflect.Descriptor instead.

func (*Order) GetCreatedAt

func (x *Order) GetCreatedAt() int64

func (*Order) GetCustomerId

func (x *Order) GetCustomerId() string

func (*Order) GetId

func (x *Order) GetId() string

func (*Order) GetItems

func (x *Order) GetItems() map[string]int32

func (*Order) GetShippingId

func (x *Order) GetShippingId() string

func (*Order) GetStatus

func (x *Order) GetStatus() OrderStatus

func (*Order) GetTransactionId

func (x *Order) GetTransactionId() string

func (*Order) GetUpdatedAt

func (x *Order) GetUpdatedAt() int64

func (*Order) ProtoMessage

func (*Order) ProtoMessage()

func (*Order) ProtoReflect

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

func (*Order) Reset

func (x *Order) Reset()

func (*Order) String

func (x *Order) String() string

type OrderServiceClient

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)
}

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 OrderServiceServer

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)
	// contains filtered or unexported methods
}

OrderServiceServer is the server API for OrderService service. All implementations must embed UnimplementedOrderServiceServer for forward compatibility

type OrderStatus

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
)

func (OrderStatus) Descriptor

func (OrderStatus) Enum

func (x OrderStatus) Enum() *OrderStatus

func (OrderStatus) EnumDescriptor deprecated

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

Deprecated: Use OrderStatus.Descriptor instead.

func (OrderStatus) Number

func (x OrderStatus) Number() protoreflect.EnumNumber

func (OrderStatus) String

func (x OrderStatus) String() string

func (OrderStatus) Type

type PlaceOrderRequest

type PlaceOrderRequest struct {
	Cart       map[string]int32 `` /* 150-byte string literal not displayed */
	CustomerId string           `protobuf:"bytes,2,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
	// contains filtered or unexported fields
}

func (*PlaceOrderRequest) Descriptor deprecated

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

Deprecated: Use PlaceOrderRequest.ProtoReflect.Descriptor instead.

func (*PlaceOrderRequest) GetCart

func (x *PlaceOrderRequest) GetCart() map[string]int32

func (*PlaceOrderRequest) GetCustomerId

func (x *PlaceOrderRequest) GetCustomerId() string

func (*PlaceOrderRequest) ProtoMessage

func (*PlaceOrderRequest) ProtoMessage()

func (*PlaceOrderRequest) ProtoReflect

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

func (*PlaceOrderRequest) Reset

func (x *PlaceOrderRequest) Reset()

func (*PlaceOrderRequest) String

func (x *PlaceOrderRequest) String() string

type PlaceOrderResponse

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

func (*PlaceOrderResponse) Descriptor deprecated

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

Deprecated: Use PlaceOrderResponse.ProtoReflect.Descriptor instead.

func (*PlaceOrderResponse) GetOrder

func (x *PlaceOrderResponse) GetOrder() *Order

func (*PlaceOrderResponse) ProtoMessage

func (*PlaceOrderResponse) ProtoMessage()

func (*PlaceOrderResponse) ProtoReflect

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

func (*PlaceOrderResponse) Reset

func (x *PlaceOrderResponse) Reset()

func (*PlaceOrderResponse) String

func (x *PlaceOrderResponse) String() string

type UnimplementedOrderServiceServer

type UnimplementedOrderServiceServer struct {
}

UnimplementedOrderServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedOrderServiceServer) PlaceOrder

func (UnimplementedOrderServiceServer) ProcessPaymentProcessedEvent

func (UnimplementedOrderServiceServer) ProcessProductPriceQuoteEvent

func (UnimplementedOrderServiceServer) ProcessShipmentAllocationEvent

func (UnimplementedOrderServiceServer) ProcessStockReservationEvent

func (UnimplementedOrderServiceServer) ServiceInfo

func (UnimplementedOrderServiceServer) ViewOrder

func (UnimplementedOrderServiceServer) ViewOrders

type UnsafeOrderServiceServer

type UnsafeOrderServiceServer interface {
	// contains filtered or unexported methods
}

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 ViewOrderRequest

type ViewOrderRequest struct {
	OrderId string `protobuf:"bytes,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
	// contains filtered or unexported fields
}

func (*ViewOrderRequest) Descriptor deprecated

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

Deprecated: Use ViewOrderRequest.ProtoReflect.Descriptor instead.

func (*ViewOrderRequest) GetOrderId

func (x *ViewOrderRequest) GetOrderId() string

func (*ViewOrderRequest) ProtoMessage

func (*ViewOrderRequest) ProtoMessage()

func (*ViewOrderRequest) ProtoReflect

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

func (*ViewOrderRequest) Reset

func (x *ViewOrderRequest) Reset()

func (*ViewOrderRequest) String

func (x *ViewOrderRequest) String() string

type ViewOrderResponse

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

func (*ViewOrderResponse) Descriptor deprecated

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

Deprecated: Use ViewOrderResponse.ProtoReflect.Descriptor instead.

func (*ViewOrderResponse) GetOrder

func (x *ViewOrderResponse) GetOrder() *Order

func (*ViewOrderResponse) ProtoMessage

func (*ViewOrderResponse) ProtoMessage()

func (*ViewOrderResponse) ProtoReflect

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

func (*ViewOrderResponse) Reset

func (x *ViewOrderResponse) Reset()

func (*ViewOrderResponse) String

func (x *ViewOrderResponse) String() string

type ViewOrdersRequest

type ViewOrdersRequest struct {
	CustomerId string `protobuf:"bytes,1,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
	// contains filtered or unexported fields
}

func (*ViewOrdersRequest) Descriptor deprecated

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

Deprecated: Use ViewOrdersRequest.ProtoReflect.Descriptor instead.

func (*ViewOrdersRequest) GetCustomerId

func (x *ViewOrdersRequest) GetCustomerId() string

func (*ViewOrdersRequest) ProtoMessage

func (*ViewOrdersRequest) ProtoMessage()

func (*ViewOrdersRequest) ProtoReflect

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

func (*ViewOrdersRequest) Reset

func (x *ViewOrdersRequest) Reset()

func (*ViewOrdersRequest) String

func (x *ViewOrdersRequest) String() string

type ViewOrdersResponse

type ViewOrdersResponse struct {
	Orders []*Order `protobuf:"bytes,1,rep,name=orders,proto3" json:"orders,omitempty"`
	// contains filtered or unexported fields
}

func (*ViewOrdersResponse) Descriptor deprecated

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

Deprecated: Use ViewOrdersResponse.ProtoReflect.Descriptor instead.

func (*ViewOrdersResponse) GetOrders

func (x *ViewOrdersResponse) GetOrders() []*Order

func (*ViewOrdersResponse) ProtoMessage

func (*ViewOrdersResponse) ProtoMessage()

func (*ViewOrdersResponse) ProtoReflect

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

func (*ViewOrdersResponse) Reset

func (x *ViewOrdersResponse) Reset()

func (*ViewOrdersResponse) String

func (x *ViewOrdersResponse) String() string

Jump to

Keyboard shortcuts

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