-
Notifications
You must be signed in to change notification settings - Fork 0
Update to Apollo 2.0.4 #10
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
Open
ssestak
wants to merge
4
commits into
main
Choose a base branch
from
feature/Update-to-Apollo-2.0.4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5eb6c61
feat!: migrate to Apollo iOS 2.0.4 with async/await API
27cc4cc
refactor(GraphQLAPIKit): centralize configuration for adapter and req…
e1d94a9
docs(readme): Update Apollo iOS version and API usage example
451537d
chore: Update apollo-ios-cli and correct README
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
38 changes: 38 additions & 0 deletions
38
Sources/GraphQLAPIKit/Configuration/GraphQLAPIConfiguration.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import Foundation | ||
|
|
||
| /// Configuration for initializing a GraphQL API adapter. | ||
| /// | ||
| /// Use this struct to configure the GraphQL client with endpoint URL, | ||
| /// session configuration, default headers, and network observers. | ||
| public struct GraphQLAPIConfiguration: Sendable { | ||
| /// The GraphQL endpoint URL. | ||
| public let url: URL | ||
|
|
||
| /// URL session configuration. Defaults to `.default`. | ||
| public let urlSessionConfiguration: URLSessionConfiguration | ||
|
|
||
| /// Headers to include in every request. | ||
| public let defaultHeaders: [String: String] | ||
|
|
||
| /// Network observers for monitoring requests (logging, analytics, etc.). | ||
| public let networkObservers: [any GraphQLNetworkObserver] | ||
|
|
||
| /// Creates a new GraphQL API configuration. | ||
| /// | ||
| /// - Parameters: | ||
| /// - url: The GraphQL endpoint URL. | ||
| /// - urlSessionConfiguration: URL session configuration. Defaults to `.default`. | ||
| /// - defaultHeaders: Headers to include in every request. Defaults to empty. | ||
| /// - networkObservers: Network observers for monitoring requests. Defaults to empty. | ||
| public init( | ||
| url: URL, | ||
| urlSessionConfiguration: URLSessionConfiguration = .default, | ||
| defaultHeaders: [String: String] = [:], | ||
| networkObservers: [any GraphQLNetworkObserver] = [] | ||
| ) { | ||
| self.url = url | ||
| self.urlSessionConfiguration = urlSessionConfiguration | ||
| self.defaultHeaders = defaultHeaders | ||
| self.networkObservers = networkObservers | ||
| } | ||
| } | ||
24 changes: 24 additions & 0 deletions
24
Sources/GraphQLAPIKit/Configuration/GraphQLRequestConfiguration.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import Foundation | ||
|
|
||
| /// Base protocol for GraphQL operation configurations. | ||
| /// | ||
| /// Defines common options shared across all GraphQL operations (queries, mutations, subscriptions). | ||
| public protocol GraphQLOperationConfiguration: Sendable { | ||
| /// Additional headers to add to the request. | ||
| var headers: RequestHeaders? { get } | ||
| } | ||
|
|
||
| /// Configuration for GraphQL queries and mutations. | ||
| /// | ||
| /// Use this struct to customize request-specific options like additional headers. | ||
| public struct GraphQLRequestConfiguration: GraphQLOperationConfiguration { | ||
| /// Additional headers to add to the request. | ||
| public let headers: RequestHeaders? | ||
|
|
||
| /// Creates a new request configuration. | ||
| /// | ||
| /// - Parameter headers: Additional headers to add to the request. Defaults to `nil`. | ||
| public init(headers: RequestHeaders? = nil) { | ||
| self.headers = headers | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import Apollo | ||
|
|
||
| struct ApolloError: Error { | ||
| struct ApolloError: Error, Sendable { | ||
| let errors: [Apollo.GraphQLError] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 0 additions & 68 deletions
68
Sources/GraphQLAPIKit/Extensions/GraphQLAPIAdapter+Extensions.swift
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nakonec ses rozhodl neimplementovat tu zmenu?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
V predchádzajúcej verzii to je naimplementované ale skrz to že som pridal teraz "abstrakciu" skrz pomocné štruktúry na konfiguráciu aby sme mohli do budúcna jednoduchšie rozširovať konštruktor alebo pridať support napríklad additional parametrov vrámci volaní. Tak variadické generiká stratili význam nakoľko nemáme ešte možnosť (minimálne o nej neviem) ako uložiť heterogénne pole 😞