All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- None.
- None.
- None.
- None.
- None.
- None.
- New methods for requesting raw
Dataresponse to allow for using alternative decoding methods such as SwiftyJSON:performRawDataRequest(AndWait)(classic approach),rawDataPublisher(Combine) andrawDataResponse(Swift concurrency).
- Made the
baseUrlparameter ofApiProvidereditable.
- New async
responsemethod based on the new concurrency features available in Swift 5.5.
- New
mockingBehaviorparameter onApiProviderfor testing purposes. Specify one withdelayandscheduler, e.g..seconds(0.5)andDispatchQueue.main.eraseToAnyScheduler(). Providesnilby default to make actual requests. - New optional
mockedResponsecomputed property onEndpointprotocol expecting an output of typeMockedResponse. Use this to provide mocked responses when using amockingBehaviorin tests. See the PostmanEchoEndpoint in the tests for a usage example via themockconvenience method.
- Moved
baseUrlfromEndpointtoApiProvider. This allows for specifying differentbaseUrleven whenEndpointis implemented in a library by passing it in the app. - Renamed
HttpBasicAuthPlugintoHttpAuthPluginwith a newschemeparameter that accepts one of.basicor.bearerto support multiple authentication methods.
- Microya now supports Combine publishers, just call
publisher(on:decodeBodyTo:)orpublisher(on:)instead ofperformRequest(on:decodeBodyTo:)orperformRequest(on:)and you'll get anAnyPublisherrequest stream to subscribe to. In success cases you will receive the decoded typed object, in error cases anApiErrorobject exactly like within theperformRequestcompletion closure. But instead of aResulttype you can usesinkorcatchfrom the Combine framework.
- The
queryParametersis no longer of type[String: String], but[String: QueryParameterValue]now. Existing code like["search": searchTerm]will need to be updated to["search": .string(searchTerm)]. Apart from.stringthis now also allows specifying an array of strings like so:["tags": .array(userSelectedTags)]. String & array literals are supported directly, e.g.["sort": "createdAt"]or["sort": ["createdAt", "id"]].
- New
ApiProvidertype encapsulating different request methods with support for plugins. - New asynchronous
performRequestmethods with completion callbacks. (#2) - New
Pluginclass to subclass for integrating into the networking logic via callbacks. - New pre-implemented plugins:
HttpBasicAuth,ProgressIndicator,RequestLogger,ResponseLogger. - New
EmptyResponseBodytype to use whenever the body is expected to be empty or should be ignored.
- Renamed
JsonApiprotocol toEndpoint. - Renamed
MethodtoHttpMethodand addedbody: Datato the casespostandpatch. - Moved the
requestmethod fromJsonApito the newApiProvider& renamed toperformRequestAndWait. - Generally improved the cases in
JsonApiError& renamed the type toApiError. - Moved CI from Bitrise to GitHub Actions.
- The
bodyData: Data?requirement onJsonApi(bodies are not part ofHttpMethod, see above). - Installation is no longer possible via CocoaPods or Carthage. Please use SwiftPM instead.
- Make some fields of the
JsonApiprotocol optional by providing default implementation.
- Add
JsonApitype similar toTargetTypein Moya with additional JSONCodablesupport. - Add basic usage documentation based on the Microsoft Translator API.