pebble

package module
v0.0.0-...-3b009be Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2015 License: MIT Imports: 5 Imported by: 2

README

go-pebble Build Status

Interacting with the Pebble's timeline in Go.

Setup
go get -u github.com/janekolszak/go-pebble
Test
go test github.com/janekolszak/go-pebble
Example
package main

import (
    "fmt"
    "github.com/janekolszak/go-pebble"
    "net/http"
)

func main() {
    layout := pebble.Layout{
        Type:     "genericPin",
        Title:    "Title",
        TinyIcon: "system://images/NOTIFICATION_FLAG",
        Body:     "Body",
    }

    creationLayout := pebble.Layout{
        Type:     "genericPin",
        Title:    "Creation Title",
        TinyIcon: "system://images/NOTIFICATION_FLAG",
        Body:     "Creation Body",
    }

    creationNotification := pebble.Notification{
        Layout: &creationLayout,
    }

    updateLayout := pebble.Layout{
        Type:     "genericPin",
        Title:    "Update Title",
        TinyIcon: "system://images/NOTIFICATION_FLAG",
        Body:     "Update Body",
    }

    updateNotification := pebble.Notification{
        Layout: &updateLayout,
        Time:   time.Now().Format(time.RFC3339),
    }

    reminderLayout := pebble.Layout{
        Type:     "genericReminder",
        Title:    "Reminder Title",
        TinyIcon: "system://images/NOTIFICATION_FLAG",
    }

    reminder := pebble.Reminder{
        Time:   time.Now().Format(time.RFC3339),
        Layout: &reminderLayout,
    }

    pin := pebble.Pin{
        Id:                 "UNIQUE ID",
        Time:               time.Now().Format(time.RFC3339),
        Layout:             &layout,
        CreateNotification: &creationNotification,
        UpdateNotification: &updateNotification,
        Reminders:          &pebble.Reminders{reminder},
    }

    uPin.userPin = pebble.UserPin{
        Pin:   pin,
        Token: "TOKEN",
    }

    fmt.Println(pin.String())


    client := &http.Client{
        CheckRedirect: redirectPolicyFunc,
    }
    uPin.Put(client)
    uPin.Delete(client)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Title      string `json:"title"`
	Type       string `json:"type"`
	LaunchCode int    `json:"launchCode"`
}

type Actions

type Actions []Action

type Error

type Error struct {
	ErrorCode string `json:"errorCode"`
}

type Layout

type Layout struct {
	Type            string   `json:"type"`
	Title           string   `json:"title"`
	TinyIcon        string   `json:"tinyIcon"`
	Body            string   `json:"body,omitempty"`
	PrimaryColor    string   `json:"primaryColor,omitempty"`
	SecondaryColor  string   `json:"secondaryColor,omitempty"`
	BackgroundColor string   `json:"backgroundColor,omitempty"`
	Headings        []string `json:"headings,omitempty"`
	Paragraphs      []string `json:"paragraphs,omitempty"`
	LastUpdated     string   `json:"lastUpdated,omitempty"`
}

type Notification

type Notification struct {
	Layout *Layout `json:"layout,omitempty"`
	Time   string  `json:"time,omitempty"`
}

type Pin

type Pin struct {
	Id                 string        `json:"id"`
	Time               string        `json:"time"`
	Layout             *Layout       `json:"layout"`
	Duration           int           `json:"duration,omitempty"`
	CreateNotification *Notification `json:"createNotification,omitempty"`
	UpdateNotification *Notification `json:"updateNotification,omitempty"`
	Reminders          *Reminders    `json:"reminders,omitempty"`
	Actions            *Actions      `json:"actions,omitempty"`
}

func (*Pin) String

func (pin *Pin) String() string

type Reminder

type Reminder struct {
	Time   string  `json:"time"`
	Layout *Layout `json:"layout"`
}

type Reminders

type Reminders []Reminder

type SharedPin

type SharedPin struct {
	Pin
	APIKey string
	Topics string
}

func (*SharedPin) Delete

func (sPin *SharedPin) Delete(client *http.Client) error

func (*SharedPin) Put

func (sPin *SharedPin) Put(client *http.Client) error

type UserPin

type UserPin struct {
	Pin
	Token string
}

func (*UserPin) Delete

func (uPin *UserPin) Delete(client *http.Client) error

func (*UserPin) Put

func (uPin *UserPin) Put(client *http.Client) error

Jump to

Keyboard shortcuts

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