Skip to content

wmcginty/UrbanVapor

Repository files navigation

UrbanVapor

CI Status Swift Vapor

Purpose

UrbanVapor is a Vapor 4 service, intended to make it easy to work with Airship's Push Notifications API. It is designed to simplify or eliminate 'stringly-typed' parameters, making the API safer to use.

Usage

Before using UrbanVapor, you'll need to provide it with an API key and master secret to enable to it to send push notifications. This is most easily done in configure.swift

if let urbanKey = Environment.get("UA_KEY"), let urbanSecret = Environment.get("UA_SECRET") {
    configureUrbanVapor(withKey: urbanKey, secret: urbanSecret)
}

Then, in your route handler, you can use the request.application to interact and send notifications.

router.get("example") { req  in
    let urbanVapor = try req.application.urbanVapor
    urbanVapor.send(payload, using: req.application.client)
    
    try await urbanVapor.send(payload, using: client)
}

Example

To run the example project, clone the repo, and run swift build from the directory.

Requirements

Swift 5.5, Vapor 4.0

Installation

Add the dependency to your Package.swift:

.package(url: "https://github.com/wmcginty/UrbanVapor.git", from: "0.4.0")

Contributing

All contributions are more than welcome - pull requests, cleanup, bug fixes, refactors... whatever! I will be focusing on the Airship APIs I use most frequently - if you have a different one you'd like to see, create an issue.

About

A Vapor provider designed for easily interfacing with Urban Airship's API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages