Swiftpack.co -  alchemy-swift/papyrus-alamofire as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
alchemy-swift/papyrus-alamofire
Requesting Papyrus Endpoints with Alamofire
.package(url: "https://github.com/alchemy-swift/papyrus-alamofire.git", from: "v0.1.0")

PapyrusAlamofire

Requesting Papyrus API definitions with Alamofire.

Usage

Define an API...

class TodosAPI: EndpointGroup {
    @GET("/todos")
    var getAll: Endpoint<GetTodosRequest, [TodoDTO]>

    struct GetTodosRequest: EndpointRequest {
        @URLQuery
        var limit: Int

        @URLQuery
        var incompleteOnly: Bool
    }

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

...and request it.

import PapyrusAlamofire

let todosAPI = TodosAPI(baseURL: "http://localhost:8888")
todosAPI.getAll
    .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).")
        }
    }

GitHub

link
Stars: 0
Last commit: 22 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

v0.1.0 Initial Release
27 weeks ago

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