# Protocol Documentation

## Table of Contents

## cash.proto

Top

### CashLogItem

Field | Type | Label | Description
date_created | string |  |
created_by | string |  |
amount | int32 |  |
kind | string |  |

### GetBalanceRequest

### GetBalanceResponse

### ListRequest

Field | Type | Label | Description
from | string |  |
till | string |  |

### ListResponse

Field | Type | Label | Description
log | CashLogItem | repeated |

### PurchaseRequest

### PurchaseResponse

### TransactionRequest

Field | Type | Label | Description
created_by | string |  |
amount | int32 |  |

### TransactionResponse

### Cash

Method Name | Request Type | Response Type | Description
Purchase | PurchaseRequest | PurchaseResponse |
Transaction | TransactionRequest | TransactionResponse |
List | ListRequest | ListResponse |
GetBalance | GetBalanceRequest | GetBalanceResponse |

## customer.proto

Top

### AddUserRequest

Field | Type | Label | Description
customer_id | string |  |
user_id | string |  |

### AddUserResponse

Field | Type | Label | Description
customer | CustomerObj |  |

### Address

Field | Type | Label | Description
zip | string |  |
location | string |  |
address | string |  |

### CreateNewRequest

Field | Type | Label | Description
name | string |  |
email | string |  |
phone | string |  |
tax_number | string |  |
zip | string |  |
location | string |  |
address | string |  |
created_by | string |  |

### CreateNewResponse

Field | Type | Label | Description
customer | CustomerObj |  |

### CustomerObj

Field | Type | Label | Description
id | string |  |
name | string |  |
email | string |  |
phone | string |  |
tax_number | string |  |
address | Address |  |
has_user | bool |  |
users | string | repeated |
date_created | string |  |
created_by | string |  | next = 11;;

### CustomerUpdateObj

Field | Type | Label | Description
id | string |  |
name | string |  |
address | Address |  |
email | string |  |
phone | string |  |
tax_number | string |  |

### GetAllResponse

Field | Type | Label | Description
customers | CustomerObj | repeated |

### GetByIdRequest

Field | Type | Label | Description
customer_id | string |  |

### GetByIdResponse

Field | Type | Label | Description
customer | CustomerObj |  |

### RemoveUserRequest

Field | Type | Label | Description
customer_id | string |  |
user_id | string |  |

### RemoveUserResponse

Field | Type | Label | Description
customer | CustomerObj |  |

### UpdateByIdRequest

Field | Type | Label | Description
customer_id | string |  |
customer | CustomerUpdateObj |  |

### UpdateByIdResponse

Field | Type | Label | Description
customer | CustomerObj |  |

### Customer

Method Name | Request Type | Response Type | Description
CreateNew | CreateNewRequest | CreateNewResponse |
GetAll | .google.protobuf.Empty | GetAllResponse |
GetById | GetByIdRequest | GetByIdResponse |
UpdateById | UpdateByIdRequest | UpdateByIdResponse |
AddUser | AddUserRequest | AddUserResponse |
RemoveUser | RemoveUserRequest | RemoveUserResponse |

## email.proto

Top

### EmailRequest

Field | Type | Label | Description
to | string |  |
subject | string |  |
body | string |  |

### Email

Method Name | Request Type | Response Type | Description
SendEmail | EmailRequest | .google.protobuf.Empty |

## prelude.proto

Top

### DateTime

Field | Type | Label | Description
rfc_3399 | string |  |

### FloatValue

Field | Type | Label | Description
value | float |  |

### UserId

Field | Type | Label | Description
userid | string |  |

## product.proto

Top

### CreateNewRequest

Field | Type | Label | Description
name | string |  |
quantity | string |  |
unit | string |  |
created_by | string |  |

### CreateNewResponse

Field | Type | Label | Description
product | ProductObj |  |

### GetAllResponse

Field | Type | Label | Description
products | ProductObj | repeated |

### GetByIdRequest

Field | Type | Label | Description
sku | string |  |

### GetByIdResponse

Field | Type | Label | Description
product | ProductObj |  |

### IsSkuRequest

Field | Type | Label | Description
sku | string |  |

### IsSkuResponse

Field | Type | Label | Description
sku_exist | bool |  |

### ProductObj

Field | Type | Label | Description
sku | string |  |
name | string |  |
quantity | string |  |
unit | string |  | impl Into<String> for Unit {} & from_str()
created_by | string |  | Maybe UserId? And impl From<..> for it?
created_at | string |  |

### ProductUpdateObj

Field | Type | Label | Description
sku | string |  |
name | string |  |
quantity | string |  |
unit | string |  |

### SKU

Field | Type | Label | Description
sku | string |  |

### UpdateByIdRequest

Field | Type | Label | Description
product | ProductUpdateObj |  |

### UpdateByIdResponse

Field | Type | Label | Description
product | ProductObj |  | Product Object After an update call, it will return the updated object for validation

### Product

Product Service

All the methods related to manage Product

