{"action":"created","comment":{"url":"https://api.github.com/repos/google/go-github/pulls/comments/181591168","pull_request_review_id":112245809,"id":181591168,"diff_hunk":"@@ -0,0 +1,159 @@\n+// Copyright 2018 The go-github AUTHORS. All rights reserved.\n+//\n+// Use of this source code is governed by a BSD-style\n+// license that can be found in the LICENSE file.\n+\n+package github\n+\n+import (\n+\t\"context\"\n+\t\"fmt\"\n+)\n+\n+// TeamDiscussion represents a GitHub dicussion in a team\n+type TeamDiscussion struct {\n+\tAuthor        *User      `json:\"author,omitempty\"`\n+\tBody          *string    `json:\"body,omitempty\"`\n+\tBodyHTML      *string    `json:\"body_html,omitempty\"`\n+\tBodyVersion   *string    `json:\"body_version,omitempty\"`\n+\tCommentsCount *int64     `json:\"comments_count,omitempty\"`\n+\tCommentsURL   *string    `json:\"comments_url,omitempty\"`\n+\tCreatedAt     *Timestamp `json:\"created_at,omitempty\"`\n+\tLastEditedAt  *Timestamp `json:\"last_edited_at,omitempty\"`\n+\tHTMLURL       *string    `json:\"html_url,omitempty\"`\n+\tNodeID        *string    `json:\"node_id,omitempty\"`\n+\tNumber        *int64     `json:\"number,omitempty\"`\n+\tPinned        *bool      `json:\"pinned,omitempty\"`\n+\tPrivate       *bool      `json:\"private,omitempty\"`\n+\tTeamURL       *string    `json:\"team_url,omitempty\"`\n+\tTitle         *string    `json:\"title,omitempty\"`\n+\tUpdatedAt     *Timestamp `json:\"updated_at,omitempty\"`\n+\tURL           *string    `json:\"url,omitempty\"`\n+}\n+\n+func (d TeamDiscussion) String() string {\n+\treturn Stringify(d)\n+}\n+\n+// DiscussionListOptions specifies optional parameters to the\n+// TeamServices.ListDiscussions method\n+type DiscussionListOptions struct {\n+\t// Sorts the discussion by the date they were created.\n+\t// Accepted values are asc and desc. Default is desc.\n+\tDirection string `url:\"direction,omitempty\"`\n+}\n+\n+// ListDiscussions lists all discussions on team's page.\n+// Authenticated user must grant read:discussion scope.\n+//\n+// GitHub API docs: https://developer.github.com/v3/teams/discussions/#list-discussions\n+func (s *TeamsService) ListDiscussions(ctx context.Context, team int64, options *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) {\n+\tu := fmt.Sprintf(\"teams/%v/discussions\", team)\n+\tu, err := addOptions(u, options)\n+\tif err != nil {\n+\t\treturn nil, nil, err\n+\t}\n+\n+\treq, err := s.client.NewRequest(\"GET\", u, nil)\n+\tif err != nil {\n+\t\treturn nil, nil, err\n+\t}\n+\n+\t// TODO: remove custom Accept header when this API fully launches.\n+\treq.Header.Set(\"Accept\", mediaTypeTeamDiscussionsPreview)\n+\n+\tvar teamDiscussions []*TeamDiscussion\n+\tresp, err := s.client.Do(ctx, req, &teamDiscussions)\n+\tif err != nil {\n+\t\treturn nil, resp, err\n+\t}\n+\n+\treturn teamDiscussions, resp, nil\n+}\n+\n+// GetDiscussion gets a specific discussion on a team's page.\n+// Authenticated user must grant read:discussion scope.\n+//\n+// GitHub API docs: https://developer.github.com/v3/teams/discussions/#get-a-single-discussion\n+func (s *TeamsService) GetDiscussion(ctx context.Context, team, id int64) (*TeamDiscussion, *Response, error) {\n+\tu := fmt.Sprintf(\"teams/%v/discussions/%v\", team, id)\n+\treq, err := s.client.NewRequest(\"GET\", u, nil)\n+\tif err != nil {\n+\t\treturn nil, nil, err\n+\t}\n+\n+\t// TODO: remove custom Accept header when this API fully launches.\n+\treq.Header.Set(\"Accept\", mediaTypeTeamDiscussionsPreview)\n+\n+\tteamDiscussion := &TeamDiscussion{}\n+\tresp, err := s.client.Do(ctx, req, teamDiscussion)\n+\tif err != nil {\n+\t\treturn nil, resp, err\n+\t}\n+\n+\treturn teamDiscussion, resp, nil\n+}\n+\n+// CreateDiscussion creates a new discussion post on a team's page.\n+// Authenticated user must grant write:discussion scope.\n+//\n+// GitHub API docs: https://developer.github.com/v3/teams/discussions/#create-a-discussion\n+func (s *TeamsService) CreateDiscussion(ctx context.Context, team int64, discussion *TeamDiscussion) (*TeamDiscussion, *Response, error) {\n+\tu := fmt.Sprintf(\"teams/%v/discussions\", team)\n+\treq, err := s.client.NewRequest(\"POST\", u, discussion)\n+\tif err != nil {\n+\t\treturn nil, nil, err\n+\t}\n+\n+\t// TODO: remove custom Accept header when this API fully launches.\n+\treq.Header.Set(\"Accept\", mediaTypeTeamDiscussionsPreview)\n+\n+\tteamDiscussion := &TeamDiscussion{}\n+\tresp, err := s.client.Do(ctx, req, teamDiscussion)\n+\tif err != nil {\n+\t\treturn nil, resp, err\n+\t}\n+\n+\treturn teamDiscussion, resp, nil\n+}\n+\n+// EditDiscussion edits the title and body text of a discussion post.\n+// Authenticated user must grant write:discussion scope.\n+// User is allowed to change Title and Body of a discussion only.\n+//\n+// GitHub API docs: https://developer.github.com/v3/teams/discussions/#edit-a-discussion\n+func (s *TeamsService) EditDiscussion(ctx context.Context, team, id int64, discussion *TeamDiscussion) (*TeamDiscussion, *Response, error) {","path":"github/teams_discussions.go","position":130,"original_position":125,"commit_id":"d6eb23b56545f2220082fcdab4f31778630d9f79","original_commit_id":"16c6b07329a3fc9dda2bbe05aa7a2176c6fc81e5","user":{"login":"parkhyukjun89","id":11878790,"avatar_url":"https://avatars1.githubusercontent.com/u/11878790?v=4","gravatar_id":"","url":"https://api.github.com/users/parkhyukjun89","html_url":"https://github.com/parkhyukjun89","followers_url":"https://api.github.com/users/parkhyukjun89/followers","following_url":"https://api.github.com/users/parkhyukjun89/following{/other_user}","gists_url":"https://api.github.com/users/parkhyukjun89/gists{/gist_id}","starred_url":"https://api.github.com/users/parkhyukjun89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parkhyukjun89/subscriptions","organizations_url":"https://api.github.com/users/parkhyukjun89/orgs","repos_url":"https://api.github.com/users/parkhyukjun89/repos","events_url":"https://api.github.com/users/parkhyukjun89/events{/privacy}","received_events_url":"https://api.github.com/users/parkhyukjun89/received_events","type":"User","site_admin":false},"body":"Added a nil check","created_at":"2018-04-15T17:49:52Z","updated_at":"2018-04-15T17:49:52Z","html_url":"https://github.com/google/go-github/pull/889#discussion_r181591168","pull_request_url":"https://api.github.com/repos/google/go-github/pulls/889","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/google/go-github/pulls/comments/181591168"},"html":{"href":"https://github.com/google/go-github/pull/889#discussion_r181591168"},"pull_request":{"href":"https://api.github.com/repos/google/go-github/pulls/889"}},"in_reply_to_id":180089294},"pull_request":{"url":"https://api.github.com/repos/google/go-github/pulls/889","id":179196535,"html_url":"https://github.com/google/go-github/pull/889","diff_url":"https://github.com/google/go-github/pull/889.diff","patch_url":"https://github.com/google/go-github/pull/889.patch","issue_url":"https://api.github.com/repos/google/go-github/issues/889","number":889,"state":"open","locked":false,"title":"Support preview Team Discussions API","user":{"login":"parkhyukjun89","id":11878790,"avatar_url":"https://avatars1.githubusercontent.com/u/11878790?v=4","gravatar_id":"","url":"https://api.github.com/users/parkhyukjun89","html_url":"https://github.com/parkhyukjun89","followers_url":"https://api.github.com/users/parkhyukjun89/followers","following_url":"https://api.github.com/users/parkhyukjun89/following{/other_user}","gists_url":"https://api.github.com/users/parkhyukjun89/gists{/gist_id}","starred_url":"https://api.github.com/users/parkhyukjun89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parkhyukjun89/subscriptions","organizations_url":"https://api.github.com/users/parkhyukjun89/orgs","repos_url":"https://api.github.com/users/parkhyukjun89/repos","events_url":"https://api.github.com/users/parkhyukjun89/events{/privacy}","received_events_url":"https://api.github.com/users/parkhyukjun89/received_events","type":"User","site_admin":false},"body":"- Add a new service TeamsService to support API related to Organization Teams https://developer.github.com/v3/teams/\r\n- Add methods to support new preview API for team discussions https://developer.github.com/v3/teams/discussions/\r\n- Add methods to support new preview API for team discussion comments https://developer.github.com/v3/teams/discussion_comments/\r\n\r\nFixes #849 \r\nhttps://developer.github.com/changes/2018-02-07-team-discussions-api/#new-rest-api-endpoints\r\n\r\nSecond part of the change https://developer.github.com/changes/2018-02-07-team-discussions-api/#updates-to-the-teams-api-documentation will be done in a separate PR, once this PR is merged.","created_at":"2018-04-03T19:28:06Z","updated_at":"2018-04-15T17:49:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b72ee081f3748cd9084e738cbde4ca4e27b046ff","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":698400531,"url":"https://api.github.com/repos/google/go-github/labels/cla:%20yes","name":"cla: yes","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/google/go-github/pulls/889/commits","review_comments_url":"https://api.github.com/repos/google/go-github/pulls/889/comments","review_comment_url":"https://api.github.com/repos/google/go-github/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/go-github/issues/889/comments","statuses_url":"https://api.github.com/repos/google/go-github/statuses/d6eb23b56545f2220082fcdab4f31778630d9f79","head":{"label":"parkhyukjun89:team_discussion_part0","ref":"team_discussion_part0","sha":"d6eb23b56545f2220082fcdab4f31778630d9f79","user":{"login":"parkhyukjun89","id":11878790,"avatar_url":"https://avatars1.githubusercontent.com/u/11878790?v=4","gravatar_id":"","url":"https://api.github.com/users/parkhyukjun89","html_url":"https://github.com/parkhyukjun89","followers_url":"https://api.github.com/users/parkhyukjun89/followers","following_url":"https://api.github.com/users/parkhyukjun89/following{/other_user}","gists_url":"https://api.github.com/users/parkhyukjun89/gists{/gist_id}","starred_url":"https://api.github.com/users/parkhyukjun89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parkhyukjun89/subscriptions","organizations_url":"https://api.github.com/users/parkhyukjun89/orgs","repos_url":"https://api.github.com/users/parkhyukjun89/repos","events_url":"https://api.github.com/users/parkhyukjun89/events{/privacy}","received_events_url":"https://api.github.com/users/parkhyukjun89/received_events","type":"User","site_admin":false},"repo":{"id":120053344,"name":"go-github","full_name":"parkhyukjun89/go-github","owner":{"login":"parkhyukjun89","id":11878790,"avatar_url":"https://avatars1.githubusercontent.com/u/11878790?v=4","gravatar_id":"","url":"https://api.github.com/users/parkhyukjun89","html_url":"https://github.com/parkhyukjun89","followers_url":"https://api.github.com/users/parkhyukjun89/followers","following_url":"https://api.github.com/users/parkhyukjun89/following{/other_user}","gists_url":"https://api.github.com/users/parkhyukjun89/gists{/gist_id}","starred_url":"https://api.github.com/users/parkhyukjun89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parkhyukjun89/subscriptions","organizations_url":"https://api.github.com/users/parkhyukjun89/orgs","repos_url":"https://api.github.com/users/parkhyukjun89/repos","events_url":"https://api.github.com/users/parkhyukjun89/events{/privacy}","received_events_url":"https://api.github.com/users/parkhyukjun89/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/parkhyukjun89/go-github","description":"Go library for accessing the GitHub API","fork":true,"url":"https://api.github.com/repos/parkhyukjun89/go-github","forks_url":"https://api.github.com/repos/parkhyukjun89/go-github/forks","keys_url":"https://api.github.com/repos/parkhyukjun89/go-github/keys{/key_id}","collaborators_url":"https://api.github.com/repos/parkhyukjun89/go-github/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/parkhyukjun89/go-github/teams","hooks_url":"https://api.github.com/repos/parkhyukjun89/go-github/hooks","issue_events_url":"https://api.github.com/repos/parkhyukjun89/go-github/issues/events{/number}","events_url":"https://api.github.com/repos/parkhyukjun89/go-github/events","assignees_url":"https://api.github.com/repos/parkhyukjun89/go-github/assignees{/user}","branches_url":"https://api.github.com/repos/parkhyukjun89/go-github/branches{/branch}","tags_url":"https://api.github.com/repos/parkhyukjun89/go-github/tags","blobs_url":"https://api.github.com/repos/parkhyukjun89/go-github/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/parkhyukjun89/go-github/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/parkhyukjun89/go-github/git/refs{/sha}","trees_url":"https://api.github.com/repos/parkhyukjun89/go-github/git/trees{/sha}","statuses_url":"https://api.github.com/repos/parkhyukjun89/go-github/statuses/{sha}","languages_url":"https://api.github.com/repos/parkhyukjun89/go-github/languages","stargazers_url":"https://api.github.com/repos/parkhyukjun89/go-github/stargazers","contributors_url":"https://api.github.com/repos/parkhyukjun89/go-github/contributors","subscribers_url":"https://api.github.com/repos/parkhyukjun89/go-github/subscribers","subscription_url":"https://api.github.com/repos/parkhyukjun89/go-github/subscription","commits_url":"https://api.github.com/repos/parkhyukjun89/go-github/commits{/sha}","git_commits_url":"https://api.github.com/repos/parkhyukjun89/go-github/git/commits{/sha}","comments_url":"https://api.github.com/repos/parkhyukjun89/go-github/comments{/number}","issue_comment_url":"https://api.github.com/repos/parkhyukjun89/go-github/issues/comments{/number}","contents_url":"https://api.github.com/repos/parkhyukjun89/go-github/contents/{+path}","compare_url":"https://api.github.com/repos/parkhyukjun89/go-github/compare/{base}...{head}","merges_url":"https://api.github.com/repos/parkhyukjun89/go-github/merges","archive_url":"https://api.github.com/repos/parkhyukjun89/go-github/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/parkhyukjun89/go-github/downloads","issues_url":"https://api.github.com/repos/parkhyukjun89/go-github/issues{/number}","pulls_url":"https://api.github.com/repos/parkhyukjun89/go-github/pulls{/number}","milestones_url":"https://api.github.com/repos/parkhyukjun89/go-github/milestones{/number}","notifications_url":"https://api.github.com/repos/parkhyukjun89/go-github/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/parkhyukjun89/go-github/labels{/name}","releases_url":"https://api.github.com/repos/parkhyukjun89/go-github/releases{/id}","deployments_url":"https://api.github.com/repos/parkhyukjun89/go-github/deployments","created_at":"2018-02-03T02:42:54Z","updated_at":"2018-02-03T02:42:56Z","pushed_at":"2018-04-15T17:42:02Z","git_url":"git://github.com/parkhyukjun89/go-github.git","ssh_url":"git@github.com:parkhyukjun89/go-github.git","clone_url":"https://github.com/parkhyukjun89/go-github.git","svn_url":"https://github.com/parkhyukjun89/go-github","homepage":"http://godoc.org/github.com/google/go-github/github","size":1852,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"88eb4e9dc91cb2db1bbc56c936f1ee39bbe72ba5","user":{"login":"google","id":1342004,"avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":10270722,"name":"go-github","full_name":"google/go-github","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/go-github","description":"Go library for accessing the GitHub API","fork":false,"url":"https://api.github.com/repos/google/go-github","forks_url":"https://api.github.com/repos/google/go-github/forks","keys_url":"https://api.github.com/repos/google/go-github/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/go-github/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/go-github/teams","hooks_url":"https://api.github.com/repos/google/go-github/hooks","issue_events_url":"https://api.github.com/repos/google/go-github/issues/events{/number}","events_url":"https://api.github.com/repos/google/go-github/events","assignees_url":"https://api.github.com/repos/google/go-github/assignees{/user}","branches_url":"https://api.github.com/repos/google/go-github/branches{/branch}","tags_url":"https://api.github.com/repos/google/go-github/tags","blobs_url":"https://api.github.com/repos/google/go-github/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/go-github/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/go-github/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/go-github/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/go-github/statuses/{sha}","languages_url":"https://api.github.com/repos/google/go-github/languages","stargazers_url":"https://api.github.com/repos/google/go-github/stargazers","contributors_url":"https://api.github.com/repos/google/go-github/contributors","subscribers_url":"https://api.github.com/repos/google/go-github/subscribers","subscription_url":"https://api.github.com/repos/google/go-github/subscription","commits_url":"https://api.github.com/repos/google/go-github/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/go-github/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/go-github/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/go-github/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/go-github/contents/{+path}","compare_url":"https://api.github.com/repos/google/go-github/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/go-github/merges","archive_url":"https://api.github.com/repos/google/go-github/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/go-github/downloads","issues_url":"https://api.github.com/repos/google/go-github/issues{/number}","pulls_url":"https://api.github.com/repos/google/go-github/pulls{/number}","milestones_url":"https://api.github.com/repos/google/go-github/milestones{/number}","notifications_url":"https://api.github.com/repos/google/go-github/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/go-github/labels{/name}","releases_url":"https://api.github.com/repos/google/go-github/releases{/id}","deployments_url":"https://api.github.com/repos/google/go-github/deployments","created_at":"2013-05-24T16:42:58Z","updated_at":"2018-04-15T05:19:30Z","pushed_at":"2018-04-15T17:42:05Z","git_url":"git://github.com/google/go-github.git","ssh_url":"git@github.com:google/go-github.git","clone_url":"https://github.com/google/go-github.git","svn_url":"https://github.com/google/go-github","homepage":"http://godoc.org/github.com/google/go-github/github","size":1827,"stargazers_count":3467,"watchers_count":3467,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":820,"mirror_url":null,"archived":false,"open_issues_count":64,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause"},"forks":820,"open_issues":64,"watchers":3467,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/go-github/pulls/889"},"html":{"href":"https://github.com/google/go-github/pull/889"},"issue":{"href":"https://api.github.com/repos/google/go-github/issues/889"},"comments":{"href":"https://api.github.com/repos/google/go-github/issues/889/comments"},"review_comments":{"href":"https://api.github.com/repos/google/go-github/pulls/889/comments"},"review_comment":{"href":"https://api.github.com/repos/google/go-github/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/go-github/pulls/889/commits"},"statuses":{"href":"https://api.github.com/repos/google/go-github/statuses/d6eb23b56545f2220082fcdab4f31778630d9f79"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"parkhyukjun89"}}