brendanhay/gogol

gogol-pubsub: PubSub projects.topics.publish method generates incorrect URL

Closed this issue · 1 comments

According to the official docs from Google, the URL format should be:

POST https://pubsub.googleapis.com/v1/{topic=projects/*/topics/*}:publish

However, the publish URL being generated is missing the colon between the topic and "publish": /v1/projects/my-project-here/topics/topic-testerpublish

It works fine though if I add a colon myself, but I doubt that's the intended way to use the library:

{-# LANGUAGE OverloadedStrings #-}
import Control.Lens           ((&), (.~), (<&>), (?~))
import Data.Text              (Text)
import Network.Google
import Network.Google.PubSub
import System.IO              (stdout)

import qualified Data.Text as Text

example :: IO PublishResponse
example = do
    lgr  <- newLogger Debug stdout
    env  <- newEnv <&> (envLogger .~ lgr) . (envScopes .~ pubSubScope)

    runResourceT . runGoogle env $ do
      send $ projectsTopicsPublish 
        (publishRequest & prMessages .~ [pubsubMessage & pmData ?~ "Hi!"])
        "projects/my-project-here/topics/topic-tester:"

Looks like this is correctly fixed in develop via #34