Skip to content

Commit

Permalink
fix: Remove AmericaStore conformance with Store (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
portellaa authored Jan 8, 2020
1 parent bff9034 commit bbbc676
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Sources/YouClap/AmericaMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ extension AmericaMessage {
case group
case post
case user
case userGroup = "user-group"
case userUsername = "user-username"
}

Expand Down
9 changes: 8 additions & 1 deletion Sources/YouClap/AmericaStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ import GoogleCloudPubSubKit
import NIO

public protocol AmericaStore: Service {
var messageQueueClient: PublisherClient { get }

func publish(messages: AmericaMessage...) -> EventLoopFuture<PublishResponse>
func publish(messages: [AmericaMessage]) -> EventLoopFuture<PublishResponse>
}

extension Store: AmericaStore {
extension AmericaStore {
private var topic: ProjectTopic { ProjectTopic(project: messageQueueClient.project, name: "america") }

public func publish(messages: AmericaMessage...) -> EventLoopFuture<PublishResponse> {
return messageQueueClient.publish(messages: messages, to: topic)
}

public func publish(messages: [AmericaMessage]) -> EventLoopFuture<PublishResponse> {
return messageQueueClient.publish(messages: messages, to: topic)
}
}

0 comments on commit bbbc676

Please sign in to comment.