diff --git a/Sources/Graphiti/Argument/NoArguments.swift b/Sources/Graphiti/Argument/NoArguments.swift index 4720d385..fa677dd7 100644 --- a/Sources/Graphiti/Argument/NoArguments.swift +++ b/Sources/Graphiti/Argument/NoArguments.swift @@ -1,3 +1,3 @@ public struct NoArguments: Decodable { - init() {} + public init() {} } diff --git a/Sources/Graphiti/Connection/PageInfo.swift b/Sources/Graphiti/Connection/PageInfo.swift index c0665a93..72b2bf40 100644 --- a/Sources/Graphiti/Connection/PageInfo.swift +++ b/Sources/Graphiti/Connection/PageInfo.swift @@ -3,4 +3,16 @@ public struct PageInfo: Codable { public let hasNextPage: Bool public let startCursor: String? public let endCursor: String? + + public init( + hasPreviousPage: Bool, + hasNextPage: Bool, + startCursor: String? = nil, + endCursor: String? = nil + ) { + self.hasPreviousPage = hasPreviousPage + self.hasNextPage = hasNextPage + self.startCursor = startCursor + self.endCursor = endCursor + } } diff --git a/Tests/GraphitiTests/ConnectionTests.swift b/Tests/GraphitiTests/ConnectionTests.swift index 461950cf..51ee4ca5 100644 --- a/Tests/GraphitiTests/ConnectionTests.swift +++ b/Tests/GraphitiTests/ConnectionTests.swift @@ -22,25 +22,23 @@ class ConnectionTests: XCTestCase { } } - let schema = { - try! Schema { - Type(Comment.self) { - Field("id", at: \.id) - Field("message", at: \.message) - } + let schema = try! Schema { + Type(Comment.self) { + Field("id", at: \.id) + Field("message", at: \.message) + } - ConnectionType(Comment.self) + ConnectionType(Comment.self) - Query { - Field("comments", at: ConnectionTypeResolver.comments) { - Argument("first", at: \.first) - Argument("last", at: \.last) - Argument("after", at: \.after) - Argument("before", at: \.before) - } + Query { + Field("comments", at: ConnectionTypeResolver.comments) { + Argument("first", at: \.first) + Argument("last", at: \.last) + Argument("after", at: \.after) + Argument("before", at: \.before) } } - }() + } let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)