Skip to content

Commit 560de9c

Browse files
authored
Update README.md
1 parent 0e8898b commit 560de9c

1 file changed

Lines changed: 29 additions & 25 deletions

File tree

README.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,47 @@
1-
# Vapor Telesign Provider
1+
# TelesignKit
22

3-
![Swift](http://img.shields.io/badge/swift-4.1-brightgreen.svg)
4-
![Vapor](http://img.shields.io/badge/vapor-3.0-brightgreen.svg)
5-
[![CircleCI](https://circleci.com/gh/vapor-community/telesign-provider/tree/master.svg?style=svg)](https://circleci.com/gh/vapor-community/telesign-provider/tree/master)
3+
![](https://img.shields.io/badge/Swift-5-lightgrey.svg?style=svg)
4+
![](https://img.shields.io/badge/SwiftNio-2-lightgrey.svg?style=svg)
65

76

7+
### TelesignKit is a Swift package used to communicate with the [Telesign](https://telesign.com) API for Server Side Swift Apps.
8+
89
## What's Telesign?
9-
[Telesign][telesign_home] is a Communication Platform as a Service. Allowing you to send SMS messages for your use case, text to voice communications, phone identification to reduce risk/fraud and many other things.
10+
[Telesign](https://www.telesign.com) is a Communication Platform as a Service. Allowing you to send SMS messages for your use case, text to voice communications, phone identification to reduce risk/fraud and many other things.
1011

11-
## Integrating with your Vapor project
12-
Start by adding the repo to your `Package.swift`
12+
## Installation
13+
To start using TelesignKit, in your `Package.swift`, add the following
1314

1415
~~~~swift
15-
.package(url: "https://github.com/vapor-community/telesign-provider.git", from: "2.0.2")
16+
.package(url: "https://github.com/vapor-community/telesignkit.git", from: "1.0.0")
1617
~~~~
1718

18-
Register the config and the provider to your Application
19-
~~~~swift
20-
let config = TelesignConfig(apiKey: "myapikey", customerId: "mycustomerId")
19+
## Using the API
2120

22-
services.register(config)
21+
In your `main.swift` simply create a `TelesignClient`:
2322

24-
try services.register(TelesignProvider())
23+
~~~swift
24+
import NIO
25+
import TelesignKit
2526

26-
app = try Application(services: services)
27+
let eventloop: EventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
2728

28-
telesignClient = try app.make(TelesignClient.self)
29-
~~~~
3029

31-
And you are all set. Interacting with the API is quite easy and adopts the `Future` syntax used in Vapor 3.
32-
Making calls to the api is straight forward.
33-
~~~~swift
34-
try telesignClient.messaging.send(message: "Hello Vapor", to: "1234567", messageType: .ARN)
35-
~~~~
30+
let client = TelesignClient(eventLoop: eventloop,
31+
apiKey: "YOUR_API_KEY",
32+
customerId: "YOUR_CUSTOMER_ID")
33+
34+
do {
35+
let result = try client.messaging.send(phoneNumber: "11234567890",
36+
message: "Hello Telesign!",
37+
messageType: .ARN).wait()
38+
print(result)
39+
} catch {
40+
print(error)
41+
}
42+
~~~
3643

37-
## Supports the full API
44+
## Supports the following APIs
3845
* [x] Messaging
3946
* [x] PhoneId
4047
* [x] Score
41-
* [x] Voice
42-
43-
[telesign_home]: https://www.telesign.com "Telesign"

0 commit comments

Comments
 (0)