buffer

package module
v0.0.0-...-c173422 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

README

buffer-go

A best effort attempt at implementing a Go client for the Buffer API. The API is very sparsely documented and the docs do not seem to be complete or accurate, so the quality of this client suffers as a result.

Other than that, it should work for the happy path of what I personally tested.

license

Apache v2.

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL  = "https://api.bufferapp.com"
	DefaultAuthURL  = DefaultBaseURL + "/oauth2/auth"
	DefaultTokenURL = DefaultBaseURL + "/oauth2/token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts *ClientConfig) (*Client, error)

func (*Client) Profiles

func (c *Client) Profiles() *ProfilesService

func (*Client) User

func (c *Client) User() *UserService

type ClientConfig

type ClientConfig struct {
	// Required
	ClientID     string
	ClientSecret string
	RedirectURL  string
	AccessToken  string

	BaseURL  *string
	AuthURL  *string
	TokenURL *string
}

type Daytime

type Daytime struct {
	time.Time
}

Daytime is a time during a day. The date does not matter, only the hours and minutes.

func (Daytime) MarshalJSON

func (dt Daytime) MarshalJSON() ([]byte, error)

func (*Daytime) UnmarshalJSON

func (dt *Daytime) UnmarshalJSON(p []byte) error

type Profile

type Profile struct {
	UnderscoreID         string `json:"_id"`
	Avatar               string `json:"avatar"`
	AvatarHTTPS          string `json:"avatar_https"`
	CanSeeContentLibrary bool   `json:"can_see_content_library"`
	Counts               struct {
		DailySuggestions int `json:"daily_suggestions"`
		Drafts           int `json:"drafts"`
		Reminders        int `json:"reminders"`
		Sent             int `json:"sent"`
		Pending          int `json:"pending"`
	} `json:"counts"`

	CreatedAt         UnixTime   `json:"created_at"`
	Default           bool       `json:"default"`
	Disabled          bool       `json:"disabled"`
	Disconnected      bool       `json:"disconnected"`
	FormattedService  string     `json:"formatted_service"`
	FormattedUsername string     `json:"formatted_username"`
	ID                string     `json:"id"`
	IsOnBusinessV2    bool       `json:"is_on_business_v2"`
	Locked            bool       `json:"locked"`
	Paused            bool       `json:"paused"`
	PausedSchedules   []Schedule `json:"paused_schedules"`
	Preferences       struct {
	} `json:"preferences"`
	Schedules       []Schedule `json:"schedules"`
	Service         string     `json:"service"`
	ServiceID       string     `json:"service_id"`
	ServiceType     string     `json:"service_type"`
	ServiceUsername string     `json:"service_username"`
	Shortener       struct {
		Domain string `json:"domain"`
	} `json:"shortener"`
	Statistics   *Statistics `json:"statistics"`
	Timezone     Timezone    `json:"timezone"`
	TimezoneCity string      `json:"timezone_city"`
	UserID       string      `json:"user_id"`
	UtmTracking  string      `json:"utm_tracking"`
	Verb         string      `json:"verb"`

	UnspecifiedCoverPhoto       interface{}   `json:"cover_photo"`
	UnspecifiedDisabledFeatures []interface{} `json:"disabled_features"`
}

type ProfilesService

type ProfilesService struct {
	// contains filtered or unexported fields
}

func (*ProfilesService) Deauthorize

func (us *ProfilesService) Deauthorize(ctx context.Context) (bool, error)

func (*ProfilesService) Get

func (us *ProfilesService) Get(ctx context.Context, id string) (*Profile, error)

func (*ProfilesService) List

func (us *ProfilesService) List(ctx context.Context) ([]Profile, error)

type Schedule

type Schedule struct {
	Days  []Weekday `json:"days"`
	Times []Daytime `json:"times"`
}

type Statistics

type Statistics struct {
	Followers int `json:"followers"`
}

type Timezone

type Timezone struct {
	*time.Location
}

Timezone is a timezone in the world.

func (Timezone) MarshalJSON

func (tz Timezone) MarshalJSON() ([]byte, error)

func (*Timezone) UnmarshalJSON

func (tz *Timezone) UnmarshalJSON(p []byte) error

type UnixTime

type UnixTime struct {
	time.Time
}

UnixTime is a time.Time that marshals and unmarshals to Unix time.

func (UnixTime) MarshalJSON

func (us UnixTime) MarshalJSON() ([]byte, error)

func (*UnixTime) UnmarshalJSON

func (us *UnixTime) UnmarshalJSON(p []byte) error

type User

type User struct {
	UnderscoreID       string   `json:"_id"`
	ActivityAt         UnixTime `json:"activity_at"`
	CreatedAt          UnixTime `json:"created_at"`
	ID                 string   `json:"id"`
	Name               string   `json:"name"`
	Plan               string   `json:"plan"`
	Timezone           Timezone `json:"timezone"`
	TwentyfourHourTime bool     `json:"twentyfour_hour_time"`
	WeekStartsMonday   bool     `json:"week_starts_monday"`

	UnspecifiedPabloPreferences []interface{} `json:"pablo_preferences"`
	UnspecifiedProfileGroups    []interface{} `json:"profile_groups"`
}

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

func (*UserService) Deauthorize

func (us *UserService) Deauthorize(ctx context.Context) (bool, error)

func (*UserService) Get

func (us *UserService) Get(ctx context.Context) (*User, error)

type Weekday

type Weekday struct {
	time.Weekday
}

Weekday as known to Buffer.

func (Weekday) MarshalJSON

func (wd Weekday) MarshalJSON() ([]byte, error)

func (*Weekday) UnmarshalJSON

func (wd *Weekday) UnmarshalJSON(p []byte) error

Directories

Path Synopsis
+build ignore +build ignore
+build ignore +build ignore

Jump to

Keyboard shortcuts

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