package module
v0.0.0-...-d5531f6 Latest Latest

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

Go to latest
Published: Mar 23, 2015 License: MIT Imports: 18 Imported by: 0



GoDoc Build Status

golang API for the oboom.com service


  • Add LoginWithHash() method
  • Add context
  • Add lock to BaseURL to prevent races (login/upload use different hosts)
  • Add tests for Upload()
  • Add Delete Call
  • Add Tree Call
  • Add map[name]id for FileSystem
  • Add Parent to Upload()
  • Add Mock for service for integration testing of FileSystem
  • Better timeout control



package goBoom implements clients for the oBoom API. Docs: https://www.oboom.com/api



This section is empty.


View Source
var (
	ErrUnknwonFourResponseType = errors.New("Can only handle three responses for InformationService.Ls()")


This section is empty.


type Client

type Client struct {
	User *UserService
	Info *InformationService
	FS   *FilesystemService
	// contains filtered or unexported fields

A Client manages communication with the oBoom API.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new REST API client. If a nil httpClient is provided, http.DefaultClient will be used.

func (*Client) NewHTTPFS

func (c *Client) NewHTTPFS() (*fsHandler, error)

NewHTTPFS returns a (net/http).FileSystem

type ErrStatusCodeMissmatch

type ErrStatusCodeMissmatch struct{ Http, Api int }

func (ErrStatusCodeMissmatch) Error

func (e ErrStatusCodeMissmatch) Error() string

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response // HTTP response that caused this error
	Body     string

An ErrorResponse reports one or more errors caused by an API request.

func (ErrorResponse) Error

func (r ErrorResponse) Error() string

type FilesystemService

type FilesystemService struct {
	// contains filtered or unexported fields

func (*FilesystemService) Download

func (s *FilesystemService) Download(item string) (*url.URL, error)

Download requests a download url for item

func (*FilesystemService) GetULServer

func (s *FilesystemService) GetULServer() ([]string, error)

func (*FilesystemService) Mkdir

func (s *FilesystemService) Mkdir(parent, name string) error

func (*FilesystemService) RawUpload

func (s *FilesystemService) RawUpload(parent, ct string, clen int64, multiBody io.Reader) ([]ItemStat, error)

RawUpload expects a multipart io.Reader and pushes it to the service

func (*FilesystemService) Rm

func (s *FilesystemService) Rm(toTrash bool, items ...string) error

func (*FilesystemService) Upload

func (s *FilesystemService) Upload(parent, fname string, input io.Reader) ([]ItemStat, error)

Upload pushes the input io.Reader to the service

type InformationService

type InformationService struct {
	// contains filtered or unexported fields

func (InformationService) Du

func (i InformationService) Du() (map[string]ItemSize, error)

func (InformationService) Info

func (i InformationService) Info(ids ...string) ([]ItemStat, error)

func (InformationService) Ls

func (i InformationService) Ls(item string) (*LsInfo, error)

func (*InformationService) Tree

func (i *InformationService) Tree(rev string) ([]ItemStat, map[string]string, error)

type ItemSize

type ItemSize struct {
	Num  int64 `json:"num"`
	Size int64 `json:"size"`

type ItemStat

type ItemStat struct {
	Atime     string `mapstructure:"atime"`
	Ctime     string `mapstructure:"ctime"`
	Downloads int64  `mapstructure:"downloads"`
	ID        string `mapstructure:"id"`
	Mtime     string `mapstructure:"mtime"`
	Iname     string `mapstructure:"name"`
	Parent    string `mapstructure:"parent"`
	Root      string `mapstructure:"root"`
	State     string `mapstructure:"state"`
	Type      string `mapstructure:"type"`
	User      int64  `mapstructure:"user"`
	Isize     int64  `mapstructure:"size"`
	DDL       bool   `mapstructure:"ddl"`
	Mime      string `mapstructure:"mime"`
	Owner     bool   `mapstructure:"owner"`

func (ItemStat) IsDir

func (i ItemStat) IsDir() bool

func (ItemStat) ModTime

func (i ItemStat) ModTime() time.Time

func (ItemStat) Mode

func (i ItemStat) Mode() os.FileMode

func (ItemStat) Name

func (i ItemStat) Name() string

func (ItemStat) Size

func (i ItemStat) Size() int64

func (ItemStat) Sys

func (i ItemStat) Sys() interface{}

type LsInfo

type LsInfo struct {
	Pwd   ItemStat
	Items []ItemStat

type UserService

type UserService struct {
	// contains filtered or unexported fields

func (*UserService) Login

func (u *UserService) Login(name, passw string) (*loginResponse, error)

Login sends a login request to the service with name and passw as credentials



  • reload map, add lock and subscribe to changes


Path Synopsis

Jump to

Keyboard shortcuts

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