New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AccountLink event #91
Conversation
linebot/event.go
Outdated
Message Message | ||
Postback *Postback | ||
Beacon *Beacon | ||
AccountLink *AccountLink `json:"link"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this json tag needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry. This tag is not needed.
linebot/event.go
Outdated
@@ -82,25 +83,33 @@ type Beacon struct { | |||
DeviceMessage []byte | |||
} | |||
|
|||
// AccountLink type | |||
type AccountLink struct { | |||
Result string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Result
seems to be ok
or failed
only.
Can you modify its type from string
to other type and use constant values?
For example:
type AccountLinkResult string
const (
AccountLinkResultOK AccountLinkResult = "ok"
AccountLinkResultFailed AccountLinkResult = "failed"
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your review. I see.
I will fix them and add tests of Event.MarshalJSON
and Event.UnmarshalJSON
.
And I have to fix Event.MarshalJSON
also.
I have fixed. |
linebot/webhook_test.go
Outdated
@@ -236,6 +236,19 @@ var webhookTestRequestBody = `{ | |||
"type":"enter", | |||
"dm":"1234567890abcdef" | |||
} | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please replace tabs to spaces...? (Here is just inside the JSON literal..)
linebot/webhook_test.go
Outdated
UserID: "U012345678901234567890123456789ab", | ||
}, | ||
AccountLink: &AccountLink{ | ||
Result: "ok", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Result: AccountLinkResultOK
is more better.
@sugyan Thank you for your review. |
LGTM. Thanks! 🙆♂️ |
No description provided.