1
proto/products/v1/service.proto
mya f068352bf7
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
feat: fill out apis
2023-12-31 13:41:06 -06:00

88 lines
1.6 KiB
Protocol Buffer

// Copyright (C) 2023 The Licensing Authors
// SPDX-License-Identifier: MIT
//
// This file attempts to follow common styles and design patterns described by
// Google Cloud based on their extensive use of protocol buffers.
//
// - See here for more: https://cloud.google.com/apis/design/design_patterns
//
syntax = "proto3";
package products.v1;
import "google/api/annotations.proto";
message Product {
string id = 1;
string name = 2;
string description = 3;
}
message ListRequest {}
message ListResponse {
repeated Product products = 5;
}
message CreateRequest {
Product product = 1;
}
message CreateResponse {}
message ReadRequest {
string product_id = 1;
}
message ReadResponse {
Product product = 1;
}
message UpdateRequest {
Product product = 1;
}
message UpdateResponse {}
message DeleteRequest {
string product_id = 1;
}
message DeleteResponse {}
service ProductService {
rpc List(ListRequest) returns (ListResponse) {
option (google.api.http) = {
get: "/v1/products"
};
};
rpc Create(CreateRequest) returns (CreateResponse) {
option (google.api.http) = {
post: "/v1/products"
body: "*"
};
};
rpc Read(ReadRequest) returns (ReadResponse) {
option (google.api.http) = {
get: "/v1/products/{product_id}"
};
};
rpc Update(UpdateRequest) returns (UpdateResponse) {
option (google.api.http) = {
post: "/v1/products/{product.id}"
body: "*"
};
};
rpc Delete(DeleteRequest) returns (DeleteResponse) {
option (google.api.http) = {
delete: "/v1/products/{product_id}"
};
};
}