Skip to content

Make client code simpler to use #380

@feinstein

Description

@feinstein

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions