// Store — An online shop: products, customers, orders, reviews and stock. // sondahub (https://sondahub.com): served over gRPC-Web and Connect at https://api.sondahub.com/grpc. // Writes are simulated: answered as a real server would, kept only in the x-sondahub-session token you send back. syntax = "proto3"; package sondahub.store.v1; import "google/protobuf/struct.proto"; service StoreService { // A page of categories: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListCategories(ListCategoriesRequest) returns (ListCategoriesResponse); // One category by id. rpc GetCategory(GetCategoryRequest) returns (Category); // Create a category (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateCategory(Category) returns (Category); // Change the fields set in category (simulated). rpc UpdateCategory(UpdateCategoryRequest) returns (Category); // Delete one (simulated); answers what was removed. rpc DeleteCategory(DeleteCategoryRequest) returns (Category); // A page of products: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListProducts(ListProductsRequest) returns (ListProductsResponse); // One product by id. rpc GetProduct(GetProductRequest) returns (Product); // Create a product (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateProduct(Product) returns (Product); // Change the fields set in product (simulated). rpc UpdateProduct(UpdateProductRequest) returns (Product); // Delete one (simulated); answers what was removed. rpc DeleteProduct(DeleteProductRequest) returns (Product); // A page of customers: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListCustomers(ListCustomersRequest) returns (ListCustomersResponse); // One customer by id. rpc GetCustomer(GetCustomerRequest) returns (Customer); // Create a customer (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateCustomer(Customer) returns (Customer); // Change the fields set in customer (simulated). rpc UpdateCustomer(UpdateCustomerRequest) returns (Customer); // Delete one (simulated); answers what was removed. rpc DeleteCustomer(DeleteCustomerRequest) returns (Customer); // A page of orders: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListOrders(ListOrdersRequest) returns (ListOrdersResponse); // One order by id. rpc GetOrder(GetOrderRequest) returns (Order); // Create a order (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateOrder(Order) returns (Order); // Change the fields set in order (simulated). rpc UpdateOrder(UpdateOrderRequest) returns (Order); // Delete one (simulated); answers what was removed. rpc DeleteOrder(DeleteOrderRequest) returns (Order); // A page of order items: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListOrderItems(ListOrderItemsRequest) returns (ListOrderItemsResponse); // One order item by id. rpc GetOrderItem(GetOrderItemRequest) returns (OrderItem); // Create a order item (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateOrderItem(OrderItem) returns (OrderItem); // Change the fields set in order_item (simulated). rpc UpdateOrderItem(UpdateOrderItemRequest) returns (OrderItem); // Delete one (simulated); answers what was removed. rpc DeleteOrderItem(DeleteOrderItemRequest) returns (OrderItem); // A page of reviews: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListReviews(ListReviewsRequest) returns (ListReviewsResponse); // One review by id. rpc GetReview(GetReviewRequest) returns (Review); // Create a review (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateReview(Review) returns (Review); // Change the fields set in review (simulated). rpc UpdateReview(UpdateReviewRequest) returns (Review); // Delete one (simulated); answers what was removed. rpc DeleteReview(DeleteReviewRequest) returns (Review); // A page of warehouses: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListWarehouses(ListWarehousesRequest) returns (ListWarehousesResponse); // One warehouse by id. rpc GetWarehouse(GetWarehouseRequest) returns (Warehouse); // Create a warehouse (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateWarehouse(Warehouse) returns (Warehouse); // Change the fields set in warehouse (simulated). rpc UpdateWarehouse(UpdateWarehouseRequest) returns (Warehouse); // Delete one (simulated); answers what was removed. rpc DeleteWarehouse(DeleteWarehouseRequest) returns (Warehouse); // A page of inventory: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListInventory(ListInventoryRequest) returns (ListInventoryResponse); // One inventory level by id. rpc GetInventoryLevel(GetInventoryLevelRequest) returns (InventoryLevel); // Create a inventory level (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateInventoryLevel(InventoryLevel) returns (InventoryLevel); // Change the fields set in inventory_level (simulated). rpc UpdateInventoryLevel(UpdateInventoryLevelRequest) returns (InventoryLevel); // Delete one (simulated); answers what was removed. rpc DeleteInventoryLevel(DeleteInventoryLevelRequest) returns (InventoryLevel); // A page of carts: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListCarts(ListCartsRequest) returns (ListCartsResponse); // One cart by id. rpc GetCart(GetCartRequest) returns (Cart); // Create a cart (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateCart(Cart) returns (Cart); // Change the fields set in cart (simulated). rpc UpdateCart(UpdateCartRequest) returns (Cart); // Delete one (simulated); answers what was removed. rpc DeleteCart(DeleteCartRequest) returns (Cart); // The API's live activity as a server stream, each topic at its own pace: orders (every 4 s), inventory (every 6 s). max_events ends the stream (default 10, at most 120). rpc Watch(WatchRequest) returns (stream Event); } message Category { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional string name = 4; optional string slug = 5; optional string description = 6; // Seed products in the category. optional int64 product_count = 7; } message ListCategoriesRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListCategoriesResponse { repeated Category data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateCategoryRequest { int64 id = 1; Category category = 2; } message GetCategoryRequest { int64 id = 1; } message DeleteCategoryRequest { int64 id = 1; } message Product { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; // Unique stock keeping unit. optional string sku = 4; optional string name = 5; optional string slug = 6; optional string description = 7; optional int64 category_id = 8; optional string brand = 9; optional double price = 10; // The struck-through price on sale, or null. optional double compare_at_price = 11; optional string currency = 12; optional string color = 13; optional int64 weight_g = 14; google.protobuf.Value tags = 15; optional bool in_stock = 16; // Average of the seed reviews, 1–5. optional double rating = 17; optional int64 review_count = 18; optional string status = 19; } message ListProductsRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListProductsResponse { repeated Product data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateProductRequest { int64 id = 1; Product product = 2; } message GetProductRequest { int64 id = 1; } message DeleteProductRequest { int64 id = 1; } message Customer { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional string name = 4; optional string email = 5; optional string phone = 6; optional string company = 7; google.protobuf.Value address = 8; optional string tier = 9; optional bool marketing_opt_in = 10; optional int64 orders_count = 11; optional double total_spent = 12; optional string notes = 13; } message ListCustomersRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListCustomersResponse { repeated Customer data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateCustomerRequest { int64 id = 1; Customer customer = 2; } message GetCustomerRequest { int64 id = 1; } message DeleteCustomerRequest { int64 id = 1; } message Order { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; // Human order number. optional string number = 4; optional int64 customer_id = 5; optional string status = 6; optional double subtotal = 7; optional double shipping = 8; optional double tax = 9; optional double discount = 10; optional double total = 11; optional string currency = 12; optional string payment_method = 13; google.protobuf.Value shipping_address = 14; optional string shipping_method = 15; optional string tracking_number = 16; // Defaults to now on POST. optional string placed_at = 17; optional string paid_at = 18; optional string shipped_at = 19; optional string delivered_at = 20; optional string notes = 21; } message ListOrdersRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListOrdersResponse { repeated Order data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateOrderRequest { int64 id = 1; Order order = 2; } message GetOrderRequest { int64 id = 1; } message DeleteOrderRequest { int64 id = 1; } message OrderItem { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional int64 order_id = 4; optional int64 product_id = 5; optional string sku = 6; // The product name at the time of the order. optional string name = 7; optional int64 quantity = 8; optional double unit_price = 9; optional double line_total = 10; } message ListOrderItemsRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListOrderItemsResponse { repeated OrderItem data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateOrderItemRequest { int64 id = 1; OrderItem order_item = 2; } message GetOrderItemRequest { int64 id = 1; } message DeleteOrderItemRequest { int64 id = 1; } message Review { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional int64 product_id = 4; optional int64 customer_id = 5; optional int64 rating = 6; optional string title = 7; optional string body = 8; optional bool verified_purchase = 9; optional int64 helpful_votes = 10; } message ListReviewsRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListReviewsResponse { repeated Review data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateReviewRequest { int64 id = 1; Review review = 2; } message GetReviewRequest { int64 id = 1; } message DeleteReviewRequest { int64 id = 1; } message Warehouse { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional string code = 4; optional string name = 5; google.protobuf.Value address = 6; optional string timezone = 7; } message ListWarehousesRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListWarehousesResponse { repeated Warehouse data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateWarehouseRequest { int64 id = 1; Warehouse warehouse = 2; } message GetWarehouseRequest { int64 id = 1; } message DeleteWarehouseRequest { int64 id = 1; } message InventoryLevel { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional int64 product_id = 4; optional int64 warehouse_id = 5; optional int64 on_hand = 6; optional int64 reserved = 7; optional int64 reorder_point = 8; optional string bin = 9; optional string counted_at = 10; } message ListInventoryRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListInventoryResponse { repeated InventoryLevel data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateInventoryLevelRequest { int64 id = 1; InventoryLevel inventory_level = 2; } message GetInventoryLevelRequest { int64 id = 1; } message DeleteInventoryLevelRequest { int64 id = 1; } message Cart { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional int64 customer_id = 4; // For anonymous carts. optional string session_id = 5; optional string status = 6; google.protobuf.Value items = 7; optional int64 item_count = 8; optional double subtotal = 9; optional string coupon = 10; optional string last_activity_at = 11; } message ListCartsRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListCartsResponse { repeated Cart data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateCartRequest { int64 id = 1; Cart cart = 2; } message GetCartRequest { int64 id = 1; } message DeleteCartRequest { int64 id = 1; } message WatchRequest { repeated string topics = 1; int32 max_events = 2; } message Event { string topic = 1; string api = 2; string ts = 3; google.protobuf.Struct data = 4; }