Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Queryables.swift
- // DataSiteOne
- //
- // Created by Bollbach, Alexander on 7/26/18.
- // Copyright © 2018 Merrill Corporation. All rights reserved.
- //
- import Foundation
- extension Query: GQLRequest {
- var hashValue: Int { return description.hashValue }
- var description: String {
- switch self {
- case .mutation(let mutations): return "mutation { \(join(mutations)) }"
- case .getCurrentUser(let fields): return "query { getCurrentUser { \(join(fields)) } }"
- case .grid(let projectId,
- let parentId,
- let fields): return "query { getGridLevel(projectId: \"\(projectId)\", parentId: \"\(parentId)\") { \(join(fields)) } }"
- }
- }
- }
- extension Query.JWT: GQLRequest {
- var hashValue: Int { return description.hashValue }
- var description: String {
- return "jwt"
- }
- }
- extension Query.Mutation: GQLRequest {
- var hashValue: Int { return description.hashValue }
- var description: String {
- switch self {
- case .userGatewayJwt(let email,
- let password,
- let jwt): return "userGatewayJwt(email: \"\(email)\", password: \"\(password)\") { \(join(jwt)) }"
- }
- }
- }
- extension Query.User: GQLRequest {
- var hashValue: Int { return description.hashValue }
- var description: String {
- switch self {
- case .projects(let fields): return "projects { \(join(fields)) }"
- }
- }
- }
- extension Query.Project: GQLRequest {
- var hashValue: Int { return description.hashValue }
- var description: String {
- switch self {
- case .projectId: return "projectId"
- case .name: return "name"
- }
- }
- }
- extension Query.Grid: GQLRequest {
- var hashValue: Int { return description.hashValue }
- var description: String {
- switch self {
- case let .children(fields): return "children { \(join(fields)) }"
- case let .breadcrumbs(fields): return "breadcrumbs { \(join(fields)) }"
- }
- }
- }
- extension Query.Grid.Breadcrumb: GQLRequest {
- var hashValue: Int { return description.hashValue }
- var description: String {
- switch self {
- case .id: return "id"
- case .name: return "name"
- case .type: return "type"
- }
- }
- }
- extension Query.Grid.Node: GQLRequest {
- var hashValue: Int { return description.hashValue }
- var description: String {
- switch self {
- case .id: return "id"
- case .name: return "name"
- case .displayIndex: return "displayIndex"
- case .type: return "type"
- case .createdDate: return "createDate"
- }
- }
- }
Add Comment
Please, Sign In to add comment