Swiftpack.co - wmcginty/UrbanVapor as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by wmcginty.
wmcginty/UrbanVapor 0.5.0
A Vapor provider designed for easily interfacing with Urban Airship's API
⭐️ 0
🕓 2 years ago
macOS
.package(url: "https://github.com/wmcginty/UrbanVapor.git", from: "0.5.0")

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.

GitHub

link
Stars: 0
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics