https://github.com/vapor-community/gatewayapikit
A Swift package for sending SMS using GatewayAPI
https://github.com/vapor-community/gatewayapikit
gateway-api server-side-swift sms-api swiftnio
Last synced: 3 months ago
JSON representation
A Swift package for sending SMS using GatewayAPI
- Host: GitHub
- URL: https://github.com/vapor-community/gatewayapikit
- Owner: vapor-community
- License: mit
- Created: 2019-11-03T16:05:50.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-19T16:53:20.000Z (over 5 years ago)
- Last Synced: 2024-11-17T09:46:57.051Z (11 months ago)
- Topics: gateway-api, server-side-swift, sms-api, swiftnio
- Language: Swift
- Size: 16.6 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GatewayAPIKit
### GatewayAPIKit is a Swift package used to send text messages (SMS) with [GatewayAPI](https://gatewayapi.com/) for Server Side Swift.
## Installation
To use GatewayAPI, please add the following to your `Package.swift` file.~~~~swift
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`:~~~~swift
import GatewayAPIKitlet 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:
~~~~swift
client.send("My text message", to: ["4510203040"], from: "Mads")
~~~~