pushnotifications

package module
v0.0.0-...-764224c Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: MIT Imports: 11 Imported by: 3

README

Pusher Beams Go Server SDK Build Status

Getting Started

$ go get github.com/pusher/push-notifications-go

Examples

Refer to the example directory.

Communication

  • Found a bug? Please open an issue.
  • Have a feature request. Please open an issue.
  • If you want to contribute, please submit a pull request (preferably with some tests).

Credits

Beams is owned and maintained by Pusher.

License

This project is released under the MIT license. See LICENSE for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*pushNotifications)

func WithCustomBaseURL

func WithCustomBaseURL(url string) Option

func WithRequestTimeout

func WithRequestTimeout(timeout time.Duration) Option

type PushNotifications

type PushNotifications interface {
	// Publishes notifications to all devices subscribed to at least 1 of the interests given
	// Returns a non-empty `publishId` JSON string if successful; or a non-nil `error` otherwise.
	PublishToInterests(interests []string, request map[string]interface{}) (publishId string, err error)

	// DEPRECATED. An alias for `PublishToInterests`
	Publish(interests []string, request map[string]interface{}) (publishId string, err error)

	// Publishes notifications to all devices associated with the given user ids
	// Returns a non-empty `publishId` JSON string successful, or a non-nil `error` otherwise.
	PublishToUsers(users []string, request map[string]interface{}) (publishId string, err error)

	// Creates a signed JWT for a user id.
	// Returns a signed JWT if successful, or a non-nil `error` otherwise.
	GenerateToken(userId string) (token map[string]interface{}, err error)

	// Contacts the Beams service to remove all the devices of the given user
	// Return a non-nil `error` if there's a problem.
	DeleteUser(userId string) (err error)
}

The Pusher Push Notifications Server API client

func New

func New(instanceId string, secretKey string, options ...Option) (PushNotifications, error)

Creates a New `PushNotifications` instance. Returns an non-nil error if `instanceId` or `secretKey` are empty

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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