gql-dart / ferry

Stream-based strongly typed GraphQL client for Dart
https://ferrygraphql.com/
MIT License
593 stars 113 forks source link

feat(ferry_exec): Pass context to GQL Links #576

Closed tpucci closed 5 months ago

tpucci commented 5 months ago

Generated code was updated with "void" statements. I am not sure why

Feature request: #575

In order to create advanced Links that can execute custom logic per request, we need a way to extend request with ContextEntries.

Currently, generated code for a request is:

  @override
  Request get execRequest => Request(
    operation: operation,
    variables: vars.toJson(),
    // no passed context. Thus, the default is `context = const Context()`
  );

gql_exec has a method .withContextEntry on Operation that we could use.

I'd be happy to contribute if you think it is a good issue 🙂

(😅 Hope I did not miss something in the API that already allows us to create context entries) Reference: #556

netlify[bot] commented 5 months ago

Deploy Preview for verdant-brigadeiros-5171fa canceled.

Name Link
Latest commit 04ddd30635b6d74c2cc322e696038618b53c26c0
Latest deploy log https://app.netlify.com/sites/verdant-brigadeiros-5171fa/deploys/65be35bd023cc30009b948d9
tpucci commented 5 months ago

I'd be happy to fix verify_commits but I did not understand why it failed

knaeckeKami commented 5 months ago

It was the name of the PR. edited it for you and reran the action :)

(this is so CHANGELOGs can be created automatically with melos)

knaeckeKami commented 5 months ago

LGTM!