155 lines
5.2 KiB
Go
155 lines
5.2 KiB
Go
package main
|
|
|
|
type UberResponse struct {
|
|
Status string `json:"status"`
|
|
Data UberData `json:"data"`
|
|
}
|
|
|
|
type UberData struct {
|
|
Orders []UberDataOrder `json:"orders"`
|
|
}
|
|
|
|
type Contact struct {
|
|
Type string `json:"type"`
|
|
Title string `json:"title"`
|
|
PhoneNumber string `json:"phoneNumber"`
|
|
FormattedPhoneNumber string `json:"formattedPhoneNumber"`
|
|
}
|
|
|
|
type ActiveOrderOverview struct {
|
|
Title string `json:"title"`
|
|
Subtitle string `json:"subtitle"`
|
|
BackgroundImageURL string `json:"backgroundImageUrl"`
|
|
Items []struct {
|
|
ShoppingCartItemUUID string `json:"shoppingCartItemUUID"`
|
|
Title string `json:"title"`
|
|
Quantity int `json:"quantity"`
|
|
Subtitle string `json:"subtitle"`
|
|
} `json:"items"`
|
|
Actions interface{} `json:"actions"`
|
|
}
|
|
|
|
type InAppNotification struct {
|
|
Title string `json:"title"`
|
|
Subtitle string `json:"subtitle"`
|
|
}
|
|
|
|
type FeedCardStatus struct {
|
|
Title string `json:"title"`
|
|
Subtitle string `json:"subtitle"`
|
|
TimelineSummary string `json:"timelineSummary"`
|
|
StatusSummary struct {
|
|
Text string `json:"text"`
|
|
InfoText string `json:"infoText"`
|
|
InfoBody string `json:"infoBody"`
|
|
} `json:"statusSummary"`
|
|
CurrentProgress int `json:"currentProgress"`
|
|
TotalProgressSegments int `json:"totalProgressSegments"`
|
|
AnimateCurrentProgressSegment bool `json:"animateCurrentProgressSegment"`
|
|
Actions interface{} `json:"actions"`
|
|
}
|
|
|
|
type FeedCard struct {
|
|
Status FeedCardStatus `json:"status,omitempty"`
|
|
MapEntity interface{} `json:"mapEntity"`
|
|
Courier interface{} `json:"courier"`
|
|
Type string `json:"type"`
|
|
Savings struct {
|
|
Title string `json:"title"`
|
|
IconImageURL string `json:"iconImageUrl"`
|
|
} `json:"savings,omitempty"`
|
|
Delivery struct {
|
|
FormattedAddress string `json:"formattedAddress"`
|
|
DeliveryTypeDescription string `json:"deliveryTypeDescription"`
|
|
SpecialInstructions string `json:"specialInstructions"`
|
|
Title string `json:"title"`
|
|
Paragraphs []struct {
|
|
Title string `json:"title"`
|
|
Subtitle string `json:"subtitle,omitempty"`
|
|
} `json:"paragraphs"`
|
|
} `json:"delivery,omitempty"`
|
|
OrderSummary struct {
|
|
RestaurantName string `json:"restaurantName"`
|
|
Items []struct {
|
|
ShoppingCartItemUUID string `json:"shoppingCartItemUUID"`
|
|
Title string `json:"title"`
|
|
Quantity int `json:"quantity"`
|
|
Subtitle string `json:"subtitle"`
|
|
} `json:"items"`
|
|
Total string `json:"total"`
|
|
Sections []interface{} `json:"sections"`
|
|
TotalLabel string `json:"totalLabel"`
|
|
} `json:"orderSummary,omitempty"`
|
|
}
|
|
|
|
type BackgroundFeedCard struct {
|
|
MapEntity []struct {
|
|
UUID string `json:"uuid"`
|
|
Type string `json:"type"`
|
|
Latitude float64 `json:"latitude"`
|
|
Longitude float64 `json:"longitude"`
|
|
Course float64 `json:"course,omitempty"`
|
|
Subtitle interface{} `json:"subtitle"`
|
|
PathPoints []struct {
|
|
Epoch int64 `json:"epoch"`
|
|
Latitude float64 `json:"latitude"`
|
|
Longitude float64 `json:"longitude"`
|
|
Course float64 `json:"course"`
|
|
} `json:"pathPoints"`
|
|
IconURL string `json:"iconUrl,omitempty"`
|
|
SpriteCount int `json:"spriteCount,omitempty"`
|
|
SpriteSize int `json:"spriteSize,omitempty"`
|
|
Title string `json:"title,omitempty"`
|
|
} `json:"mapEntity"`
|
|
Courier interface{} `json:"courier"`
|
|
Type string `json:"type"`
|
|
}
|
|
|
|
type UberDataOrder struct {
|
|
UUID string `json:"uuid"`
|
|
Contacts []Contact `json:"contacts"`
|
|
Actions interface{} `json:"actions"`
|
|
BottomSheets interface{} `json:"bottomSheets"`
|
|
OrderInfo OrderInfo `json:"orderInfo"`
|
|
ActiveOrderOverview ActiveOrderOverview `json:"activeOrderOverview"`
|
|
InAppNotification InAppNotification `json:"inAppNotification"`
|
|
FeedCards []FeedCard `json:"feedCards"`
|
|
BackgroundFeedCards []BackgroundFeedCard `json:"backgroundFeedCards"`
|
|
Layout string `json:"layout"`
|
|
}
|
|
|
|
func (o *UberDataOrder) Status() string {
|
|
for _, feedCard := range o.FeedCards {
|
|
if feedCard.Type == "status" {
|
|
c := feedCard.Status
|
|
return c.Subtitle + " " + c.Title + "\n" + c.TimelineSummary
|
|
}
|
|
}
|
|
return ""
|
|
}
|
|
|
|
type OrderInfo struct {
|
|
OrderPhase string `json:"orderPhase"`
|
|
StoreInfo struct {
|
|
StoreUUID string `json:"storeUUID"`
|
|
TerritoryUUID string `json:"territoryUUID"`
|
|
Location struct {
|
|
Address struct {
|
|
Address1 string `json:"address1"`
|
|
City string `json:"city"`
|
|
Country string `json:"country"`
|
|
PostalCode string `json:"postalCode"`
|
|
Region string `json:"region"`
|
|
UUID string `json:"uuid"`
|
|
} `json:"address"`
|
|
Latitude float64 `json:"latitude"`
|
|
Longitude float64 `json:"longitude"`
|
|
} `json:"location"`
|
|
WebURL string `json:"webURL"`
|
|
HeroImageURL string `json:"heroImageURL"`
|
|
Name string `json:"name"`
|
|
} `json:"storeInfo"`
|
|
OrderCategory string `json:"orderCategory"`
|
|
CustomerInfos interface{} `json:"customerInfos"`
|
|
}
|