Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make client code simpler to use #380

Open
feinstein opened this issue Jan 14, 2025 · 1 comment
Open

Make client code simpler to use #380

feinstein opened this issue Jan 14, 2025 · 1 comment

Comments

@feinstein
Copy link

feinstein commented Jan 14, 2025

I have the following query:

query GetQuotesDates($daysToReturn: Int!) {
    getQuoteDates(daysToReturn: $daysToReturn) {
        value,
    }
}

Which I am using as:

final result = await graphqlClient.queryGetQuotesDates(
  OptionsQueryGetQuotesDates(
    variables: VariablesQueryGetQuotesDates(
      daysToReturn: daysToReturn,
    ),
  ),
);

I understand that OptionsQueryGetQuotesDates has many optional items to configure the query, but I feel that it would be a lot better if the generated code allowed me to do this instead:

final result = await graphqlClient.queryGetQuotesDates(daysToReturn: daysToReturn);

Thus, all the fields inside OptionsQueryGetQuotesDates would be generated inside queryGetQuotesDates as optional named parameters instead, collapsing queryGetQuotesDates, OptionsQueryGetQuotesDates, and VariablesQueryGetQuotesDates as one inside queryGetQuotesDates.

This approach seems more aligned with the purpose of the package, which is to avoid us from writing boilerplate code.

Copy link

👋 @feinstein
Thank you for raising an issue. I will investigate the issue and get back to you as soon as possible.
Please make sure you have provided enough context.

This library is created and maintained by me, @budde377. Please consider supporting my work and ensure our survival by donating here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant