Swiftpack.co - Package - vapor-community/GatewayAPIKit

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: 1

Used By

Total: 0

Releases

GatewayAPIKit 1.0.0 - 2020-03-19 16:50:02

GatewayAPIKit 0.1.0 - 2019-11-23 18:33:01

Initial release with support for sending text messages