/papyrus-async-http-client

async-http-client driver for using Papyrus with Swift on Server

Primary LanguageSwiftMIT LicenseMIT

PapyrusAsyncHTTPClient 📜

Swift Version Latest Release License

This is an async-http-client based driver for Papyrus.

You can see the Papyrus documentation in the main repository.

Installation

You can install PapyrusAsyncHTTPClient using the Swift Package Manager.

.package(url: "https://github.com/joshuawright11/papyrus-async-http-client.git", from: "0.2.0")

Usage

You can use this Papyrus driver by importing it instead.

import PapyrusAsyncHTTPClient

Configuration

Under the hood, PapyrusAsyncHTTPClient uses async-http-client to make requests. If you'd like to use a custom HTTPClient for making requests, pass it in when initializing a Provider.

let customClient: HTTPClient = ...
let provider = Provider(baseURL: "https://api.github.com", httpClient: customClient)
let github: GitHub = GitHubAPI(provider: provider)

If needbe, you can also access the under-the-hood HTTPClient types on a Response.

let response: Response = ...
let httpClientRequest: HTTPClient.Request = response.request
let httpClientResponse: HTTPClient.Response = response.response!

Contribution

👋 Thanks for checking out Papyrus!

If you'd like to contribute please file an issue, open a pull request or start a discussion.

License

Papyrus is released under an MIT license. See License.md for more information.