Skip to content

Commit f8d1750

Browse files
committed
Add usage example
1 parent f2cb969 commit f8d1750

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Futured apps s.r.o.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,36 @@ ${SWIFT_PACKAGES}/GraphQLAPIKit/Resources/apollo-ios-cli generate --path ./Graph
7878
#### 8. Add GraphQLAPI local package
7979
- Go to Xcode -> File -> Add Package Dependencies..
8080
- Choose `Add Local...`
81-
- Add `GraphQLAPI` as local Swift Package
81+
- Add `GraphQLAPI` as local Swift Package.
8282
Make sure, that `GraphQLAPI` library was added to your main's target `Frameworks, Libraries, and Embedded Content` list.
8383
For your project's test target add `GraphQLAPIMocks` library if necessary.
8484

8585
#### 9. Update `.gitignore` file
8686
Add `*.graphql.swift` to your repository's git ignore file to ignore Apollo generated code.
87-
*!Content of generated `Schema` folder has to be commited to the repository!*
87+
88+
**Content of generated `Schema` folder has to be commited to the repository**
8889

8990
#### 10. Exclude `GraphQLAPI` folder from your linter's rule if necessary
9091

92+
## Usage
93+
94+
### Defining Query or Mutation
95+
```swift
96+
let query = MyExampleQuery()
97+
let mutation = MyExampleMutation()
98+
```
99+
100+
### Fetching the query/perform mutation
101+
```swift
102+
let apiAdapter = GraphQLAPIAdapter(url: URL("https://MyAPIUrl.com")!)
103+
let queryResult = await apiAdapter.fetch(query: query)
104+
let mutationResult = await apiAdapter.perform(mutation: mutation)
105+
```
106+
107+
## Contributors
108+
109+
- [Ievgen Samoilyk](https://github.com/samoilyk), <[email protected]>.
110+
111+
## License
112+
113+
GraphQLAPIKit is available under the MIT license. See the [LICENSE file](LICENSE) for more information.

0 commit comments

Comments
 (0)