Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save justinmakaila/788d273d8248a6e4ade10413df9c0b64 to your computer and use it in GitHub Desktop.
Save justinmakaila/788d273d8248a6e4ade10413df9c0b64 to your computer and use it in GitHub Desktop.
import GraphQL
import JSONMapping
/// Provides a GraphQL update mutation and variables
protocol UpdateRequestProvider {
var updateMutation: GraphQL.Mutation { get }
var updateVariables: JSONObject { get }
}
/// Provides a GraphQL create mutation and variables
protocol CreateRequestProvider {
var createMutation: GraphQL.Mutation { get }
var createVariables: JSONObject { get }
}
/// Provides a GraphQL archive mutation and variables
protocol ArchiveRequestProvider {
var archiveMutation: GraphQL.Mutation { get }
var archiveVariables: JSONObject { get }
}
/// Provides a GraphQL refresh query and variables
protocol ElementRefreshRequestProvider {
var refreshQuery: GraphQL.Query { get }
var refreshVariables: JSONObject { get }
}
extension ElementRefreshRequestProvider {
var refreshVariables: JSONObject { return [:] }
}
/// Provides a GraphQL refresh query and variables for a collection.
protocol CollectionRefreshRequestProvider {
static var refreshQuery: GraphQL.Query { get }
static var refreshVariables: JSONObject { get }
}
extension CollectionRefreshRequestProvider {
static var refreshVariables: JSONObject { return [:] }
}
protocol WellthCollectionRefreshRequestProvider {
static var refreshVariables: JSONObject { get }
static func query(entityDescription: NSEntityDescription) -> GraphQL.Query
}
protocol IncrementalRefreshProvider {
static var incrementalRefreshVariables: JSONObject { get }
static func incrementalRefreshQuery(entityDescription: NSEntityDescription) -> GraphQL.Query
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment