Skip to content
Closed
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
2 changes: 2 additions & 0 deletions Sources/Apollo/Bundle+Helpers.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !os(Linux)
import Foundation

extension Bundle {
Expand Down Expand Up @@ -25,3 +26,4 @@ extension Bundle {
return self.bundleValue(forKey: "CFBundleShortVersionString")
}
}
#endif // !os(Linux)
3 changes: 3 additions & 0 deletions Sources/Apollo/Cancellable.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

/// An object that can be used to cancel an in progress action.
public protocol Cancellable: AnyObject {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Apollo/HTTPRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import Foundation
#if !COCOAPODS
import ApolloAPI
#endif
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

/// Encapsulation of all information about a request before it hits the network
open class HTTPRequest<Operation: GraphQLOperation>: Hashable {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Apollo/HTTPResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import Foundation
#if !COCOAPODS
import ApolloAPI
#endif
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

/// Data about a response received by an HTTP request.
public class HTTPResponse<Operation: GraphQLOperation> {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Apollo/HTTPURLResponse+Helpers.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

// MARK: Status extensions
extension HTTPURLResponse {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Apollo/JSONRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import Foundation
#if !COCOAPODS
import ApolloAPI
#endif
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

/// A request which sends JSON related to a GraphQL operation.
open class JSONRequest<Operation: GraphQLOperation>: HTTPRequest<Operation> {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Apollo/NetworkFetchInterceptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import Foundation
#if !COCOAPODS
import ApolloAPI
#endif
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

/// An interceptor which actually fetches data from the network.
public class NetworkFetchInterceptor: ApolloInterceptor, Cancellable {
Expand Down
5 changes: 5 additions & 0 deletions Sources/Apollo/NetworkTransport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import Foundation
#if !COCOAPODS
import ApolloAPI
#endif
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

/// A network transport is responsible for sending GraphQL operations to a server.
public protocol NetworkTransport: AnyObject {
Expand Down Expand Up @@ -60,6 +63,7 @@ public extension NetworkTransport {
/// The default client version to use when setting up the `clientVersion` property.
static var defaultClientVersion: String {
var version = String()
#if !os(Linux)
if let shortVersion = Bundle.main.shortVersion {
version.append(shortVersion)
}
Expand All @@ -71,6 +75,7 @@ public extension NetworkTransport {
version.append("-\(buildNumber)")
}
}
#endif // !os(Linux)

if version.isEmpty {
version = "(unknown)"
Expand Down
3 changes: 3 additions & 0 deletions Sources/Apollo/ResponseCodeInterceptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import Foundation
#if !COCOAPODS
import ApolloAPI
#endif
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

/// An interceptor to check the response code returned with a request.
public struct ResponseCodeInterceptor: ApolloInterceptor {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Apollo/TaskData.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

/// A wrapper for data about a particular task handled by `URLSessionClient`
public class TaskData {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Apollo/URLSessionClient.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

/// A class to handle URL Session calls that will support background execution,
/// but still (mostly) use callbacks for its primary method of communication.
Expand Down
3 changes: 3 additions & 0 deletions Sources/Apollo/UploadRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import Foundation
#if !COCOAPODS
import ApolloAPI
#endif
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

/// A request class allowing for a multipart-upload request.
open class UploadRequest<Operation: GraphQLOperation>: HTTPRequest<Operation> {
Expand Down