shop_v1

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GetShippingStatusResponse_Status_name = map[int32]string{
		0: "UNSPECIFIED",
		1: "PREPARING",
		2: "SHIPPED",
		3: "DELIVERED",
	}
	GetShippingStatusResponse_Status_value = map[string]int32{
		"UNSPECIFIED": 0,
		"PREPARING":   1,
		"SHIPPED":     2,
		"DELIVERED":   3,
	}
)

Enum value maps for GetShippingStatusResponse_Status.

View Source
var File_proto_shop_v1_shop_proto protoreflect.FileDescriptor
View Source
var Shop_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "yoshikishibata.courier.example.api.shop.v1.Shop",
	HandlerType: (*ShopServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ListProductInventories",
			Handler:    _Shop_ListProductInventories_Handler,
		},
		{
			MethodName: "CreateOrder",
			Handler:    _Shop_CreateOrder_Handler,
		},
		{
			MethodName: "GetShippingStatus",
			Handler:    _Shop_GetShippingStatus_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/shop/v1/shop.proto",
}

Shop_ServiceDesc is the grpc.ServiceDesc for Shop service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterShopServer

func RegisterShopServer(s grpc.ServiceRegistrar, srv ShopServer)

Types

type CreateOrderRequest

type CreateOrderRequest struct {

	// 商品番号
	ProductNumber string `protobuf:"bytes,1,opt,name=product_number,json=productNumber,proto3" json:"product_number,omitempty"`
	// 個数
	NumOfItems uint32 `protobuf:"varint,2,opt,name=num_of_items,json=numOfItems,proto3" json:"num_of_items,omitempty"`
	// 送付先
	ShippingAddress string `protobuf:"bytes,3,opt,name=shipping_address,json=shippingAddress,proto3" json:"shipping_address,omitempty"`
	// contains filtered or unexported fields
}

* CreateOrderは、指定された商品の購入処理を行い、出荷します。

[エラー] - InvalidArgument:

  • numberが空文字列
  • num_of_itemsが0
  • shipping_addressが空文字列

- NotFound:

  • numberで指定された商品は扱っていない

- FailedPrecondition:

  • 指定された個数の商品在庫がない

func (*CreateOrderRequest) Descriptor deprecated

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

Deprecated: Use CreateOrderRequest.ProtoReflect.Descriptor instead.

func (*CreateOrderRequest) GetNumOfItems

func (x *CreateOrderRequest) GetNumOfItems() uint32

func (*CreateOrderRequest) GetProductNumber

func (x *CreateOrderRequest) GetProductNumber() string

func (*CreateOrderRequest) GetShippingAddress

func (x *CreateOrderRequest) GetShippingAddress() string

func (*CreateOrderRequest) ProtoMessage

func (*CreateOrderRequest) ProtoMessage()

func (*CreateOrderRequest) ProtoReflect

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

func (*CreateOrderRequest) Reset

func (x *CreateOrderRequest) Reset()

func (*CreateOrderRequest) String

func (x *CreateOrderRequest) String() string

type CreateOrderResponse

