Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GraphQL schema to use flags for PPO items #2125

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 74 additions & 7 deletions KsApi/GraphAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14947,7 +14947,12 @@ public enum GraphAPI {
...PPOBackingFragment
}
tierType
tags
flags {
__typename
icon
message
type
}
}
"""

Expand All @@ -14958,7 +14963,7 @@ public enum GraphAPI {
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("backing", type: .object(Backing.selections)),
GraphQLField("tierType", type: .scalar(String.self)),
GraphQLField("tags", type: .list(.nonNull(.scalar(String.self)))),
GraphQLField("flags", type: .list(.nonNull(.object(Flag.selections)))),
]
}

Expand All @@ -14968,8 +14973,8 @@ public enum GraphAPI {
self.resultMap = unsafeResultMap
}

public init(backing: Backing? = nil, tierType: String? = nil, tags: [String]? = nil) {
self.init(unsafeResultMap: ["__typename": "PledgeProjectOverviewItem", "backing": backing.flatMap { (value: Backing) -> ResultMap in value.resultMap }, "tierType": tierType, "tags": tags])
public init(backing: Backing? = nil, tierType: String? = nil, flags: [Flag]? = nil) {
self.init(unsafeResultMap: ["__typename": "PledgeProjectOverviewItem", "backing": backing.flatMap { (value: Backing) -> ResultMap in value.resultMap }, "tierType": tierType, "flags": flags.flatMap { (value: [Flag]) -> [ResultMap] in value.map { (value: Flag) -> ResultMap in value.resultMap } }])
}

public var __typename: String {
Expand Down Expand Up @@ -15002,12 +15007,12 @@ public enum GraphAPI {
}

/// tags
public var tags: [String]? {
public var flags: [Flag]? {
get {
return resultMap["tags"] as? [String]
return (resultMap["flags"] as? [ResultMap]).flatMap { (value: [ResultMap]) -> [Flag] in value.map { (value: ResultMap) -> Flag in Flag(unsafeResultMap: value) } }
}
set {
resultMap.updateValue(newValue, forKey: "tags")
resultMap.updateValue(newValue.flatMap { (value: [Flag]) -> [ResultMap] in value.map { (value: Flag) -> ResultMap in value.resultMap } }, forKey: "flags")
}
}

Expand Down Expand Up @@ -15062,6 +15067,68 @@ public enum GraphAPI {
}
}
}

public struct Flag: GraphQLSelectionSet {
public static let possibleTypes: [String] = ["PledgedProjectsOverviewPledgeFlags"]

public static var selections: [GraphQLSelection] {
return [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("icon", type: .scalar(String.self)),
GraphQLField("message", type: .scalar(String.self)),
GraphQLField("type", type: .scalar(String.self)),
]
}

public private(set) var resultMap: ResultMap

public init(unsafeResultMap: ResultMap) {
self.resultMap = unsafeResultMap
}

public init(icon: String? = nil, message: String? = nil, type: String? = nil) {
self.init(unsafeResultMap: ["__typename": "PledgedProjectsOverviewPledgeFlags", "icon": icon, "message": message, "type": type])
}

public var __typename: String {
get {
return resultMap["__typename"]! as! String
}
set {
resultMap.updateValue(newValue, forKey: "__typename")
}
}

/// Flag icon type, e.g. time, alert, etc.
public var icon: String? {
get {
return resultMap["icon"] as? String
}
set {
resultMap.updateValue(newValue, forKey: "icon")
}
}

/// Translated flag message
public var message: String? {
get {
return resultMap["message"] as? String
}
set {
resultMap.updateValue(newValue, forKey: "message")
}
}

/// Flag type, e.g. warning, alert, etc.
public var type: String? {
get {
return resultMap["type"] as? String
}
set {
resultMap.updateValue(newValue, forKey: "type")
}
}
}
}

public struct PpoProjectFragment: GraphQLFragment {
Expand Down
6 changes: 5 additions & 1 deletion KsApi/fragments/PPOCardFragment.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ fragment PPOCardFragment on PledgeProjectOverviewItem {
...PPOBackingFragment
}
tierType
tags
flags {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inlined for now but happy to move to a fragment.

icon
message
type
}
}
Loading