Skip to content

Commit

Permalink
Merge pull request #25 from emitter-io/remove-private-links
Browse files Browse the repository at this point in the history
Private links now disappeared to make place for private channels
  • Loading branch information
Florimond authored May 23, 2020
2 parents 7c14f7d + b0d1a89 commit df7bdf8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
26 changes: 0 additions & 26 deletions v2/emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,39 +360,13 @@ func (c *Client) GenerateKey(key, channel, permissions string, ttl int) (string,
return "", ErrUnmarshal
}

// CreatePrivateLink sends a request to create a private link.
func (c *Client) CreatePrivateLink(key, channel, name string, optionalHandler MessageHandler, options ...Option) (*Link, error) {
resp, err := c.request("link", &linkRequest{
Name: name,
Key: key,
Channel: formatTopic("", channel, options),
Subscribe: optionalHandler != nil,
Private: true,
})
if err != nil {
return nil, err
}

// Cast the response and return it
if result, ok := resp.(*Link); ok {
if optionalHandler != nil {
c.handlers.AddHandler(result.Channel, optionalHandler)
}

return result, nil
}

return nil, ErrUnmarshal
}

// CreateLink sends a request to create a default link.
func (c *Client) CreateLink(key, channel, name string, optionalHandler MessageHandler, options ...Option) (*Link, error) {
resp, err := c.request("link", &linkRequest{
Name: name,
Key: key,
Channel: formatTopic("", channel, options),
Subscribe: optionalHandler != nil,
Private: false,
})

if err != nil {
Expand Down
1 change: 0 additions & 1 deletion v2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ type linkRequest struct {
Key string `json:"key"` // The key for the channel.
Channel string `json:"channel"` // The channel name for the shortcut.
Subscribe bool `json:"subscribe"` // Specifies whether the broker should auto-subscribe.
Private bool `json:"private"` // Specifies whether the broker should generate a private link.
}

// meResponse represents information about the client.
Expand Down

0 comments on commit df7bdf8

Please sign in to comment.