go_pastebin

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

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

Go to latest
Published: Jul 19, 2019 License: AGPL-3.0 Imports: 8 Imported by: 5

README

go_pastebin

go_pastebin is - as the name says - a libary for using Pastebin in Golang applications.


Installation

Thanks to the Go toolset the installation is very easy. Just type the following in your terminal and press Enter:

go get github.com/glaxx/go_pastebin

Afterwards you have to insert your API Developer Key in go_pastebin.go .

api_dev_key = "<your_key_here>"

You can aquire one here.


Documentation

Documentation for this libary can be found at godoc.

Documentation

Overview

  • Copyright (C) 2014 Stefan Luecke *
  • This program is free software: you can redistribute it and/or modify
  • it under the terms of the GNU Affero General Public License as published
  • by the Free Software Foundation, either version 3 of the License, or
  • (at your option) any later version. *
  • This program is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU Affero General Public License for more details. *
  • You should have received a copy of the GNU Affero General Public License
  • along with this program. If not, see <http://www.gnu.org/licenses/>. *
  • Authors: Stefan Luecke <glaxx@glaxx.net>

go_pastebin offers functions to interact with the Pastebin API, for further information check http://pastebin.com/api .

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Paste

type Paste struct {
	PasteKey         string
	PasteDate        time.Time
	PasteTitle       string
	PasteSize        int
	PasteExpireDate  time.Time
	PastePrivate     int
	PasteFormatLong  string
	PasteFormatShort string
	PasteURL         *url.URL
	PasteHits        int
}

Paste represents output structure from pastebin api

type Pastebin

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

Pastebin represents pastebin session

func NewPastebin

func NewPastebin(apiDevKey string) Pastebin

NewPastebin creates a new session and hold api keys

func (*Pastebin) DeletePaste

func (pb *Pastebin) DeletePaste(apiPasteKey string) (err error)

DeletePaste deletes a paste, which is referenced by the paste_key.

func (*Pastebin) GenerateUserSession

func (pb *Pastebin) GenerateUserSession(apiUsername, apiPassword string) (p *Pastebin, err error)

GenerateUserSession request (and returns) a Session key object, which is necessary for all user based tasks.

func (*Pastebin) ListPastes

func (pb *Pastebin) ListPastes(resultLimit int) (pastes []Paste, err error)

ListPastes request (and returns) an array of pastes, which are referenced by the user.

func (*Pastebin) ListTrendingPastes

func (pb *Pastebin) ListTrendingPastes() (pastes []Paste, err error)

ListTrendingPastes request (and returns) an array of trending pastes.

func (*Pastebin) Paste

func (pb *Pastebin) Paste(apiPasteCode, apiPasteName, apiPasteFormat, apiPasteExpire, apiPastePrivate string) (pasteURL *url.URL, err error)

Paste posts a text (paste) to Pastebin. If successfull this function will return a URL reference to the past and nil as error. format, expire and private should be set according to pastebin.com/api .

func (*Pastebin) PasteAnonymous

func (pb *Pastebin) PasteAnonymous(paste, title, format, expire, private string) (pasteURL *url.URL, err error)

PasteAnonymous posts a text (paste) to Pastebin. If successfull this function will return a URL reference to the past and nil as error. format, expire and private should be set according to pastebin.com/api .

func (*Pastebin) PasteAnonymousSimple

func (pb *Pastebin) PasteAnonymousSimple(apiPasteCode string) (pasteURL *url.URL, err error)

PasteAnonymousSimple posts a text (paste) to Pastebin. If successfull this function will return a URL reference to the past and nil as error. title, format, expire and private are defaulted by Pastebin.

func (*Pastebin) PasteSimple

func (pb *Pastebin) PasteSimple(apiPasteCode string) (pasteURL *url.URL, err error)

PasteSimple posts a text (paste) to Pastebin. If successfull this function will return a URL reference to the past and nil as error. title, format, expire and private are defaulted by Pastebin.

Jump to

Keyboard shortcuts

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