Skip to content

Commit

Permalink
Remove necessity for droplet
Browse files Browse the repository at this point in the history
  • Loading branch information
Koray Koska committed Jul 17, 2017
1 parent 59b1a3b commit 4073527
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/VaporFacebookBot/Send/FacebookSendApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ public final class FacebookSendApi {
private init() {
}

public func send(droplet: Droplet, facebookSend: FacebookSend, token: String) throws -> Response {
public func send(client: ClientFactoryProtocol = EngineClientFactory(), facebookSend: FacebookSend, token: String) throws -> Response {
let url = sendMessageUrl(token: token)

let req = Request(method: .post, uri: url, headers: defaultHeaders)
req.json = try facebookSend.makeJSON()

return try droplet.client.respond(to: req)
return try client.respond(to: req)
}

public func sendAsync(droplet: Droplet, facebookSend: FacebookSend, token: String, completion: ((_ response: Response?, _ error: Error?) -> Void)? = nil) {
public func sendAsync(client: ClientFactoryProtocol = EngineClientFactory(), facebookSend: FacebookSend, token: String, completion: ((_ response: Response?, _ error: Error?) -> Void)? = nil) {
background {
do {
let response = try self.send(droplet: droplet, facebookSend: facebookSend, token: token)
let response = try self.send(client: client, facebookSend: facebookSend, token: token)
completion?(response, nil)
} catch {
completion?(nil, error)
Expand Down

0 comments on commit 4073527

Please sign in to comment.