@@ -37,15 +37,6 @@ type Issue struct {
3737 // TODO(willnorris): labels and milestone
3838}
3939
40- // IssueComment represents a comment left on an issue.
41- type IssueComment struct {
42- ID int `json:"id,omitempty"`
43- Body string `json:"body,omitempty"`
44- User * User `json:"user,omitempty"`
45- CreatedAt * time.Time `json:"created_at,omitempty"`
46- UpdatedAt * time.Time `json:"updated_at,omitempty"`
47- }
48-
4940// IssueListOptions specifies the optional parameters to the IssuesService.List
5041// and IssuesService.ListByOrg methods.
5142type IssueListOptions struct {
@@ -237,132 +228,3 @@ func (s *IssuesService) Edit(owner string, repo string, number int, issue *Issue
237228 _ , err = s .client .Do (req , i )
238229 return i , err
239230}
240-
241- // ListAssignees fetches all available assignees (owners and collaborators) to
242- // which issues may be assigned.
243- //
244- // GitHub API docs: http://developer.github.com/v3/issues/assignees/#list-assignees
245- func (s * IssuesService ) ListAssignees (owner string , repo string ) ([]User , error ) {
246- u := fmt .Sprintf ("repos/%v/%v/assignees" , owner , repo )
247- req , err := s .client .NewRequest ("GET" , u , nil )
248- if err != nil {
249- return nil , err
250- }
251- assignees := new ([]User )
252- _ , err = s .client .Do (req , assignees )
253- return * assignees , err
254- }
255-
256- // CheckAssignee checks if a user is an assignee for the specified repository.
257- //
258- // GitHub API docs: http://developer.github.com/v3/issues/assignees/#check-assignee
259- func (s * IssuesService ) CheckAssignee (owner string , repo string , user string ) (bool , error ) {
260- u := fmt .Sprintf ("repos/%v/%v/assignees/%v" , owner , repo , user )
261- req , err := s .client .NewRequest ("GET" , u , nil )
262- if err != nil {
263- return false , err
264- }
265- _ , err = s .client .Do (req , nil )
266- return parseBoolResponse (err )
267- }
268-
269- // IssueListCommentsOptions specifies the optional parameters to the
270- // IssuesService.ListComments method.
271- type IssueListCommentsOptions struct {
272- // Sort specifies how to sort comments. Possible values are: created, updated.
273- Sort string
274-
275- // Direction in which to sort comments. Possible values are: asc, desc.
276- Direction string
277-
278- // Since filters comments by time.
279- Since time.Time
280- }
281-
282- // ListComments lists all comments on the specified issue. Specifying an issue
283- // number of 0 will return all comments on all issues for the repository.
284- //
285- // GitHub API docs: http://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
286- func (s * IssuesService ) ListComments (owner string , repo string , number int , opt * IssueListCommentsOptions ) ([]IssueComment , error ) {
287- var u string
288- if number == 0 {
289- u = fmt .Sprintf ("repos/%v/%v/issues/comments" , owner , repo )
290- } else {
291- u = fmt .Sprintf ("repos/%v/%v/issues/%d/comments" , owner , repo , number )
292- }
293-
294- if opt != nil {
295- params := url.Values {
296- "sort" : {opt .Sort },
297- "direction" : {opt .Direction },
298- }
299- if ! opt .Since .IsZero () {
300- params .Add ("since" , opt .Since .Format (time .RFC3339 ))
301- }
302- u += "?" + params .Encode ()
303- }
304-
305- req , err := s .client .NewRequest ("GET" , u , nil )
306- if err != nil {
307- return nil , err
308- }
309- comments := new ([]IssueComment )
310- _ , err = s .client .Do (req , comments )
311- return * comments , err
312- }
313-
314- // GetComment fetches the specified issue comment.
315- //
316- // GitHub API docs: http://developer.github.com/v3/issues/comments/#get-a-single-comment
317- func (s * IssuesService ) GetComment (owner string , repo string , id int ) (* IssueComment , error ) {
318- u := fmt .Sprintf ("repos/%v/%v/issues/comments/%d" , owner , repo , id )
319-
320- req , err := s .client .NewRequest ("GET" , u , nil )
321- if err != nil {
322- return nil , err
323- }
324- comment := new (IssueComment )
325- _ , err = s .client .Do (req , comment )
326- return comment , err
327- }
328-
329- // CreateComment creates a new comment on the specified issue.
330- //
331- // GitHub API docs: http://developer.github.com/v3/issues/comments/#create-a-comment
332- func (s * IssuesService ) CreateComment (owner string , repo string , number int , comment * IssueComment ) (* IssueComment , error ) {
333- u := fmt .Sprintf ("repos/%v/%v/issues/%d/comments" , owner , repo , number )
334- req , err := s .client .NewRequest ("POST" , u , comment )
335- if err != nil {
336- return nil , err
337- }
338- c := new (IssueComment )
339- _ , err = s .client .Do (req , c )
340- return c , err
341- }
342-
343- // EditComment updates an issue comment.
344- //
345- // GitHub API docs: http://developer.github.com/v3/issues/comments/#edit-a-comment
346- func (s * IssuesService ) EditComment (owner string , repo string , id int , comment * IssueComment ) (* IssueComment , error ) {
347- u := fmt .Sprintf ("repos/%v/%v/issues/comments/%d" , owner , repo , id )
348- req , err := s .client .NewRequest ("PATCH" , u , comment )
349- if err != nil {
350- return nil , err
351- }
352- c := new (IssueComment )
353- _ , err = s .client .Do (req , c )
354- return c , err
355- }
356-
357- // DeleteComment deletes an issue comment.
358- //
359- // GitHub API docs: http://developer.github.com/v3/issues/comments/#delete-a-comment
360- func (s * IssuesService ) DeleteComment (owner string , repo string , id int ) error {
361- u := fmt .Sprintf ("repos/%v/%v/issues/comments/%d" , owner , repo , id )
362- req , err := s .client .NewRequest ("DELETE" , u , nil )
363- if err != nil {
364- return err
365- }
366- _ , err = s .client .Do (req , nil )
367- return err
368- }
0 commit comments