Add public init for Pinball.Query
Pinball is a tiny networking library for Swift!
Pinball can be installed using the Swift Package Manager. Add the following to your Package.swift file:
Package.swift
dependencies: [ .Package(url: "https://github.com/infinitetoken/Pinball.git", from: "1.0.0") ]
import Pinball let paths: [String] = ["widgets"] let queries: [Pinball.Query] = [ Pinball.Query(key: "foo", value: "bar") ] let headers: [Pinball.Header] = [ Pinball.Header.accept("application/json"), Pinball.Header.contentType("application/json") ] let data: Data = ... let endpoint = Pinball.Endpoint(method: .get, scheme: .https, host: "localhost", port: 3000, user: "example", password: "password", paths: paths, queries: queries, headers: headers, data: data) do { let dataTask = try URLSession.shared.dataTask(for: endpoint) // Do something with the data task! } catch { // Failed! } do { let _ = try URLSession.shared.dataTask(for: endpoint, completionHandler: { (data, response, error) in // Do something with response! }) } catch { // Failed! } do { let publisher = try URLSession.shared.dataTaskPublisher(for: endpoint) // Do something with the Combine publisher! } catch { // Failed! }
Pinball is released under the MIT license. See LICENSE for details.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
Pinball
Pinball is a tiny networking library for Swift!
Installation
Pinball can be installed using the Swift Package Manager. Add the following to your
Package.swift
file:Usage
Reference
License
Pinball is released under the MIT license. See LICENSE for details.