Skip to content

Prep 1.0 #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/apple/swift-openapi-runtime", exact: "1.0.0-alpha.1"),
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-http-types", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-collections", from: "1.0.0"),
Expand Down
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# URLSession Transport for Swift OpenAPI Generator

[![](https://img.shields.io/badge/docc-read_documentation-blue)](https://swiftpackageindex.com/apple/swift-openapi-urlsession/documentation)
[![](https://img.shields.io/github/v/release/apple/swift-openapi-urlsession)](https://github.com/apple/swift-openapi-urlsession/releases)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fapple%2Fswift-openapi-urlsession%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/apple/swift-openapi-urlsession)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fapple%2Fswift-openapi-urlsession%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/apple/swift-openapi-urlsession)

Expand All @@ -21,30 +22,19 @@ Note: Streaming support only available on macOS 12+, iOS 15+, tvOS 15+, watchOS
Add the package dependency in your `Package.swift`:

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

Note that this repository does not have a 1.0 tag yet, so the API is not stable.

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

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

Then, to get started, check out `URLSessionTransport`.

## Reporting issues

Please report any issues related to this library in the
[swift-openapi-generator](https://github.com/apple/swift-openapi-generator/issues)
repository.

## Documentation

To learn more, check out the full [documentation](https://swiftpackageindex.com/apple/swift-openapi-urlsession/documentation).
15 changes: 2 additions & 13 deletions Sources/OpenAPIURLSession/Documentation.docc/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,19 @@ Note: Streaming support only available on macOS 12+, iOS 15+, tvOS 15+, watchOS
Add the package dependency in your `Package.swift`:

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

Note that this repository does not have a 1.0 tag yet, so the API is not stable.

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

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

Then, to get started, check out ``URLSessionTransport``.

### Reporting issues

Please report any issues related to this library in the
[swift-openapi-generator](https://github.com/apple/swift-openapi-generator/issues)
repository.

## Topics

### Essentials
Expand Down
11 changes: 2 additions & 9 deletions Sources/OpenAPIURLSession/URLSessionTransport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,19 @@ import class FoundationNetworking.HTTPURLResponse
///
/// let transport = URLSessionTransport()
///
/// Create the base URL of the server to call using your client. If the server
/// URL was defined in the OpenAPI document, you find a generated method for it
/// on the `Servers` type, for example:
///
/// let serverURL = try Servers.server1()
///
/// Instantiate the `Client` type generated by the Swift OpenAPI Generator for
/// your provided OpenAPI document. For example:
///
/// let client = Client(
/// serverURL: serverURL,
/// serverURL: URL(string: "https://example.com")!,
/// transport: transport
/// )
///
/// Use the client to make HTTP calls defined in your OpenAPI document. For
/// example, if the OpenAPI document contains an HTTP operation with
/// the identifier `checkHealth`, call it from Swift with:
///
/// let response = try await client.checkHealth(.init())
/// // ...
/// let response = try await client.checkHealth()
///
/// ### Provide a custom URLSession
///
Expand Down