Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.
/ OpenMensaKit Public archive

๐Ÿ› Query OpenMensa for canteen and meal data

License

Notifications You must be signed in to change notification settings

kiliankoe/OpenMensaKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

30 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ› OpenMensaKit

Access canteen and meal data from OpenMensa.

Quick Start

There's two types here, Canteen and Meal (and Meal.Price for the sake of completeness), with static funcs to fetch some data.

// Get a single canteen if you know the ID.
Canteen.get(withID: 79) { result in
    guard let canteen = result.success else { return }
    print(canteen)
}

// Get a list of canteens with known IDs.
Canteen.get(withIDs: [79, 80]) { result in
    guard let canteens = result.success else { return }
    print(canteens)
}

// Find a list of canteens near a given coordinate. A search radius can also be specified.
let coordinate = CLLocationCoordinate2D(latitude: 51.0344374, longitude: 13.7279451)
Canteen.find(near: coordinate) { result in
    guard let canteens = result.success else { return }
    print(canteens)
}

// Get a list of meals if you have a canteen on hand.
canteen.getMeals(forDay: Date()) { result in
    guard let meals = result.success else { return }
    print(meals)
}
// Get a list of meals for a canteen on a specific day.
Meal.get(forCanteen: 79, onDay: Date()) { result in
    guard let meals = result.success else { return }
    print(meals)
}

That's basically it. Got any questions, problems or ideas? Please don't hesitate to open an issue.

Installation

OpenMensaKit is available through Cocoapods, Carthage/Punic and Swift Package Manager, whatever floats your boat.

// Cocoapods
pod 'OpenMensaKit'

// Carthage
github "kiliankoe/OpenMensaKit"

// Swift Package Manager
.Package(url: "https://github.com/kiliankoe/OpenMensaKit", majorVersion: 0)

Authors

Kilian Koeltzsch, @kiliankoe

About

๐Ÿ› Query OpenMensa for canteen and meal data

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published