shurcooL / githubv4

Package githubv4 is a client library for accessing GitHub GraphQL API v4 (https://docs.github.com/en/graphql).
MIT License
1.12k stars 90 forks source link

Add input parameter to Client.Mutate method. #3

Closed dmitshur closed 7 years ago

dmitshur commented 7 years ago

This is a breaking API change.

Every mutation has some input fields, so they'll require a corresponding input object. Make it more convenient to pass the input, especially when there are no other variables that are needed.

This change is strictly for convenience, because it seems like it leads to a cleaner API. Time and usage will tell whether this is a good change or if it's unhelpful and should be reverted.

Resolves the following THINK comment:

// THINK: Consider having Mutate accept input separate from variables (since they're often left nil). For convenience.

I've labeled this PR with an API decision label. I plan to keep doing that for future API choices and decisions that come up, so they can be tracked, and we'll have a centralized place to discuss the tradeoffs of each decision.