type CreateOrderResponse struct {

	// 注文番号
	OrderId string `protobuf:"bytes,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateOrderResponse) Descriptor deprecated

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

Deprecated: Use CreateOrderResponse.ProtoReflect.Descriptor instead.

func (*CreateOrderResponse) GetOrderId

func (x *CreateOrderResponse) GetOrderId() string

func (*CreateOrderResponse) ProtoMessage

func (*CreateOrderResponse) ProtoMessage()

func (*CreateOrderResponse) ProtoReflect

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

func (*CreateOrderResponse) Reset

func (x *CreateOrderResponse) Reset()

func (*CreateOrderResponse) String

func (x *CreateOrderResponse) String() string

type GetShippingStatusRequest

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

* GetShippingStatusは、order_idで指定された商品の出荷状況を返します。

[エラー] - InvalidArgument:

  • order_idが空文字列

- NotFound:

  • order_idで指定された注文がない

func (*GetShippingStatusRequest) Descriptor deprecated

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

Deprecated: Use GetShippingStatusRequest.ProtoReflect.Descriptor instead.

func (*GetShippingStatusRequest) GetOrderId

func (x *GetShippingStatusRequest) GetOrderId() string

func (*GetShippingStatusRequest) ProtoMessage

func (*GetShippingStatusRequest) ProtoMessage()

func (*GetShippingStatusRequest) ProtoReflect

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

func (*GetShippingStatusRequest) Reset

func (x *GetShippingStatusRequest) Reset()

func (*GetShippingStatusRequest) String

func (x *GetShippingStatusRequest) String() string

type GetShippingStatusResponse

type GetShippingStatusResponse struct {
	OrderId string                           `protobuf:"bytes,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
	Status  GetShippingStatusResponse_Status `` /* 147-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*GetShippingStatusResponse) Descriptor deprecated

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

Deprecated: Use GetShippingStatusResponse.ProtoReflect.Descriptor instead.

func (*GetShippingStatusResponse) GetOrderId

func (x *GetShippingStatusResponse) GetOrderId() string

func (*GetShippingStatusResponse) GetStatus

func (*GetShippingStatusResponse) ProtoMessage

func (*GetShippingStatusResponse) ProtoMessage()

func (*GetShippingStatusResponse) ProtoReflect

func (*GetShippingStatusResponse) Reset

func (x *GetShippingStatusResponse) Reset()

func (*GetShippingStatusResponse) String

func (x *GetShippingStatusResponse) String() string

type GetShippingStatusResponse_Status

type GetShippingStatusResponse_Status int32
const (
	GetShippingStatusResponse_UNSPECIFIED GetShippingStatusResponse_Status = 0
	// 準備中
	GetShippingStatusResponse_PREPARING GetShippingStatusResponse_Status = 1
	// 出荷済み
	GetShippingStatusResponse_SHIPPED GetShippingStatusResponse_Status = 2
	// 配達済み
	GetShippingStatusResponse_DELIVERED GetShippingStatusResponse_Status = 3
)

func (GetShippingStatusResponse_Status) Descriptor

func (GetShippingStatusResponse_Status) Enum

func (GetShippingStatusResponse_Status) EnumDescriptor deprecated

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

Deprecated: Use GetShippingStatusResponse_Status.Descriptor instead.

func (GetShippingStatusResponse_Status) Number

func (GetShippingStatusResponse_Status) String

func (GetShippingStatusResponse_Status) Type

type ListProductInventoriesRequest

type ListProductInventoriesRequest struct {
	NumOfProducts uint32 `protobuf:"varint,1,opt,name=num_of_products,json=numOfProducts,proto3" json:"num_of_products,omitempty"`
	PageToken     string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
	// contains filtered or unexported fields
}

* ListProductInventoriesは、扱っている商品の一覧を返します。 - num_of_productsは、一覧として返す最大個数を指定します。

page_tokenには、空文字列もしくはレスポンスで返されるnext_page_tokenを設定します。

  • 空文字列の場合は、商品一覧の最初から返されます。

- 商品一覧は、nameのアルファベット順に昇順に返されます。

[エラー] - InvalidArgument:

  • num_of_productsが0
  • page_tokenが不正な値

func (*ListProductInventoriesRequest) Descriptor deprecated

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

Deprecated: Use ListProductInventoriesRequest.ProtoReflect.Descriptor instead.

func (*ListProductInventoriesRequest) GetNumOfProducts

func (x *ListProductInventoriesRequest) GetNumOfProducts() uint32

func (*ListProductInventoriesRequest) GetPageToken

func (x *ListProductInventoriesRequest) GetPageToken() string

func (*ListProductInventoriesRequest) ProtoMessage

func (*ListProductInventoriesRequest) ProtoMessage()

func (*ListProductInventoriesRequest) ProtoReflect

func (*ListProductInventoriesRequest) Reset

func (x *ListProductInventoriesRequest) Reset()

func (*ListProductInventoriesRequest) String

type ListProductInventoriesResponse

type ListProductInventoriesResponse struct {
	ProductInventories []*ProductInventory `protobuf:"bytes,1,rep,name=product_inventories,json=productInventories,proto3" json:"product_inventories,omitempty"`
	// 商品がさらに存在しない場合、空文字列が返されます。
	NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
	// contains filtered or unexported fields
}

func (*ListProductInventoriesResponse) Descriptor deprecated

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

Deprecated: Use ListProductInventoriesResponse.ProtoReflect.Descriptor instead.

func (*ListProductInventoriesResponse) GetNextPageToken

func (x *ListProductInventoriesResponse) GetNextPageToken() string

func (*ListProductInventoriesResponse) GetProductInventories

func (x *ListProductInventoriesResponse) GetProductInventories() []*ProductInventory

func (*ListProductInventoriesResponse) ProtoMessage

func (*ListProductInventoriesResponse) ProtoMessage()

func (*ListProductInventoriesResponse) ProtoReflect

func (*ListProductInventoriesResponse) Reset

func (x *ListProductInventoriesResponse) Reset()

func (*ListProductInventoriesResponse) String

type ProductInventory

type ProductInventory struct {

	// 商品番号
	Number string `protobuf:"bytes,1,opt,name=number,proto3" json:"number,omitempty"`
	// 商品名
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// 価格(円)
	Price uint32 `protobuf:"varint,3,opt,name=price,proto3" json:"price,omitempty"`
	// 在庫数
	QuantityAvailable uint32 `protobuf:"varint,4,opt,name=quantity_available,json=quantityAvailable,proto3" json:"quantity_available,omitempty"`
	// contains filtered or unexported fields
}

func (*ProductInventory) Descriptor deprecated

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

Deprecated: Use ProductInventory.ProtoReflect.Descriptor instead.

func (*ProductInventory) GetName

func (x *ProductInventory) GetName() string

func (*ProductInventory) GetNumber

func (x *ProductInventory) GetNumber() string

func (*ProductInventory) GetPrice

func (x *ProductInventory) GetPrice() uint32

func (*ProductInventory) GetQuantityAvailable

func (x *ProductInventory) GetQuantityAvailable() uint32

func (*ProductInventory) ProtoMessage

func (*ProductInventory) ProtoMessage()

func (*ProductInventory) ProtoReflect

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

func (*ProductInventory) Reset

func (x *ProductInventory) Reset()

func (*ProductInventory) String

func (x *ProductInventory) String() string

type ShopClient

type ShopClient interface {
	// 扱っている商品一覧を返します。
	ListProductInventories(ctx context.Context, in *ListProductInventoriesRequest, opts ...grpc.CallOption) (*ListProductInventoriesResponse, error)
	// 注文を作成して発送処理をします。
	CreateOrder(ctx context.Context, in *CreateOrderRequest, opts ...grpc.CallOption) (*CreateOrderResponse, error)
	// 発送ステータスを返します。
	GetShippingStatus(ctx context.Context, in *GetShippingStatusRequest, opts ...grpc.CallOption) (*GetShippingStatusResponse, error)
}

ShopClient is the client API for Shop 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.

func NewShopClient

func NewShopClient(cc grpc.ClientConnInterface) ShopClient

type ShopServer

type ShopServer interface {
	// 扱っている商品一覧を返します。
	ListProductInventories(context.Context, *ListProductInventoriesRequest) (*ListProductInventoriesResponse, error)
	// 注文を作成して発送処理をします。
	CreateOrder(context.Context, *CreateOrderRequest) (*CreateOrderResponse, error)
	// 発送ステータスを返します。
	GetShippingStatus(context.Context, *GetShippingStatusRequest) (*GetShippingStatusResponse, error)
	// contains filtered or unexported methods
}

ShopServer is the server API for Shop service. All implementations must embed UnimplementedShopServer for forward compatibility

type UnimplementedShopServer

type UnimplementedShopServer struct {
}

UnimplementedShopServer must be embedded to have forward compatible implementations.

func (UnimplementedShopServer) CreateOrder

type UnsafeShopServer

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

UnsafeShopServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ShopServer will result in compilation errors.

Jump to

Keyboard shortcuts

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