Giter Site home page Giter Site logo

Comments (12)

micimize avatar micimize commented on July 21, 2024 1

from gql.

micimize avatar micimize commented on July 21, 2024 1

@Ram231 it isn't a WIP exactly, but at the least porting the existing graphql implementation will be necessary for graphql/client.dart v4, which I'm actively working on.

@klavs do you think it's possible to decouple HttpLink and FileUpload link, or will we have to just have two different links?

Also, should I go ahead and PR my NetworkException code into gql_http_link's exceptions / exception handling?

from gql.

DoctorJohn avatar DoctorJohn commented on July 21, 2024

I wrote an auth link that works with the gql http link. It's similar to the one in the graphql_flutter package has. I may contribute mine, but where to put it? It's just 21 lines...

from gql.

klavs avatar klavs commented on July 21, 2024

Hey @DoctorJohn, welcome!

A new link should go to a new package at the root of this directory.

To kickstart your PR you can start by adding it to the example directory of gql_httpl_link so that we can discuss the design.

from gql.

smkhalsa avatar smkhalsa commented on July 21, 2024

Here's the basic implementation of an ErrorLink that I'm using in case it's helpful:

import 'dart:async';
import 'package:ferry/ferry.dart';
import 'package:gql_link/gql_link.dart';
import 'package:gql_exec/gql_exec.dart';

typedef void OnError({
  LinkException linkException,
  List<GraphQLError> graphQLErrors,
});

class ErrorLink extends Link {
  final OnError onError;

  ErrorLink(this.onError);

  @override
  Stream<Response> request(Request request, [forward]) =>
      forward(request).transform(
        StreamTransformer.fromHandlers(
          handleError: (error, stacktrace, sink) {
            if (error is LinkException) {
              onError(linkException: error);
            }
            sink.addError(error);
          },
          handleData: (data, sink) {
            if (data.errors != null && data.errors.isNotEmpty) {
              onError(graphQLErrors: data.errors);
            }
            sink.add(data);
          },
        ),
      );
}

from gql.

klavs avatar klavs commented on July 21, 2024

I think useGETForQueries wasn't doing anything. Am I wrong?

from gql.

micimize avatar micimize commented on July 21, 2024

yeah I mean it tells the link to use GET for queries

if (operation.isQuery && config.http.useGETForQueries) {
  config.options['method'] = 'GET';
}

from gql.

vinceramcesoliveros avatar vinceramcesoliveros commented on July 21, 2024

Is the File Upload Work in Progress? This was my first time using graphql for vue(web) and flutter(mobile). How is it going to be implemented in a way that can be used via http package?

from gql.

vinceramcesoliveros avatar vinceramcesoliveros commented on July 21, 2024

I'd like to propose that single file and multipart upload in a separate way that there are no type checking and it should be strongly typed. Thanks for the hard work. I hope it'll get to be flutter favorites.

from gql.

klavs avatar klavs commented on July 21, 2024

How is it going to be implemented in a way that can be used via http package?

Well that is THE question. From GraphQL's perspective a file can be a scalar type. But it should be a well-known scalar type, in the sense that links must know about it to support it.

do you think it's possible to decouple HttpLink and FileUpload link, or will we have to just have two different links?

Probably we'll end up implementing file upload within HttpLink.

Also, should I go ahead and PR my NetworkException code into gql_http_link's exceptions / exception handling?

Your NetworkException is a specialized version of the ServerException. (My appologies for the bad documentation comment.) In a more abstract sense, there is no network, there's only server you are trying to communicate to. This generalization will make more sense when we have a client-side resolver (client-side server) support.

from gql.

micimize avatar micimize commented on July 21, 2024

@klavs ServerException has a @required Response parsedResponse, which doesn't make sense when the error involves a failure on the network itself. NetworkException would be part of gql_http_link regardless.
Maybe the taxonomy should be

TerminatingLinkException
 ├── ServerException
 └── NetworkException /// in `gql_http_link`

from gql.

micimize avatar micimize commented on July 21, 2024

@klavs Everything but persisted queries has been merged, and I think it's fine if APQ lives in graphql flutter or 3rd party module for now.

So, I'd say once gql_http_link: 0.3.0 is published (and maybe other recent changes) we can close this?

from gql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.