Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Commit bfe29b2

Browse files
author
Raphael Santo Domingo
committed
Add rust native implementation of protobufs
Other changes - Removed enum ProductType declarations in each Product action message (see protos/product_payload.proto) - Renamed 'product_values' field to 'properties' field for coherency (see protos/product_state.proto) - Replaced deprecated StdError 'cause' function with new 'source' function (see protocol/product/state.rs) Signed-off-by: Raphael Santo Domingo <[email protected]>
1 parent b7ec9a4 commit bfe29b2

File tree

6 files changed

+1337
-18
lines changed

6 files changed

+1337
-18
lines changed

sdk/protos/product_payload.proto

+4-16
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,24 @@ message ProductPayload {
3737
}
3838

3939
message ProductCreateAction {
40-
enum ProductType {
41-
UNSET_TYPE = 0;
42-
GS1 = 1;
43-
}
4440
// product_type and identifier are used in deriving the state address
45-
ProductType product_type = 1;
41+
Product.ProductType product_type = 1;
4642
string identifier = 2;
4743
string owner = 3;
4844
repeated PropertyValue properties = 4;
4945
}
5046

5147
message ProductUpdateAction {
52-
enum ProductType {
53-
UNSET_TYPE = 0;
54-
GS1 = 1;
55-
}
5648
// product_type and identifier are used in deriving the state address
57-
ProductType product_type = 1;
49+
Product.ProductType product_type = 1;
5850
string identifier = 2;
5951
// this will replace all properties currently defined
60-
repeated PropertyValue properties = 4;
52+
repeated PropertyValue properties = 3;
6153
}
6254

6355
message ProductDeleteAction {
64-
enum ProductType {
65-
UNSET_TYPE = 0;
66-
GS1 = 1;
67-
}
6856
// product_type and identifier are used in deriving the state address
69-
ProductType product_type = 1;
57+
Product.ProductType product_type = 1;
7058
string identifier = 2;
7159
}
7260

sdk/protos/product_state.proto

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ message Product {
2626
string identifier = 1;
2727

2828
// What type of product is this (GS1)
29-
ProductType type = 2;
29+
ProductType product_type = 2;
3030

3131
// Who owns this product (pike organization id)
3232
string owner = 3;
3333

3434
// Addition attributes for custom configurations
35-
repeated PropertyValue product_values = 4;
35+
repeated PropertyValue properties = 4;
3636
}
3737

3838
message ProductList {

sdk/src/protocol/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414

1515
pub mod errors;
1616
pub mod pike;
17+
pub mod product;
1718
pub mod schema;
1819
pub mod track_and_trace;

sdk/src/protocol/product/mod.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) 2019 Target Brands, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
use super::errors;
16+
17+
pub mod payload;
18+
pub mod state;

0 commit comments

Comments
 (0)