Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jul 10, 2022
1 parent 712101d commit c718554
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ generate api.github.yaml --output ./OctoKit --module "OctoKit"

> Check out [App Store Connect Swift SDK](https://github.com/AvdLee/appstoreconnect-swift-sdk) that starting with v2.0 uses [CreateAPI](https://github.com/kean/CreateAPI) for code generation.
### Other Extensions

Get is a lean framework with a lot of flexibility and customization points. It makes it very easy to learn and use, but for certain features, you'll need to install additional modules.

- [URLQueryEncoder](https://github.com/CreateAPI/URLQueryEncoder) – URL query encoder with support for all OpenAPI serialization options
- [swift-multipart-formdata](https://github.com/FelixHerrmann/swift-multipart-formdata) - build `multipart/form-data` in a type-safe way
- [NaiveDate](https://github.com/CreateAPI/NaiveDate) – working with dates ignoring time zones

Because Get provides complete access to the underlying `URLSession`, it's easy to use it with almost any framework that extends networking on Apple platforms.

## Minimum Requirements

| Get | Date | Swift | Xcode | Platforms |
Expand Down
10 changes: 10 additions & 0 deletions Sources/Get/Get.docc/Articles/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ generate api.github.yaml --output ./OctoKit --module "OctoKit"
```

> Check out [App Store Connect Swift SDK](https://github.com/AvdLee/appstoreconnect-swift-sdk) that starting with v2.0 uses [CreateAPI](https://github.com/kean/CreateAPI) for code generation.
### Other Extensions

Get is a lean framework with a lot of flexibility and customization points. It makes it very easy to learn and use, but for certain features, you'll need to install additional modules.

- [URLQueryEncoder](https://github.com/CreateAPI/URLQueryEncoder) – URL query encoder with support for all OpenAPI serialization options
- [swift-multipart-formdata](https://github.com/FelixHerrmann/swift-multipart-formdata) - build `multipart/form-data` in a type-safe way
- [NaiveDate](https://github.com/CreateAPI/NaiveDate) – working with dates ignoring time zones

Because Get provides complete access to the underlying `URLSession`, it's easy to use it with almost any framework that extends networking on Apple platforms.
19 changes: 9 additions & 10 deletions Tests/GetTests/ClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,13 @@ final class APIClientTests: XCTestCase {
let client = makeSUT()

let url = URL(string: "https://api.github.com/user")!
Mock(url: url, dataType: .json, statusCode: 200, data: [
.post: json(named: "user")
]).register()
Mock.get(url: url, json: "user").register()

// WHEN

let fileURL = try XCTUnwrap(Bundle.module.url(forResource: "user", withExtension: "json"))
let user: User = try await client.upload(for: .post("/user"), fromFile: fileURL).value
let response = try await client.data(for: .get("/user"))

// THEN
let user = try JSONDecoder().decode(User.self, from: response.data)
XCTAssertEqual(user.login, "kean")
}

Expand Down Expand Up @@ -265,14 +262,16 @@ final class APIClientTests: XCTestCase {
let client = makeSUT()

let url = URL(string: "https://api.github.com/user")!
Mock.get(url: url, json: "user").register()
Mock(url: url, dataType: .json, statusCode: 200, data: [
.post: json(named: "user")
]).register()

// WHEN
let response = try await client.download(for: .get("/user"))

let fileURL = try XCTUnwrap(Bundle.module.url(forResource: "user", withExtension: "json"))
let user: User = try await client.upload(for: .post("/user"), fromFile: fileURL).value

// THEN
let data = try Data(contentsOf: response.location)
let user = try JSONDecoder().decode(User.self, from: data)
XCTAssertEqual(user.login, "kean")
}

Expand Down

0 comments on commit c718554

Please sign in to comment.