pastee

package module
v0.0.0-...-93c0d8b Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2019 License: ISC Imports: 10 Imported by: 0

README

Go-Pastee

An official, but incomplete API wrapper for Paste.ee API v1.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandStringBytesMaskImprSrc

func RandStringBytesMaskImprSrc(n int) string

Types

type AuthResponse

type AuthResponse struct {
	Success bool   `json:"success"`
	Key     string `json:"key"`
}

type Error

type Error struct {
	Field   string `json:"field"`
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type PaginationResponse

type PaginationResponse struct {
	Total           int    `json:"total"`
	PerPage         int    `json:"per_page"`
	CurrentPage     int    `json:"current_page"`
	LastPage        int    `json:"last_page"`
	NextPageURL     string `json:"next_page_url"`
	PreviousPageURL string `json:"prev_page_url"`
	From            int    `json:"from"`
	To              int    `json:"to"`
}

type Paste

type Paste struct {
	ID          string     `json:"id,omitempty"`
	Views       int        `json:"views,omitempty"`
	Encrypted   bool       `json:"encrypted,omitempty"`
	Description string     `json:"description,omitempty"`
	Sections    []*Section `json:"sections"`
	CreatedAt   time.Time  `json:"created_at"`
	ExpiresAt   time.Time  `json:"expires_at"`
}

type PasteGetOptions

type PasteGetOptions struct {
	Urls       bool   `url:"urls,omitempty"`
	TimeFormat string `url:"time_format,omitempty"`
	Key        string `url:"-"`
}

type PasteGetResponse

type PasteGetResponse struct {
	Success bool     `json:"success"`
	Errors  []*Error `json:"errors"`
	Paste   *Paste   `json:"paste"`
}

type PasteListOptions

type PasteListOptions struct {
	PerPage int `url:"perpage"`
	Page    int `url:"page,omitempty"`
}

type PasteListResponse

type PasteListResponse struct {
	*PaginationResponse

	Data []*Paste `json:"data"`
}

type PasteResponse

type PasteResponse struct {
	Success bool     `json:"success"`
	Errors  []*Error `json:"errors"`
	Key     string   `json:"-"`
	ID      string   `json:"id"`
	Link    string   `json:"link"`
}

type Pastee

type Pastee struct {
	ApiKey string
	Base   string
	Client *http.Client
}

func New

func New(key string) *Pastee

func (*Pastee) Authenticate

func (p *Pastee) Authenticate(username, password string) (*AuthResponse, error)

func (*Pastee) Get

func (p *Pastee) Get(id string, opts ...PasteGetOptions) (*Paste, error)

func (*Pastee) List

func (p *Pastee) List(opts ...PasteListOptions) (*PasteListResponse, error)

func (*Pastee) Submit

func (p *Pastee) Submit(paste *Paste) (*PasteResponse, error)

type Section

type Section struct {
	Name     string `json:"name,omitempty"`
	Syntax   string `json:"syntax,omitempty"`
	Contents string `json:"contents"`
	URL      string `json:"url"`
	Size     int    `json:"size"`
}

Directories

Path Synopsis
Package evpkdf implements OpenSSL EVP Key derivation function, aiming to be compatible with crypto-js default behaviour.
Package evpkdf implements OpenSSL EVP Key derivation function, aiming to be compatible with crypto-js default behaviour.

Jump to

Keyboard shortcuts

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