api

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: GPL-2.0, GPL-2.0-or-later Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	S_DEFAULT                 = iota // 0
	S_NOT_LOGIN                      // 1
	S_WRONG_USERNAME_PASSWORD        // 2
	S_WRONG_CAPTCHA                  // 3
	S_NEED_CAPTCHA                   // 4
	S_NOT_OPEN_REGISTER              // 4
)

状态

Variables

This section is empty.

Functions

func AuthInterceptor

func AuthInterceptor(c *revel.Controller) revel.Result

这里得到token, 若不是login, logout等公用操作, 必须验证是否已登录

func InitService

func InitService()

最外层init.go调用 获取service, 单例

Types

type ApiAuth

type ApiAuth struct {
	ApiBaseContrller
}

func (ApiAuth) Login

func (c ApiAuth) Login(email, pwd string) revel.Result

登录 [ok] 成功返回 {Ok: true, Item: token } 失败返回 {Ok: false, Msg: ""}

func (ApiAuth) Logout

func (c ApiAuth) Logout() revel.Result

注销 [Ok]

func (ApiAuth) Register

func (c ApiAuth) Register(email, pwd string) revel.Result

注册 [Ok] 成功后并不返回用户ID, 需要用户重新登录

type ApiBaseContrller

type ApiBaseContrller struct {
	controllers.BaseController // 不能用*BaseController
}

公用Controller, 其它Controller继承它

type ApiFile

type ApiFile struct {
	ApiBaseContrller
}

func (ApiFile) GetAllAttachs

func (c ApiFile) GetAllAttachs(noteId string) revel.Result

下载所有附件 [OK]

func (ApiFile) GetAttach

func (c ApiFile) GetAttach(fileId string) revel.Result

下载附件 [OK]

func (ApiFile) GetImage

func (c ApiFile) GetImage(fileId string) revel.Result

输出image [OK]

type ApiNote

type ApiNote struct {
	ApiBaseContrller
}

func (ApiNote) AddNote

func (c ApiNote) AddNote(noteOrContent info.ApiNote) revel.Result

添加笔记 [OK]

func (ApiNote) DeleteTrash

func (c ApiNote) DeleteTrash(noteId string, usn int) revel.Result

删除trash

func (ApiNote) ExportPdf

func (c ApiNote) ExportPdf(noteId string) revel.Result

0.2 新增 导出成PDF

func (ApiNote) GetNote

func (c ApiNote) GetNote(noteId string) revel.Result

get Note [OK]

{
  "NoteId": "550c0bee2ec82a2eb5000000",
  "NotebookId": "54a1676399c37b1c77000004",
  "UserId": "54a1676399c37b1c77000002",
  "Title": "asdfadsf--=",
  "Desc": "",
  "Tags": [
  ],
  "Abstract": "",
  "Content": "",
  "IsMarkdown": false,
  "IsBlog": false,
  "IsTrash": false,
  "Usn": 8,
  "Files": [
    {
      "FileId": "551975d599c37b970f000000",
      "LocalFileId": "",
      "Type": "",
      "Title": "",
      "HasBody": false,
      "IsAttach": false
    },
    {
      "FileId": "551975de99c37b970f000001",
      "LocalFileId": "",
      "Type": "doc",
      "Title": "李铁-print-en.doc",
      "HasBody": false,
      "IsAttach": true
    },
    {
      "FileId": "551975de99c37b970f000002",
      "LocalFileId": "",
      "Type": "doc",
      "Title": "李铁-print.doc",
      "HasBody": false,
      "IsAttach": true
    }
  ],
  "CreatedTime": "2015-03-20T20:00:52.463+08:00",
  "UpdatedTime": "2015-03-31T00:12:44.967+08:00",
  "PublicTime": "2015-03-20T20:00:52.463+08:00"
}

func (ApiNote) GetNoteAndContent

func (c ApiNote) GetNoteAndContent(noteId string) revel.Result

得到note和内容 [OK]

func (ApiNote) GetNoteContent

func (c ApiNote) GetNoteContent(noteId string) revel.Result

得到内容

func (ApiNote) GetNotes

func (c ApiNote) GetNotes(notebookId string) revel.Result

得到笔记本下的笔记 [OK]

func (ApiNote) GetSyncNotes

func (c ApiNote) GetSyncNotes(afterUsn, maxEntry int) revel.Result

获取同步的笔记 > afterUsn的笔记 无Desc, Abstract, 有Files

{
  "NoteId": "55195fa199c37b79be000005",
  "NotebookId": "55195fa199c37b79be000002",
  "UserId": "55195fa199c37b79be000001",
  "Title": "Leanote语法Leanote语法Leanote语法Leanote语法Leanote语法",
  "Desc": "",
  "Tags": null,
  "Abstract": "",
  "Content": "",
  "IsMarkdown": true,
  "IsBlog": false,
  "IsTrash": false,
  "Usn": 5,
  "Files": [],
  "CreatedTime": "2015-03-30T22:37:21.695+08:00",
  "UpdatedTime": "2015-03-30T22:37:21.724+08:00",
  "PublicTime": "2015-03-30T22:37:21.695+08:00"
}

func (ApiNote) GetTrashNotes

func (c ApiNote) GetTrashNotes() revel.Result

得到trash [OK]

func (ApiNote) UpdateNote

func (c ApiNote) UpdateNote(noteOrContent info.ApiNote) revel.Result

更新笔记 [OK]

type ApiNotebook

type ApiNotebook struct {
	ApiBaseContrller
}

func (ApiNotebook) AddNotebook

func (c ApiNotebook) AddNotebook(title, parentNotebookId string, seq int) revel.Result

添加notebook [OK]

func (ApiNotebook) DeleteNotebook

func (c ApiNotebook) DeleteNotebook(notebookId string, usn int) revel.Result

删除笔记本 [OK]

func (ApiNotebook) GetNotebooks

func (c ApiNotebook) GetNotebooks() revel.Result

得到用户的所有笔记本 [OK] info.SubNotebooks

func (ApiNotebook) GetSyncNotebooks

func (c ApiNotebook) GetSyncNotebooks(afterUsn, maxEntry int) revel.Result

获取同步的笔记本 [OK] > afterUsn的笔记 返回 {ChunkHighUsn: 本下最大的usn, 借此可以知道是否还有, Notebooks: []}

func (ApiNotebook) UpdateNotebook

func (c ApiNotebook) UpdateNotebook(notebookId, title, parentNotebookId string, seq, usn int) revel.Result

修改笔记 [OK]

type ApiTag

type ApiTag struct {
	ApiBaseContrller
}

func (ApiTag) AddTag

func (c ApiTag) AddTag(tag string) revel.Result

添加Tag [OK] 不会产生冲突, 即使里面有 返回

{
  "TagId": "551978dd99c37b9bc5000001",
  "UserId": "54a1676399c37b1c77000002",
  "Tag": "32",
  "Usn": 25,
  "Count": 1,
  "CreatedTime": "2015-03-31T00:25:01.149312407+08:00",
  "UpdatedTime": "2015-03-31T00:25:01.149312407+08:00",
  "IsDeleted": false
}

func (ApiTag) DeleteTag

func (c ApiTag) DeleteTag(tag string, usn int) revel.Result

删除标签 [OK]

func (ApiTag) GetSyncTags

func (c ApiTag) GetSyncTags(afterUsn, maxEntry int) revel.Result

获取同步的标签 [OK] > afterUsn的笔记 返回 {ChunkHighUsn: 本下最大的usn, 借此可以知道是否还有, Notebooks: []}

type ApiUser

type ApiUser struct {
	ApiBaseContrller
}

func (ApiUser) GetSyncState

func (c ApiUser) GetSyncState() revel.Result

获得同步状态 [OK]

func (ApiUser) Info

func (c ApiUser) Info() revel.Result

获取用户信息 [OK]

func (c ApiUser) UpdateLogo() revel.Result

头像设置 参数file=文件 成功返回{Logo: url} 头像新url [OK]

func (ApiUser) UpdatePwd

func (c ApiUser) UpdatePwd(oldPwd, pwd string) revel.Result

修改密码 [OK]

func (ApiUser) UpdateUsername

func (c ApiUser) UpdateUsername(username string) revel.Result

修改用户名 [OK]

Jump to

Keyboard shortcuts

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