Apollo-ios: Make GraphQLResult initialisers public

Created on 15 Jan 2019  路  10Comments  路  Source: apollographql/apollo-ios

Currently there's no way of creating a GraphQLResult due to every initialiser being internal.

GraphQLResult<Query.Data>(
            data: data,
            errors: nil,
            source: .cache,
            dependentKeys: nil
        )

Fails with message _Cannot convert value of type 'Query.Data?' to expected argument type '_?'_

and

try GraphQLResponse(operation: query, body: json).parseResult()

Fails due to parseResult() being internal

Reading the threads it's clear to me that at least one of those methods was public before.
What should be the proper way to initialise a custom GraphQLResult?

Most helpful comment

+1

All 10 comments

+1

Can you explain what your use case for this is? GraphQLResult wasn't meant to be directly instantiated, so there might be a better way of accomplishing what you intend to do.

I want to mock the return value of the resultHandler: OperationResultHandler<Query>?

+1

Having an initialiser I can create my own responses in a middleware, as, for example, return a valid manually cached result when offline.

+1

+1

+1

+1

This was released with 0.11.1!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hiteshborse12 picture hiteshborse12  路  4Comments

marcoreni picture marcoreni  路  3Comments

maxsz picture maxsz  路  4Comments

vishal-p picture vishal-p  路  4Comments

sfla picture sfla  路  3Comments