puffery

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2022 License: MIT Imports: 5 Imported by: 0

README ΒΆ

Go Puffery 🐑

Read and send push notifications to your iOS device from your command line with Puffery.

If you want to build an app on top of Puffery, you can also use github.com/vknabel/puffery-go as a library.

Puffery CLI showcase

In case you need inspiration or help, head over to our GitHub discussions!

Installation

The easiest way to install and update Puffery on macOS or linux is Homebrew.

brew install vknabel/install/puffery

Using Go

If you are a gopher and want to install it globally, just run:

go install github.com/vknabel/go-puffery@latest

In case you plan to write custom tooling on top of Puffery, start by adding to to your Go module.

go get github.com/vknabel/go-puffery@latest

Manual installation

If you are neither using Homebrew nor Go, head over to the GitHub releases page and pick the latest version that fits your operating system and architecture.

Unpack the archive and move it to a location of your choice, preferably into a directory in your $PATH.

Current Status

Currently go puffery is still in early development and doesn't yet support all features of the Puffery iOS App.

  • Logging in and out
  • Displaying all channels
  • Displaying all messages
  • Sending push notifications
  • Sending push notifications with colors
  • Creating and subscribing to channels
  • Displaying stats of a channel

Embedding puffery in your app

The main puffery module exports the whole API and all of its models. Start by creating a new Api

import (
    puffery "github.com/vknabel/go-puffery"
)

var pufferyApi = puffery.New()

err := pufferyApi.Hello()
if err != nil {
    panic(err)
}

Most endpoints require setting the token - either by confirming a login challenge (*Api) ConfirmLogin or by registering a new user (*Api) Register.

If you want to handle the session yourself, feel free to call (*Api) SetToken manually.

License

go-puffery is licensed under the MIT license.

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

This section is empty.

Types ΒΆ

type Api ΒΆ

type Api struct {
	Root string
	// contains filtered or unexported fields
}

func New ΒΆ

func New() Api

func (Api) ChannelStats ΒΆ

func (a Api) ChannelStats(id string) (SubscribedChannelDeletedResponse, error)

func (Api) Channels ΒΆ

func (a Api) Channels() ([]Channel, error)

func (Api) ConfirmEmail ΒΆ

func (a Api) ConfirmEmail(confirmationId string) (ConfirmedEmailResponse, error)

func (*Api) ConfirmLogin ΒΆ

func (a *Api) ConfirmLogin(confirmationId string) (TokenResponse, error)

func (Api) CreateChannel ΒΆ

func (a Api) CreateChannel(req CreateChannelRequest) (Channel, error)

func (Api) CreateDevice ΒΆ

func (a Api) CreateDevice(req CreateDeviceRequest) (DeviceResponse, error)

func (Api) CreateMessage ΒΆ

func (a Api) CreateMessage(channel Channel, req CreateMessageRequest) (Message, error)

func (Api) GetChannel ΒΆ

func (a Api) GetChannel(id string) (Channel, error)

func (Api) Hello ΒΆ

func (a Api) Hello() error

func (Api) LoggedIn ΒΆ

func (a Api) LoggedIn() bool

func (Api) Login ΒΆ

func (a Api) Login(email string) (LoginAttemptResponse, error)

func (*Api) Logout ΒΆ

func (a *Api) Logout() error

func (Api) MessagesOfAllChannels ΒΆ

func (a Api) MessagesOfAllChannels() ([]Message, error)

func (Api) MessagesOfChannel ΒΆ

func (a Api) MessagesOfChannel(channel Channel) ([]Message, error)

func (Api) OwnChannels ΒΆ

func (a Api) OwnChannels() ([]Channel, error)

func (Api) Profile ΒΆ

func (a Api) Profile() (User, error)

func (Api) PublicNotify ΒΆ

func (a Api) PublicNotify(notifyKey string, req CreateMessageRequest) (NotifyMessageResponse, error)

func (*Api) Register ΒΆ

func (a *Api) Register(email string) (TokenResponse, error)

func (*Api) SetToken ΒΆ

func (a *Api) SetToken(token string) error

func (Api) SharedChannels ΒΆ

func (a Api) SharedChannels() ([]Channel, error)

func (Api) SubscribeToChannel ΒΆ

