forked from apollographql/apollo-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphQLResult.swift
More file actions
31 lines (28 loc) · 1001 Bytes
/
GraphQLResult.swift
File metadata and controls
31 lines (28 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/// Represents the result of a GraphQL operation.
public struct GraphQLResult<Data> {
/// 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]?
/// A dictionary which services can use however they see fit to provide additional information to clients.
public let extensions: [String: Any]?
/// Represents source of data
public enum Source {
case cache
case server
}
/// Source of data
public let source: Source
let dependentKeys: Set<CacheKey>?
public init(data: Data?,
extensions: [String: Any]?,
errors: [GraphQLError]?,
source: Source,
dependentKeys: Set<CacheKey>?) {
self.data = data
self.extensions = extensions
self.errors = errors
self.source = source
self.dependentKeys = dependentKeys
}
}