Skip to content
This repository has been archived by the owner on Oct 7, 2023. It is now read-only.

Add sample output like furik #12

Merged
merged 4 commits into from
Sep 28, 2018
Merged

Add sample output like furik #12

merged 4 commits into from
Sep 28, 2018

Conversation

giraffate
Copy link
Collaborator

  • furikライクにメッセージ出力するためのサンプル実装を書きました。
    • title, eventTypeは適当なメッセージを一旦出力しています。
    • サンプル実装なのでハードコーディングしてるところもあります。
➜  gull git:(show_message_like_furik) ✗ GITHUB_TOKEN=xxxxx go run *.go activity
Show activities: from 2018-09-20 00:00:00 +0900 JST, to 2018-09-27 23:59:59.999999999 +0900 JST
- [PullRequestEvent](https://github.com/yhkaplan/gull/pull/9: PullRequestEvent)
- [PullRequestReviewCommentEvent](https://github.com/yhkaplan/gull/pull/11#discussion_r220885299: PullRequestReviewCommentEvent)
- [PullRequestReviewCommentEvent](https://github.com/yhkaplan/gull/pull/11#discussion_r220883539: PullRequestReviewCommentEvent)
- [PullRequestEvent](https://github.com/yhkaplan/gull/pull/9: PullRequestEvent)
- [PullRequestEvent](https://github.com/yhkaplan/gull/pull/7: PullRequestEvent)
- [PullRequestReviewCommentEvent](https://github.com/yhkaplan/gull/pull/7#discussion_r220824623: PullRequestReviewCommentEvent)
- [PullRequestReviewCommentEvent](https://github.com/yhkaplan/gull/pull/7#discussion_r220819384: PullRequestReviewCommentEvent)
- [PullRequestReviewCommentEvent](https://github.com/yhkaplan/gull/pull/7#discussion_r220817903: PullRequestReviewCommentEvent)
- [PullRequestEvent](https://github.com/yhkaplan/gull/pull/7: PullRequestEvent)
- [PullRequestEvent](https://github.com/yhkaplan/gull/pull/3: PullRequestEvent)
- [PullRequestEvent](https://github.com/yhkaplan/gull/pull/3: PullRequestEvent)

@shimoju
Copy link
Collaborator

shimoju commented Sep 27, 2018

タイトル入れてみた

@shimoju
Copy link
Collaborator

shimoju commented Sep 27, 2018

GetEventsWithGrouping内でParsePayloadして返却型は[]interface{}にして、使う側では型アサーションすればいいのではないかと考えています
https://github.com/google/go-github/blob/master/github/activity_events.go#L33

と思ったけど、型アサーションすると使う側でgithub.com/google/go-github/githubをimportしないといけなくて、ライブラリの実装が漏れ出してしまう
なので、github.Event{type:, payload:}な構造体を作って、typeの文字列でswitchすればいいかなとなった
EventにTitleメソッドを生やして、統一的にtitleを取得できるようにする、とかもできそうだし

main.go Outdated
for _, event := range events {
var (
eventType, title, link string
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これ、()なくていいんだっけ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これ以外はいったん良さそうです〜

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なくていいですね、修正しますー

@giraffate
Copy link
Collaborator Author

@shimoju #12 (comment) の件はリファクタなので後でやろうかと。Issueとして残しておきます。
#14

Copy link
Collaborator

@shimoju shimoju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆗

@giraffate giraffate merged commit fa6a468 into master Sep 28, 2018
@giraffate giraffate deleted the show_message_like_furik branch September 28, 2018 01:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants