api

package
v0.0.0-...-c3f366e Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2015 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountAuth

type AccountAuth struct {
	Ok       bool   `json:"ok"`
	Token    string `json:"token"`
	UserID   string `json:"userID"`
	Email    string `json:"email"`
	Username string `json:"username"`
}

type AuthService

type AuthService interface {
	Login(*config.Config) error
	Logout() error
	Register(*config.Config) error
}

type AuthServiceOp

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

func (AuthServiceOp) Login

func (s AuthServiceOp) Login(conf *config.Config) error

func (AuthServiceOp) Logout

func (s AuthServiceOp) Logout() error

func (AuthServiceOp) Register

func (s AuthServiceOp) Register(conf *config.Config) error

type Client

type Client struct {
	APIHost  string
	Username string

	Account   AccountAuth
	Auth      AuthService
	Notes     NotesService
	Notebooks NotebooksService
	Tags      TagsService
	User      UserService
	Files     FilesService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(conf *config.Config) *Client

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)

Do performs an http.Request and optionally parses the response body into the given interface

func (*Client) NewRequest

func (c *Client) NewRequest(method, url string, body io.Reader) (*http.Request, error)

type FilesService

type FilesService interface {
	GetImage(string) error
	GetAttach(string) error
	GetAllAttachs(string) error
}

type FilesServiceOp

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

func (FilesServiceOp) GetAllAttachs

func (s FilesServiceOp) GetAllAttachs(noteId string) error

func (FilesServiceOp) GetAttach

func (s FilesServiceOp) GetAttach(fileId string) error

func (FilesServiceOp) GetImage

func (s FilesServiceOp) GetImage(fileId string) error

type Note

type Note struct {
	NoteId      string     `json:"NoteId"`
	NotebookId  string     `json:"NotebookId"`
	UserId      string     `json:"UserId"`
	Title       string     `json:"Title"`
	Tags        []string   `json:"Tags"`
	Content     string     `json:"Content"`
	IsMarkdown  bool       `json:"IsMarkdown"`
	IsBlog      bool       `json:"IsBlog"`
	IsTrash     bool       `json:"IsBlog"`
	Files       []NoteFile `json:"Files"`
	CreatedTime time.Time  `json:"CreatedTime"`
	UpdatedTime time.Time  `json:"UpdateTime"`
	PublicTime  time.Time  `json:"PublicTime"`
	Usn         int        `json:"Usn"`
}

type NoteFile

type NoteFile struct {
	FileId      string `json:"FileId"`
	LocalFileId string `json:"LocalFileId"`
	Type        string `json:"Type"`
	Title       string `json:"Title"`
	HasBody     bool   `json:"HasBody"`
	IsAttach    bool   `json:"IsAttach"`
}

type Notebook

type Notebook struct {
	CreatedTime      string `json:"CreatedTime"`
	IsBlog           bool   `json:"IsBlog"`
	IsDeleted        bool   `json:"IsDeleted"`
	NotebookId       string `json:"NotebookId"`
	ParentNotebookId string `json:"ParentNotebookId"`
	Seq              int    `json:"Seq"`
	Title            string `json:"Title"`
	UpdatedTime      string `json:"UpdatedTime"`
	UrlTitle         string `json:"UrlTitle"`
	UserId           string `json:"UserId"`
	Usn              int    `json:"Usn"`
}

type NotebooksService

type NotebooksService interface {
	AddNotebook(string, string, int) (*Notebook, error)
	DeleteNotebook(string, int) error
	UpdateNotebook(string, string, string, int) (*Notebook, error)
	GetNotebooks() ([]Notebook, error)
	GetNotebook(string) (*Notebook, error)
	GetSyncNotebooks(int, int) ([]Notebook, error)
}

type NotebooksServiceOp

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

func (NotebooksServiceOp) AddNotebook

func (s NotebooksServiceOp) AddNotebook(title string, parentId string, seq int) (*Notebook, error)

func (NotebooksServiceOp) DeleteNotebook

func (s NotebooksServiceOp) DeleteNotebook(notebookId string, usn int) error

func (NotebooksServiceOp) GetNotebook

func (s NotebooksServiceOp) GetNotebook(notebookId string) (*Notebook, error)

func (NotebooksServiceOp) GetNotebooks

func (s NotebooksServiceOp) GetNotebooks() ([]Notebook, error)

func (NotebooksServiceOp) GetSyncNotebooks

func (s NotebooksServiceOp) GetSyncNotebooks(afterUsn, maxEntry int) ([]Notebook, error)

func (NotebooksServiceOp) UpdateNotebook

func (s NotebooksServiceOp) UpdateNotebook(notebookId string, title string, parentId string, seq int) (*Notebook, error)

type NotesService

type NotesService interface {
	GetNotes() ([]Note, error)
	GetNoteAndContent(string) (*Note, error)
	NotesFromNotebook(string) ([]Note, error)
	GetSyncNotes(int, int) ([]Note, error)
}

type NotesServiceOp

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

func (NotesServiceOp) GetNoteAndContent

func (s NotesServiceOp) GetNoteAndContent(noteId string) (*Note, error)

func (NotesServiceOp) GetNotes

func (s NotesServiceOp) GetNotes() ([]Note, error)

func (NotesServiceOp) GetSyncNotes

func (s NotesServiceOp) GetSyncNotes(afterUsn, maxEntry int) ([]Note, error)

func (NotesServiceOp) NotesFromNotebook

func (s NotesServiceOp) NotesFromNotebook(notebookId string) ([]Note, error)

type ReUpdate

type ReUpdate struct {
	Ok  bool   `json:"Ok"`
	Msg string `json:"Msg"`
	Usn int    `json:"Usn"`
}

type SyncState

type SyncState struct {
	Usn  int `json:"LastSyncUsn"`
	Time int `json:"LastSyncTime"`
}

type Tag

type Tag struct {
	TagId       string `json:"TagId"`
	UserId      string `json:"UserId"`
	Title       string `json:"Tag"`
	CreatedTime string `json:"CreatedTime"`
	UpdatedTime string `json:"UpdatedTime"`
	IsDeleted   bool   `json:"IsDeleted"`
	Usn         int    `json:"Usn"`
}

type TagsService

type TagsService interface {
	GetSyncTags(int, int) ([]Tag, error)
	AddTag(string) (*Tag, error)
	DeleteTag(string) (*ReUpdate, error)
}

type TagsServiceOp

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

func (TagsServiceOp) AddTag

func (s TagsServiceOp) AddTag(tag string) (*Tag, error)

func (TagsServiceOp) DeleteTag

func (s TagsServiceOp) DeleteTag(tag string) (*ReUpdate, error)

func (TagsServiceOp) GetSyncTags

func (s TagsServiceOp) GetSyncTags(afterUsn, maxEntry int) ([]Tag, error)

type User

type User struct {
	Id       string `json:"UserId"`
	Name     string `json:"Username"`
	Email    string `json:"Email"`
	Verified bool   `json:"Verified"`
}

type UserService

type UserService interface {
	Info() (*User, error)
	UpdatePwd(string, string) error
	UpdateUsername(string) error
	GetSyncState() (*SyncState, error)
}

type UserServiceOp

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

func (UserServiceOp) GetSyncState

func (s UserServiceOp) GetSyncState() (*SyncState, error)

func (UserServiceOp) Info

func (s UserServiceOp) Info() (*User, error)
func (s UserServiceOp) UpdateLogo(path string) error

func (UserServiceOp) UpdatePwd

func (s UserServiceOp) UpdatePwd(oldPwd, newPwd string) error

func (UserServiceOp) UpdateUsername

func (s UserServiceOp) UpdateUsername(name string) error

Jump to

Keyboard shortcuts

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