Tommy/expand-list-discussions-tool #690
Draft
+199
−86
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #670
Overview
This PR adds
updatedAt
andauthor.login
(i.e. username) fields to the discussions payload in thelist_discussions
toolupdated_at
andcreated_at
) and direction (ascending order, descending order)Refactoring
The PR includes refactoring of the
list_discussions
tool to handle optional parameters in our graphql queries. This was needed because the githubv4 library requires GraphQL queries to be defined using Go struct tags that must be known at compile time, so we could not dynamically construct query strings at runtime based on user input.The changes made include
DiscussionFragment
struct to avoid field duplicationdiscussionQueries
struct with 4 pre-defined query variants:BasicNoOrder
: No optional parameters (uses GitHub API's defaults)BasicWithOrder
: Only ordering parametersWithCategoryNoOrder
: Only category filteringWithCategoryAndOrder
: Both category and ordering