Method Name | Request Type | Response Type | Description
CreateNew | CreateNewRequest | CreateNewResponse |
GetAll | .google.protobuf.Empty | GetAllResponse |
GetById | GetByIdRequest | GetByIdResponse |
UpdateById | UpdateByIdRequest | UpdateByIdResponse |
isSku | IsSkuRequest | IsSkuResponse |

## source.proto

Top

### PriceHistory

Field | Type | Label | Description
sku | string |  |
items | PriceHistoryItem | repeated | next:

### PriceHistoryItem

Field | Type | Label | Description
date | string |  |
created_by | string |  |
net_wholesale_price | uint32 |  |
comment | string |  |
kind | string |  | next:

### Todo

### Source

Method Name | Request Type | Response Type | Description
NewSource | Todo | Todo | Create new source
GetSourceById | Todo | Todo | Get source by id
GetAllSources | Todo | Todo | Get list of sources
UpdateSourceById | Todo | Todo stream | Update source by id
AddNewSkuToSource | Todo | Todo | Add new sku to source
GetPriceBySku | Todo | Todo | Get price by SKU
GetPriceHistoryBySku | Todo | Todo | Get price history by SKU

## upl.proto

Top

### CreateNewRequest

Field | Type | Label | Description
id | uint32 |  |
sku | string |  | ..
created_by | string |  |
date_created | string |  |

### CreateNewResponse

Field | Type | Label | Description
upl | Upl |  |

### GetUplRequest

Field | Type | Label | Description
upl_id | uint32 |  |

### GetUplResponse

Field | Type | Label | Description
upl | Upl |  |

### MoveRequest

Field | Type | Label | Description
from_type | string |  | e.g. stock
from_id | string |  | e.g. 324324
to_type | string |  | e.g. cart
to_id | string |  | e.g. 4367

### MoveResponse

Field | Type | Label | Description
todo | string |  |
todo2 | string |  |

### Upl

Field | Type | Label | Description
id | uint64 |  |
sku | string |  |
location_history | UplHistoryItem | repeated | ...
created_by | string |  |
date_created | string |  |

### UplByPlaceRequest

### UplHistoryItem

Field | Type | Label | Description
location | string |  |
id | string |  |
date_created | string |  |
created_by | string |  |

### UplStore

Method Name | Request Type | Response Type | Description
CreateNew | CreateNewRequest | CreateNewResponse |
GetById | GetUplRequest | GetUplResponse |
Move | MoveRequest | MoveResponse |
GetByPlace | UplByPlaceRequest | Upl stream |

## user.proto

Top

### AllUserRequest

### CreateNewRequest

Field | Type | Label | Description
id | string |  |
email | string |  |
name | string |  |
phone | string |  |
created_by | string |  |

### CreateNewResponse

Field | Type | Label | Description
user | UserObj |  |

### GetAllResponse

Field | Type | Label | Description
users | UserObj | repeated |

### GetByIdRequest

Field | Type | Label | Description
userid | string |  |

### GetByIdResponse

Field | Type | Label | Description
user | UserObj |  |

### IsUserRequest

Field | Type | Label | Description
userid | string |  |

### IsUserResponse

Field | Type | Label | Description
user_exist | bool |  |

### LoginRequest

Field | Type | Label | Description
username | string |  |
password | string |  |

### LoginResponse

Field | Type | Label | Description
is_valid | bool |  |
user | UserObj |  |

### NewPasswordRequest

Field | Type | Label | Description
userid | string |  |
new_password | string |  |

### NewPasswordResponse

### ResetPasswordRequest

Field | Type | Label | Description
email | string |  |

### ResetPasswordResponse

### UpdateByIdRequest

Field | Type | Label | Description
user | UserObj |  |

### UpdateByIdResponse

Field | Type | Label | Description
user | UserObj |  |

### UserObj

Field | Type | Label | Description
id | string |  |
name | string |  |
email | string |  |
phone | string |  |
customers | string | repeated | This will be Vec<String>
created_by | string |  |
created_at | string |  | maybe datetime type?

### User

Method Name | Request Type | Response Type | Description
CreateNew | CreateNewRequest | CreateNewResponse | CreateNewUser CreateNewRequest -> CreateNewResponse
GetAll | .google.protobuf.Empty | UserObj stream | Get all users AllUserRequest -> GerAllResponse
GetById | GetByIdRequest | GetByIdResponse | Get User By Id GetByIdRequest -> UserByIdResponse
UpdateById | UpdateByIdRequest | UpdateByIdResponse | Update User By ID UpdateByIdRequest -> UpdateUserReply
IsUser | IsUserRequest | IsUserResponse | rpc CheckUserExist(google.protobuf.Empty) returns (google.protobuf.Empty);
ResetPassword | ResetPasswordRequest | ResetPasswordResponse | ResetPassword -> Email::send(!)
SetNewPassword | NewPasswordRequest | NewPasswordResponse | Set new password
ValidateLogin | LoginRequest | LoginResponse | Validate login request

## Scalar Value Types

.proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby
double |  | double | double | float | float64 | double | float | Float
float |  | float | float | float | float32 | float | float | Float
int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required)
int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum
uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required)
uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required)
sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required)
sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum
fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required)
fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum
sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required)
sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum
bool |  | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass
string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8)
bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT)