pubsublib

package module
v0.0.0-...-0f8213d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 7 Imported by: 0

README

pubsubclient

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL    string
	HttpClient *http.Client
	Token      string
	ApiKey     string
}

func NewClient

func NewClient(baseURL string, token string, apiKey string, httpClient ...*http.Client) *Client

func (*Client) CreateSubscription

func (cli *Client) CreateSubscription(topicName string, subscription Subscription) error

func (*Client) CreateTopic

func (cli *Client) CreateTopic(topic Topic) error

func (*Client) EnsureTopicExists

func (cli *Client) EnsureTopicExists(topic string) error

func (*Client) GetMessages

func (cli *Client) GetMessages(topic string) ([]Message, error)

func (*Client) ListTopics

func (cli *Client) ListTopics() ([]string, error)

func (*Client) PublishMessage

func (cli *Client) PublishMessage(topicName string, message Message) error

func (*Client) PullMessage

func (cli *Client) PullMessage(subscriptionName string) (*Message, error)

func (*Client) TopicExists

func (cli *Client) TopicExists(topic string) (bool, error)

type GetMessagesResponse

type GetMessagesResponse struct {
	Messages []Message `json:"messages"`
}

type ListTopicsResponse

type ListTopicsResponse struct {
	Topics []string `json:"topics"`
}

type Message

type Message struct {
	ID        string `json:"id"`
	Data      string `json:"data"`
	Timestamp string `json:"timestamp"`
}

type PullResponse

type PullResponse struct {
	Message Message `json:"message"`
}

type Subscription

type Subscription struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type Topic

type Topic struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL