-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(location): support location msg (#162)
- Loading branch information
Showing
7 changed files
with
141 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package schemas | ||
|
||
type LocationPayload struct { | ||
Accuracy float32 `json:"accuracy"` // Estimated horizontal accuracy of this location, radial, in meters. (same as Android & iOS API) | ||
Address string `json:"address"` // 北京市北京市海淀区45 Chengfu Rd | ||
Latitude float64 `json:"latitude"` // 39.995120999999997 | ||
Longitude float64 `json:"longitude"` // 116.3341 | ||
Name string `json:"name"` // 东升乡人民政府(海淀区成府路45号) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package user | ||
|
||
import ( | ||
"fmt" | ||
"github.com/wechaty/go-wechaty/wechaty-puppet/schemas" | ||
) | ||
|
||
type Location struct { | ||
payload *schemas.LocationPayload | ||
} | ||
|
||
func NewLocation(payload *schemas.LocationPayload) *Location { | ||
return &Location{ | ||
payload: payload, | ||
} | ||
} | ||
|
||
func (l *Location) Payload() schemas.LocationPayload { | ||
return *l.payload | ||
} | ||
|
||
func (l *Location) String() string { | ||
return fmt.Sprintf("Location<%s>", l.payload.Name) | ||
} | ||
|
||
func (l *Location) Address() string { | ||
return l.payload.Address | ||
} | ||
|
||
func (l *Location) Latitude() float64 { | ||
return l.payload.Latitude | ||
} | ||
|
||
func (l *Location) longitude() float64 { | ||
return l.payload.Longitude | ||
} | ||
|
||
func (l *Location) Name() string { | ||
return l.payload.Name | ||
} | ||
|
||
func (l *Location) Accuracy() float32 { | ||
return l.payload.Accuracy | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters