YelpProvider

1.0.0

Yelp Vapor Provider
askrav/YelpProvider

What's New

2019-03-02T14:17:45Z

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.

Description

  • Swift Tools 4.2.0
View More Packages from this Author

Dependencies

Last updated: Sun Mar 17 2024 17:22:53 GMT-0900 (Hawaii-Aleutian Daylight Time)