Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to model default or template resources? #1235

Open
themodernlife opened this issue Oct 2, 2023 · 0 comments
Open

How to model default or template resources? #1235

themodernlife opened this issue Oct 2, 2023 · 0 comments

Comments

@themodernlife
Copy link

themodernlife commented Oct 2, 2023

Does anyone have thoughts on how a client could obtain a prepoulated, example resource?

For example, imagine an API for tracking inventory. The client will create a new InventoryCount resource each time they want to submit information about the in-stock inventory. Each InventoryCount has associated metadata such as the create_time, the user who did the count, etc.

message InventoryCountItem {
  string product_name = 1;
  float quantity = 2;
}

message InventoryCount {
  string summary = 1;
  google.protobuf.Timestamp create_time = 2;
  repeated InventoryCountItem items = 3;
}

When created client side, an InventoryCount will default to having an empty set of InventoryCountItems. However, the list of products is known in advance, and it would be preferable if the client could somehow download a templated or example InventoryCount, make modifications (e.g. update quantity, and then submit via CreateInventoryCount.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant