Skip to content

Commit

Permalink
ghub-fetch-repository: Also fetch discussions
Browse files Browse the repository at this point in the history
Also add `ghub-fetch-discussion' to fetch an individual discussion.
  • Loading branch information
tarsius committed Sep 1, 2024
1 parent 26853ba commit 4dfa00c
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions lisp/ghub-graphql.el
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ behave as for `ghub-request' (which see)."
isLocked
isMirror
isPrivate
hasDiscussionsEnabled
hasIssuesEnabled
hasWikiEnabled
(licenseInfo name)
Expand All @@ -123,6 +124,38 @@ behave as for `ghub-request' (which see)."
id
login
name)
(discussions [(:edges t)
(:singular discussion number)
(orderBy ((field UPDATED_AT) (direction DESC)))]
id
databaseId
number
url
stateReason
(answer id)
(author login)
title
createdAt
updatedAt
closedAt
locked
body
(comments [(:edges t)]
id
databaseId
(author login)
createdAt
updatedAt
body
(replies [(:edges 20)]
id
databaseId
(author login)
createdAt
updatedAt
body))
(labels [(:edges t)]
id))
(issues [(:edges t)
(:singular issue number)
(orderBy ((field UPDATED_AT) (direction DESC)))]
Expand Down Expand Up @@ -285,6 +318,27 @@ data as the only argument."
:paginate paginate
:errorback errorback))

(cl-defun ghub-fetch-discussion ( owner name number callback
&optional until
&key username auth host forge
headers errorback)
"Asynchronously fetch forge data about the specified discussion.
Once all data has been collected, CALLBACK is called with the
data as the only argument."
(ghub--graphql-vacuum (ghub--graphql-prepare-query
ghub-fetch-repository
`(repository discussions (discussion . ,number)))
`((owner . ,owner)
(name . ,name))
callback until
:narrow '(repository discussion)
:username username
:auth auth
:host host
:forge forge
:headers headers
:errorback errorback))

(cl-defun ghub-fetch-issue ( owner name number callback
&optional until
&key username auth host forge
Expand Down

0 comments on commit 4dfa00c

Please sign in to comment.