Swiftpack.co - Package - kiliankoe/EmealKit

🎓 EmealKit

Swift library for accessing some of the data the Studentenwerk Dresden has to offer.

Quick Start

Current Meal or Canteen Information

Meal.for(canteen: .alteMensa, on: Date()) { result in
    guard let meals = result.success else { return }
    
    for meal in meals {
        print(meal.name)
    }
}

Canteen.all { result in
    guard let canteens = result.success else { return }
    
    for canteen in canteens {
        print(canteen.name)
    }
}

Both of these requests also offer publishers for use with Combine.

Cardservice

Talk to the Cardservice to acquire data about your Emeal card. You will need to have registered for Autoload to have the necessary authentication details.

Cardservice.login(username: "1234567890", password: "hunter2") { result in
    guard let service = result.success else { return }
    
    service.carddata { result in
        guard let data = result.success else { return }
        print(data)
    }
    
    let twoDaysAgo = Date().addingTimeInterval(-60 * 60 * 24 * 2)
    let now = Date()
    service.transactions(begin: twoDaysAgo, end: now) { result in
        guard let transactions = result.success else { return }
        print(transactions)
    }
}

Installation

EmealKit is available through Swift Package Manager.

.package(url: "https://github.com/kiliankoe/EmealKit.git", from: "<#latest#>")

Github

link
Stars: 1

Used By

Total: 0