func (a Api) SubscribeToChannel(req CreateSubscriptionRequest) (Channel, error)

func (Api) UnsubscribeChannel ΒΆ

func (a Api) UnsubscribeChannel(id string) (SubscribedChannelDeletedResponse, error)

func (Api) UpdateChannel ΒΆ

func (a Api) UpdateChannel(id string, req UpdateSubscriptionRequest) (Channel, error)

func (Api) UpdateDevice ΒΆ

func (a Api) UpdateDevice(id string, req UpdateDeviceRequest) (DeviceResponse, error)

func (Api) UpdateProfile ΒΆ

func (a Api) UpdateProfile(req UpdateProfileRequest) (User, error)

type Channel ΒΆ

type Channel = SubscribedChannelResponse

type ConfirmedEmailResponse ΒΆ

type ConfirmedEmailResponse struct{}

type CreateChannelRequest ΒΆ

type CreateChannelRequest struct {
	Title    string `json:"title"`
	IsSilent bool   `json:"isSilent"`
}

type CreateDeviceRequest ΒΆ

type CreateDeviceRequest struct {
	Token        string `json:"token"`
	IsProduction bool   `json:"isProduction"`
}

type CreateMessageRequest ΒΆ

type CreateMessageRequest struct {
	Title string `json:"title"`
	Body  string `json:"body"`
	Color string `json:"color"`
}

type CreateSubscriptionRequest ΒΆ

type CreateSubscriptionRequest struct {
	ReceiveOrNotifyKey string `json:"receiveOrNotifyKey"`
	IsSilent           bool   `json:"isSilent"`
}

type CreateUserRequest ΒΆ

type CreateUserRequest struct {
	Email *string `json:"email"`
}

type DeviceResponse ΒΆ

type DeviceResponse struct {
	ID           string `json:"id"`
	Token        string `json:"token"`
	IsProduction bool   `json:"isProduction"`
}

type LoginAttemptResponse ΒΆ

type LoginAttemptResponse struct{}

type LoginUserRequest ΒΆ

type LoginUserRequest struct {
	Email string `json:"email"`
}

type Message ΒΆ

type Message = MessageResponse

type MessageResponse ΒΆ

type MessageResponse struct {
	Body      string `json:"body"`
	CreatedAt string `json:"createdAt"`
	ColorName string `json:"colorName"`
	ID        string `json:"id"`
	Title     string `json:"title"`
	Channel   string `json:"channel"`
}

type NotifyMessageResponse ΒΆ

type NotifyMessageResponse struct {
	Body      string `json:"body"`
	CreatedAt string `json:"createdAt"`
	Color     string `json:"color"`
	ID        string `json:"id"`
	Title     string `json:"title"`
}

type SubscribedChannelDeletedResponse ΒΆ

type SubscribedChannelDeletedResponse struct{}

type SubscribedChannelResponse ΒΆ

type SubscribedChannelResponse struct {
	Id             string  `json:"id"`
	Title          string  `json:"title"`
	IsSilent       bool    `json:"isSilent"`
	ReceiveOnlyKey string  `json:"receiveOnlyKey"`
	NotifyKey      *string `json:"notifyKey"`
}

type SubscribedChannelStatisticsResponse ΒΆ

type SubscribedChannelStatisticsResponse struct {
	Notifiers int `json:"notifiers"`
	Receivers int `json:"receivers"`
	Messages  int `json:"messages"`
}

type TokenResponse ΒΆ

type TokenResponse struct {
	Token string `json:"token"`
	User  User   `json:"user"`
}

type UpdateDeviceRequest ΒΆ

type UpdateDeviceRequest struct {
	IsProduction bool `json:"isProduction"`
}

type UpdateProfileRequest ΒΆ

type UpdateProfileRequest struct {
	Email string `json:"email"`
}

type UpdateSubscriptionRequest ΒΆ

type UpdateSubscriptionRequest struct {
	IsSilent bool `json:"isSilent"`
}

type User ΒΆ

type User = UserResponse

type UserResponse ΒΆ

type UserResponse struct {
	ID          string `json:"id"`
	IsConfirmed bool   `json:"isConfirmed"`
	Email       string `json:"email"`
}

Directories ΒΆ

Path Synopsis
cmd
puffery command

Jump to

Keyboard shortcuts

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