diff --git a/README.md b/README.md index 64fed31..330534b 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/Sources/Get/Get.docc/Articles/integrations.md b/Sources/Get/Get.docc/Articles/integrations.md index 459ae73..9e248c3 100644 --- a/Sources/Get/Get.docc/Articles/integrations.md +++ b/Sources/Get/Get.docc/Articles/integrations.md @@ -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. diff --git a/Tests/GetTests/ClientTests.swift b/Tests/GetTests/ClientTests.swift index 0577d47..e46d151 100644 --- a/Tests/GetTests/ClientTests.swift +++ b/Tests/GetTests/ClientTests.swift @@ -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") } @@ -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") }