apple / swift-openapi-urlsession

URLSession transport for Swift OpenAPI Generator.
https://swiftpackageindex.com/apple/swift-openapi-urlsession/documentation
Apache License 2.0
159 stars 31 forks source link
openapi swift transport urlsession

URLSession Transport for Swift OpenAPI Generator

A client transport that uses the URLSession type from the Foundation framework to perform HTTP operations.

Use the transport with client code generated by Swift OpenAPI Generator.

Supported platforms and minimum versions

macOS Linux iOS tvOS watchOS visionOS
✅ 10.15+ ✅ 13+ ✅ 13+ ✅ 6+ ✅ 1+

Note: Streaming support only available on macOS 12+, iOS 15+, tvOS 15+, watchOS 8+, and visionOS 1+. For streaming support on Linux, please use the AsyncHTTPClient Transport

Usage

Add the package dependency in your Package.swift:

.package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.0"),

Next, in your target, add OpenAPIURLSession to your dependencies:

.target(name: "MyTarget", dependencies: [
    .product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"),
]),

Then, to get started, check out URLSessionTransport.

Documentation

To learn more, check out the full documentation.