Swiftpack.co - alchemy-swift/papyrus-alamofire as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by alchemy-swift.
alchemy-swift/papyrus-alamofire v0.1.2
Requesting Papyrus Endpoints with Alamofire
⭐️ 0
🕓 2 weeks ago
iOS macOS
.package(url: "https://github.com/alchemy-swift/papyrus-alamofire.git", from: "v0.1.2")


Requesting Papyrus API definitions with Alamofire.


Define an API...

class TodosAPI: EndpointGroup {
    var getAll: Endpoint<GetTodosRequest, [TodoDTO]>

    struct GetTodosRequest: EndpointRequest {
        var limit: Int

        var incompleteOnly: Bool

    struct TodoDTO: Codable {
        var name: String
        var isComplete: Bool

...and request it.

import PapyrusAlamofire

let todosAPI = TodosAPI(baseURL: "http://localhost:8888")
    .request(.init(limit: 50, incompleteOnly: true)) { response, todoResult in
        switch todoResult {
        case .success(let todos):
            for todo in todos {
                print("Got todo: \(todo.name)")
        case .failure(let error):
            print("Got error: \(error).")


Stars: 0
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

2 weeks ago

Rename parameters to httpComponents and bodyEncoding to contentEncoding.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics