@@ -1389,20 +1389,22 @@ public final class AddReactionMutation: GraphQLMutation {
13891389 }
13901390}
13911391
1392- public final class RepositoryLabelsQuery : GraphQLQuery {
1392+ public final class FetchRepositoryLabelsQuery : GraphQLQuery {
13931393 public let operationDefinition =
1394- "query RepositoryLabels ($owner: String!, $repo: String!) {\n repository(owner: $owner, name: $repo) {\n __typename\n labels(first: 100) {\n __typename\n nodes {\n __typename\n name\n color\n }\n }\n }\n}"
1394+ "query fetchRepositoryLabels ($owner: String!, $repo: String!, $after: String ) {\n repository(owner: $owner, name: $repo) {\n __typename\n labels(first: 100, after: $after ) {\n __typename\n nodes {\n __typename\n name\n color\n }\n pageInfo {\n __typename\n hasNextPage\n endCursor \n }\n }\n }\n}"
13951395
13961396 public var owner: String
13971397 public var repo: String
1398+ public var after: String?
13981399
1399- public init(owner: String, repo: String) {
1400+ public init(owner: String, repo: String, after: String? = nil ) {
14001401 self.owner = owner
14011402 self.repo = repo
1403+ self.after = after
14021404 }
14031405
14041406 public var variables: GraphQLMap? {
1405- return ["owner": owner, "repo": repo]
1407+ return ["owner": owner, "repo": repo, "after": after ]
14061408 }
14071409
14081410 public struct Data: GraphQLSelectionSet {
@@ -1437,7 +1439,7 @@ public final class RepositoryLabelsQuery: GraphQLQuery {
14371439
14381440 public static let selections: [GraphQLSelection] = [
14391441 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1440- GraphQLField("labels", arguments: ["first": 100], type: .object(Label.selections)),
1442+ GraphQLField("labels", arguments: ["first": 100, "after": GraphQLVariable("after") ], type: .object(Label.selections)),
14411443 ]
14421444
14431445 public private(set) var resultMap: ResultMap
@@ -1475,6 +1477,7 @@ public final class RepositoryLabelsQuery: GraphQLQuery {
14751477 public static let selections: [GraphQLSelection] = [
14761478 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
14771479 GraphQLField("nodes", type: .list(.object(Node.selections))),
1480+ GraphQLField("pageInfo", type: .nonNull(.object(PageInfo.selections))),
14781481 ]
14791482
14801483 public private(set) var resultMap: ResultMap
@@ -1506,6 +1509,16 @@ public final class RepositoryLabelsQuery: GraphQLQuery {
15061509 }
15071510 }
15081511
1512+ /// Information to aid in pagination.
1513+ public var pageInfo: PageInfo {
1514+ get {
1515+ return PageInfo(unsafeResultMap: resultMap["pageInfo"]! as! ResultMap)
1516+ }
1517+ set {
1518+ resultMap.updateValue(newValue.resultMap, forKey: "pageInfo")
1519+ }
1520+ }
1521+
15091522 public struct Node: GraphQLSelectionSet {
15101523 public static let possibleTypes = ["Label"]
15111524
@@ -1555,6 +1568,55 @@ public final class RepositoryLabelsQuery: GraphQLQuery {
15551568 }
15561569 }
15571570 }
1571+
1572+ public struct PageInfo: GraphQLSelectionSet {
1573+ public static let possibleTypes = ["PageInfo"]
1574+
1575+ public static let selections: [GraphQLSelection] = [
1576+ GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1577+ GraphQLField("hasNextPage", type: .nonNull(.scalar(Bool.self))),
1578+ GraphQLField("endCursor", type: .scalar(String.self)),
1579+ ]
1580+
1581+ public private(set) var resultMap: ResultMap
1582+
1583+ public init(unsafeResultMap: ResultMap) {
1584+ self.resultMap = unsafeResultMap
1585+ }
1586+
1587+ public init(hasNextPage: Bool, endCursor: String? = nil) {
1588+ self.init(unsafeResultMap: ["__typename": "PageInfo", "hasNextPage": hasNextPage, "endCursor": endCursor])
1589+ }
1590+
1591+ public var __typename: String {
1592+ get {
1593+ return resultMap["__typename"]! as! String
1594+ }
1595+ set {
1596+ resultMap.updateValue(newValue, forKey: "__typename")
1597+ }
1598+ }
1599+
1600+ /// When paginating forwards, are there more items?
1601+ public var hasNextPage: Bool {
1602+ get {
1603+ return resultMap["hasNextPage"]! as! Bool
1604+ }
1605+ set {
1606+ resultMap.updateValue(newValue, forKey: "hasNextPage")
1607+ }
1608+ }
1609+
1610+ /// When paginating forwards, the cursor to continue.
1611+ public var endCursor: String? {
1612+ get {
1613+ return resultMap["endCursor"] as? String
1614+ }
1615+ set {
1616+ resultMap.updateValue(newValue, forKey: "endCursor")
1617+ }
1618+ }
1619+ }
15581620 }
15591621 }
15601622}
0 commit comments