Skip to content

Commit

Permalink
feat: Support multiple messages on PublisherClient (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
portellaa authored Nov 3, 2019
1 parent 2d26d9f commit 8e71563
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/GoogleCloudPubSubKit/PublisherClient.swift
Original file line number Diff line number Diff line change
@@ -61,12 +61,12 @@ extension PublisherClient {
}

extension PublisherClient {
public func publish<Model: GoogleCloudModelEncodable>(model: Model, to topic: ProjectTopic)
public func publish<Model: GoogleCloudModelEncodable>(messages models: Model ..., to topic: ProjectTopic)
-> EventLoopFuture<PublishResponse> {
let path = "/v1\(topic.path):publish"

let message = PubSubMessage(data: model)
let messages = PubSubMessages(messages: [message])
let messageModels = models.map { PubSubMessage(data: $0) }
let messages = PubSubMessages(messages: messageModels)

return request.send(method: .POST, path: path, body: messages)
}

0 comments on commit 8e71563

Please sign in to comment.