Merge pull request #15 from gwinn/master

add prouct & order messages structs
This commit is contained in:
Alex Lushpai 2018-09-12 11:35:57 +03:00 committed by GitHub
commit 55b0a617b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -311,26 +311,28 @@ type (
ID uint64 `json:"id"`
Time string `json:"time"`
Type string `json:"type"`
Scope string `json:"scope"`
ChatID uint64 `json:"chat_id"`
IsRead bool `json:"is_read"`
IsEdit bool `json:"is_edit"`
Status string `json:"status"`
TextMessage
SystemMessage
From *UserRef `json:"from"`
Product *MessageProduct `json:"product,omitempty"`
Order *MessageOrder `json:"order,omitempty"`
*TextMessage
*SystemMessage
}
TextMessage struct {
Scope string `json:"scope"`
Content string `json:"content"`
From UserRef `json:"from"`
Quote QuoteMessage `json:"quote"`
IsEdit bool `json:"is_edit"`
Quote *QuoteMessage `json:"quote"`
Actions []string `json:"actions"`
}
SystemMessage struct {
Action string `json:"action"`
Dialog SystemMessageDialog `json:"dialog,omitempty"`
User UserRef `json:"user,omitempty"`
Dialog *SystemMessageDialog `json:"dialog,omitempty"`
User *UserRef `json:"user,omitempty"`
}
SystemMessageDialog struct {
@ -341,14 +343,56 @@ type (
ID uint64 `json:"id"`
Content string `json:"content"`
Time string `json:"time"`
From UserRef `json:"from"`
From *UserRef `json:"from"`
}
MessageProduct struct {
ID uint64 `json:"id"`
Name string `json:"name"`
Article string `json:"article,omitempty"`
Url string `json:"url,omitempty"`
Img string `json:"img,omitempty"`
Cost *MessageOrderCost `json:"cost,omitempty"`
Quantity *MessageOrderQuantity `json:"quantity,omitempty"`
}
MessageOrder struct {
Number string `json:"number"`
Url string `json:"url,omitempty"`
Date string `json:"date,omitempty"`
Cost *MessageOrderCost `json:"cost,omitempty"`
Status *MessageOrderStatus `json:"status,omitempty"`
Items []MessageOrderItem `json:"items,omitempty"`
}
MessageOrderStatus struct {
Code string `json:"code,omitempty"`
Name string `json:"name,omitempty"`
}
MessageOrderItem struct {
Name string `json:"name,omitempty"`
Url string `json:"url,omitempty"`
Quantity string `json:"quantity,omitempty"`
Price string `json:"price,omitempty"`
}
MessageOrderCost struct {
Value float32 `json:"value,omitempty"`
Currency string `json:"currency"`
}
MessageOrderQuantity struct {
Value float32 `json:"value"`
Unit string `json:"unit"`
}
UserRef struct {
ID uint64 `json:"id"`
Avatar string `json:"avatar"`
Type string `json:"type"`
Name string `json:"name"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Phone string `json:"phone,omitempty"`
Email string `json:"email,omitempty"`
}