Skip to content

Commit fff570d

Browse files
Add auto-generated documentation using SourceDocs
1 parent e30f158 commit fff570d

89 files changed

Lines changed: 2494 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/source/api/Apollo/README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Reference Documentation
2+
This Reference Documentation has been generated with
3+
[SourceDocs](https://github.com/eneko/SourceDocs).
4+
5+
## Protocols
6+
7+
- [Cancellable](protocols/Cancellable.md)
8+
- [GraphQLFragment](protocols/GraphQLFragment.md)
9+
- [GraphQLInputValue](protocols/GraphQLInputValue.md)
10+
- [GraphQLMapConvertible](protocols/GraphQLMapConvertible.md)
11+
- [GraphQLMutation](protocols/GraphQLMutation.md)
12+
- [GraphQLOperation](protocols/GraphQLOperation.md)
13+
- [GraphQLQuery](protocols/GraphQLQuery.md)
14+
- [GraphQLSelection](protocols/GraphQLSelection.md)
15+
- [GraphQLSelectionSet](protocols/GraphQLSelectionSet.md)
16+
- [GraphQLSubscription](protocols/GraphQLSubscription.md)
17+
- [HTTPNetworkTransportDelegate](protocols/HTTPNetworkTransportDelegate.md)
18+
- [HTTPNetworkTransportPreflightDelegate](protocols/HTTPNetworkTransportPreflightDelegate.md)
19+
- [HTTPNetworkTransportRetryDelegate](protocols/HTTPNetworkTransportRetryDelegate.md)
20+
- [HTTPNetworkTransportTaskCompletedDelegate](protocols/HTTPNetworkTransportTaskCompletedDelegate.md)
21+
- [JSONDecodable](protocols/JSONDecodable.md)
22+
- [JSONEncodable](protocols/JSONEncodable.md)
23+
- [Matchable](protocols/Matchable.md)
24+
- [NetworkTransport](protocols/NetworkTransport.md)
25+
- [NormalizedCache](protocols/NormalizedCache.md)
26+
27+
## Structs
28+
29+
- [GraphQLBooleanCondition](structs/GraphQLBooleanCondition.md)
30+
- [GraphQLError](structs/GraphQLError.md)
31+
- [GraphQLField](structs/GraphQLField.md)
32+
- [GraphQLFragmentSpread](structs/GraphQLFragmentSpread.md)
33+
- [GraphQLHTTPResponseError](structs/GraphQLHTTPResponseError.md)
34+
- [GraphQLResult](structs/GraphQLResult.md)
35+
- [GraphQLTypeCase](structs/GraphQLTypeCase.md)
36+
- [GraphQLTypeCondition](structs/GraphQLTypeCondition.md)
37+
- [GraphQLVariable](structs/GraphQLVariable.md)
38+
- [Location](structs/Location.md)
39+
- [Record](structs/Record.md)
40+
- [RecordSet](structs/RecordSet.md)
41+
- [Reference](structs/Reference.md)
42+
43+
## Classes
44+
45+
- [ApolloClient](classes/ApolloClient.md)
46+
- [ApolloStore](classes/ApolloStore.md)
47+
- [EmptyCancellable](classes/EmptyCancellable.md)
48+
- [GraphQLQueryWatcher](classes/GraphQLQueryWatcher.md)
49+
- [GraphQLResponse](classes/GraphQLResponse.md)
50+
- [HTTPNetworkTransport](classes/HTTPNetworkTransport.md)
51+
- [InMemoryNormalizedCache](classes/InMemoryNormalizedCache.md)
52+
- [JSONSerializationFormat](classes/JSONSerializationFormat.md)
53+
- [Promise](classes/Promise.md)
54+
- [ReadTransaction](classes/ReadTransaction.md)
55+
- [ReadWriteTransaction](classes/ReadWriteTransaction.md)
56+
57+
## Enums
58+
59+
- [CachePolicy](enums/CachePolicy.md)
60+
- [ErrorKind](enums/ErrorKind.md)
61+
- [GraphQLHTTPRequestError](enums/GraphQLHTTPRequestError.md)
62+
- [GraphQLOperationType](enums/GraphQLOperationType.md)
63+
- [GraphQLOutputType](enums/GraphQLOutputType.md)
64+
- [JSONDecodingError](enums/JSONDecodingError.md)
65+
- [Result](enums/Result.md)
66+
- [ResultOrPromise](enums/ResultOrPromise.md)
67+
- [Source](enums/Source.md)
68+
69+
## Extensions
70+
71+
- [Array](extensions/Array.md)
72+
- [Bool](extensions/Bool.md)
73+
- [Dictionary](extensions/Dictionary.md)
74+
- [Double](extensions/Double.md)
75+
- [Float](extensions/Float.md)
76+
- [GraphQLError](extensions/GraphQLError.md)
77+
- [GraphQLMapConvertible](extensions/GraphQLMapConvertible.md)
78+
- [GraphQLMutation](extensions/GraphQLMutation.md)
79+
- [GraphQLOperation](extensions/GraphQLOperation.md)
80+
- [GraphQLQuery](extensions/GraphQLQuery.md)
81+
- [GraphQLSelectionSet](extensions/GraphQLSelectionSet.md)
82+
- [GraphQLSubscription](extensions/GraphQLSubscription.md)
83+
- [GraphQLVariable](extensions/GraphQLVariable.md)
84+
- [Int](extensions/Int.md)
85+
- [JSONDecodingError](extensions/JSONDecodingError.md)
86+
- [JSONEncodable](extensions/JSONEncodable.md)
87+
- [Optional](extensions/Optional.md)
88+
- [RawRepresentable](extensions/RawRepresentable.md)
89+
- [Record](extensions/Record.md)
90+
- [RecordSet](extensions/RecordSet.md)
91+
- [Reference](extensions/Reference.md)
92+
- [Result](extensions/Result.md)
93+
- [String](extensions/String.md)
94+
- [URL](extensions/URL.md)
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
**CLASS**
2+
3+
# `ApolloClient`
4+
5+
```swift
6+
public class ApolloClient
7+
```
8+
9+
> The `ApolloClient` class provides the core API for Apollo. This API provides methods to fetch and watch queries, and to perform mutations.
10+
11+
## Properties
12+
### `store`
13+
14+
```swift
15+
public let store: ApolloStore
16+
```
17+
18+
### `cacheKeyForObject`
19+
20+
```swift
21+
public var cacheKeyForObject: CacheKeyForObject?
22+
```
23+
24+
## Methods
25+
### `init(networkTransport:store:)`
26+
27+
```swift
28+
public init(networkTransport: NetworkTransport, store: ApolloStore = ApolloStore(cache: InMemoryNormalizedCache()))
29+
```
30+
31+
> Creates a client with the specified network transport and store.
32+
>
33+
> - Parameters:
34+
> - networkTransport: A network transport used to send operations to a server.
35+
> - store: A store used as a local cache. Defaults to an empty store backed by an in memory cache.
36+
37+
#### Parameters
38+
39+
| Name | Description |
40+
| ---- | ----------- |
41+
| networkTransport | A network transport used to send operations to a server. |
42+
| store | A store used as a local cache. Defaults to an empty store backed by an in memory cache. |
43+
44+
### `init(url:)`
45+
46+
```swift
47+
public convenience init(url: URL)
48+
```
49+
50+
> Creates a client with an HTTP network transport connecting to the specified URL.
51+
>
52+
> - Parameter url: The URL of a GraphQL server to connect to.
53+
54+
#### Parameters
55+
56+
| Name | Description |
57+
| ---- | ----------- |
58+
| url | The URL of a GraphQL server to connect to. |
59+
60+
### `clearCache()`
61+
62+
```swift
63+
public func clearCache() -> Promise<Void>
64+
```
65+
66+
> Clears apollo cache
67+
>
68+
> - Returns: Promise
69+
70+
### `fetch(query:cachePolicy:context:queue:resultHandler:)`
71+
72+
```swift
73+
@discardableResult public func fetch<Query: GraphQLQuery>(query: Query, cachePolicy: CachePolicy = .returnCacheDataElseFetch, context: UnsafeMutableRawPointer? = nil, queue: DispatchQueue = DispatchQueue.main, resultHandler: GraphQLResultHandler<Query.Data>? = nil) -> Cancellable
74+
```
75+
76+
> Fetches a query from the server or from the local cache, depending on the current contents of the cache and the specified cache policy.
77+
>
78+
> - Parameters:
79+
> - query: The query to fetch.
80+
> - cachePolicy: A cache policy that specifies when results should be fetched from the server and when data should be loaded from the local cache.
81+
> - queue: A dispatch queue on which the result handler will be called. Defaults to the main queue.
82+
> - resultHandler: An optional closure that is called when query results are available or when an error occurs.
83+
> - Returns: An object that can be used to cancel an in progress fetch.
84+
85+
#### Parameters
86+
87+
| Name | Description |
88+
| ---- | ----------- |
89+
| query | The query to fetch. |
90+
| cachePolicy | A cache policy that specifies when results should be fetched from the server and when data should be loaded from the local cache. |
91+
| queue | A dispatch queue on which the result handler will be called. Defaults to the main queue. |
92+
| resultHandler | An optional closure that is called when query results are available or when an error occurs. |
93+
94+
### `watch(query:cachePolicy:queue:resultHandler:)`
95+
96+
```swift
97+
public func watch<Query: GraphQLQuery>(query: Query, cachePolicy: CachePolicy = .returnCacheDataElseFetch, queue: DispatchQueue = DispatchQueue.main, resultHandler: @escaping GraphQLResultHandler<Query.Data>) -> GraphQLQueryWatcher<Query>
98+
```
99+
100+
> Watches a query by first fetching an initial result from the server or from the local cache, depending on the current contents of the cache and the specified cache policy. After the initial fetch, the returned query watcher object will get notified whenever any of the data the query result depends on changes in the local cache, and calls the result handler again with the new result.
101+
>
102+
> - Parameters:
103+
> - query: The query to fetch.
104+
> - fetchHTTPMethod: The HTTP Method to be used.
105+
> - cachePolicy: A cache policy that specifies when results should be fetched from the server or from the local cache.
106+
> - queue: A dispatch queue on which the result handler will be called. Defaults to the main queue.
107+
> - resultHandler: An optional closure that is called when query results are available or when an error occurs.
108+
> - Returns: A query watcher object that can be used to control the watching behavior.
109+
110+
#### Parameters
111+
112+
| Name | Description |
113+
| ---- | ----------- |
114+
| query | The query to fetch. |
115+
| fetchHTTPMethod | The HTTP Method to be used. |
116+
| cachePolicy | A cache policy that specifies when results should be fetched from the server or from the local cache. |
117+
| queue | A dispatch queue on which the result handler will be called. Defaults to the main queue. |
118+
| resultHandler | An optional closure that is called when query results are available or when an error occurs. |
119+
120+
### `perform(mutation:context:queue:resultHandler:)`
121+
122+
```swift
123+
@discardableResult public func perform<Mutation: GraphQLMutation>(mutation: Mutation, context: UnsafeMutableRawPointer? = nil, queue: DispatchQueue = DispatchQueue.main, resultHandler: GraphQLResultHandler<Mutation.Data>? = nil) -> Cancellable
124+
```
125+
126+
> Performs a mutation by sending it to the server.
127+
>
128+
> - Parameters:
129+
> - mutation: The mutation to perform.
130+
> - fetchHTTPMethod: The HTTP Method to be used.
131+
> - queue: A dispatch queue on which the result handler will be called. Defaults to the main queue.
132+
> - resultHandler: An optional closure that is called when mutation results are available or when an error occurs.
133+
> - Returns: An object that can be used to cancel an in progress mutation.
134+
135+
#### Parameters
136+
137+
| Name | Description |
138+
| ---- | ----------- |
139+
| mutation | The mutation to perform. |
140+
| fetchHTTPMethod | The HTTP Method to be used. |
141+
| queue | A dispatch queue on which the result handler will be called. Defaults to the main queue. |
142+
| resultHandler | An optional closure that is called when mutation results are available or when an error occurs. |
143+
144+
### `subscribe(subscription:queue:resultHandler:)`
145+
146+
```swift
147+
@discardableResult public func subscribe<Subscription: GraphQLSubscription>(subscription: Subscription, queue: DispatchQueue = DispatchQueue.main, resultHandler: @escaping GraphQLResultHandler<Subscription.Data>) -> Cancellable
148+
```
149+
150+
> Subscribe to a subscription
151+
>
152+
> - Parameters:
153+
> - subscription: The subscription to subscribe to.
154+
> - fetchHTTPMethod: The HTTP Method to be used.
155+
> - queue: A dispatch queue on which the result handler will be called. Defaults to the main queue.
156+
> - resultHandler: An optional closure that is called when mutation results are available or when an error occurs.
157+
> - Returns: An object that can be used to cancel an in progress subscription.
158+
159+
#### Parameters
160+
161+
| Name | Description |
162+
| ---- | ----------- |
163+
| subscription | The subscription to subscribe to. |
164+
| fetchHTTPMethod | The HTTP Method to be used. |
165+
| queue | A dispatch queue on which the result handler will be called. Defaults to the main queue. |
166+
| resultHandler | An optional closure that is called when mutation results are available or when an error occurs. |
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
**CLASS**
2+
3+
# `ApolloStore`
4+
5+
```swift
6+
public final class ApolloStore
7+
```
8+
9+
> The `ApolloStore` class acts as a local cache for normalized GraphQL results.
10+
11+
## Properties
12+
### `cacheKeyForObject`
13+
14+
```swift
15+
public var cacheKeyForObject: CacheKeyForObject?
16+
```
17+
18+
## Methods
19+
### `init(cache:)`
20+
21+
```swift
22+
public init(cache: NormalizedCache)
23+
```
24+
25+
### `withinReadTransaction(_:)`
26+
27+
```swift
28+
public func withinReadTransaction<T>(_ body: @escaping (ReadTransaction) throws -> Promise<T>) -> Promise<T>
29+
```
30+
31+
### `withinReadTransaction(_:)`
32+
33+
```swift
34+
public func withinReadTransaction<T>(_ body: @escaping (ReadTransaction) throws -> T) -> Promise<T>
35+
```
36+
37+
### `withinReadWriteTransaction(_:)`
38+
39+
```swift
40+
public func withinReadWriteTransaction<T>(_ body: @escaping (ReadWriteTransaction) throws -> Promise<T>) -> Promise<T>
41+
```
42+
43+
### `withinReadWriteTransaction(_:)`
44+
45+
```swift
46+
public func withinReadWriteTransaction<T>(_ body: @escaping (ReadWriteTransaction) throws -> T) -> Promise<T>
47+
```
48+
49+
### `load(query:)`
50+
51+
```swift
52+
public func load<Query: GraphQLQuery>(query: Query) -> Promise<GraphQLResult<Query.Data>>
53+
```
54+
55+
### `load(query:resultHandler:)`
56+
57+
```swift
58+
public func load<Query: GraphQLQuery>(query: Query, resultHandler: @escaping GraphQLResultHandler<Query.Data>)
59+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
**CLASS**
2+
3+
# `EmptyCancellable`
4+
5+
```swift
6+
public final class EmptyCancellable: Cancellable
7+
```
8+
9+
> A class to return when we need to bail out of something which still needs to return `Cancellable`.
10+
11+
## Methods
12+
### `init()`
13+
14+
```swift
15+
public init()
16+
```
17+
18+
### `cancel()`
19+
20+
```swift
21+
public func cancel()
22+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
**CLASS**
2+
3+
# `GraphQLQueryWatcher`
4+
5+
```swift
6+
public final class GraphQLQueryWatcher<Query: GraphQLQuery>: Cancellable, ApolloStoreSubscriber
7+
```
8+
9+
> A `GraphQLQueryWatcher` is responsible for watching the store, and calling the result handler with a new result whenever any of the data the previous result depends on changes.
10+
11+
## Methods
12+
### `refetch()`
13+
14+
```swift
15+
public func refetch()
16+
```
17+
18+
> Refetch a query from the server.
19+
20+
### `cancel()`
21+
22+
```swift
23+
public func cancel()
24+
```
25+
26+
> Cancel any in progress fetching operations and unsubscribe from the store.

0 commit comments

Comments
 (0)