Swiftpack.co - vapor-community/GatewayAPIKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by vapor-community.
vapor-community/GatewayAPIKit 1.0.0
A Swift package for sending SMS using GatewayAPI
⭐️ 4
🕓 4 years ago
linux macOS iOS
.package(url: "https://github.com/vapor-community/GatewayAPIKit.git", from: "1.0.0")

GatewayAPIKit

GatewayAPIKit is a Swift package used to send text messages (SMS) with GatewayAPI for Server Side Swift.

Installation

To use GatewayAPI, please add the following to your Package.swift file.

dependencies: [
    ...
    .package(url: "https://github.com/vapor-community/GatewayAPIKit.git", from: "1.0.0")
],
...
targets: [
    .target(
        name: ...
        dependencies: [
            ...
            .product(name: "GatewayAPIKit", package: "GatewayAPIKit")
        ]
    )
]

How to use

All you need to send a text message is to initialize a GatewayAPIClient:

import GatewayAPIKit

let eventLoop: EventLoop = ...
let httpClient = HTTPClient(...)
let client = GatewayAPIClient(eventLoop: eventLoop, httpClient: httpClient, apiKey: "")

Please store your API key in storage such as environment variables and not directly in code.

You can now send a simple text message:

client.send("My text message", to: ["4510203040"], from: "Mads")

GitHub

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

Release Notes

GatewayAPIKit 1.0.0
4 years ago

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