-
Notifications
You must be signed in to change notification settings - Fork 734
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose whether a result was served from cache or fetched from the ser…
- Loading branch information
1 parent
fe9d0ea
commit d93b763
Showing
3 changed files
with
15 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
/// Represents the result of a GraphQL operation. | ||
public struct GraphQLResult<Data> { | ||
/// Represents source of data | ||
public enum Source { | ||
case cache | ||
case server | ||
} | ||
|
||
/// The typed result data, or `nil` if an error was encountered that prevented a valid response. | ||
public let data: Data? | ||
/// A list of errors, or `nil` if the operation completed without encountering any errors. | ||
public let errors: [GraphQLError]? | ||
|
||
/// Source of data | ||
public let source:Source | ||
|
||
let dependentKeys: Set<CacheKey>? | ||
|
||
init(data: Data?, errors: [GraphQLError]?, dependentKeys: Set<CacheKey>?) { | ||
init(data: Data?, errors: [GraphQLError]?, source:Source, dependentKeys: Set<CacheKey>?) { | ||
self.data = data | ||
self.errors = errors | ||
self.dependentKeys = dependentKeys | ||
self.dependentKeys = dependentKeys | ||
self.source = source | ||
} | ||
} |