Swiftpack.co - Package - askrav/YelpProvider

YelpProvider

Swift Vapor

Yelp is a local-search service that helps people find local businesses like dentists, hair stylists and mechanics.

How To Use

In your Package.swift file, add the following

.package(url: "https://github.com/askrav/YelpProvider.git", from: "1.0.0")

Register the config and the provider in configure.swift

let yelpConfig = YelpConfig(apiKey: "YOUR_API_KEY")
services.register(yelpConfig)
try services.register(YelpProvider())

And this is it. Now let's see an example:

static func listCategories(_ req: Request) throws -> Future<Response> {
        return try req.make(YelpClient.self).categories.getCategories().flatMap { res in
            let categories = res.categories
            // ...
            // Do whatever you need to
            // ...
            
            return try res.encode(for: req)
        }
    }

All the documentation is available on the Yelp API website.

Yelp Provider is available under the MIT license. See the LICENSE file for more info.

Github

link
Stars: 1
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

1.0.0 - Mar 2, 2019