{"modulePath":"github.com/dNote/dnote","version":"v0.6.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package client\n\nPackage client provides interfaces for interacting with the Dnote server and the data structures for responses\n\n## Variables\n\n```go\nvar ErrInvalidLogin = errors.New(\"wrong credentials\")\n```\nErrInvalidLogin is an error for invalid credentials for login\n\n## Functions\n\n```go\nfunc Signout(ctx infra.DnoteCtx, sessionKey string) error\n```\nSignout deletes a user session on the server side\n\n## Types\n\n```go\ntype CreateBookPayload struct {\n\tName string `json:\"name\"`\n}\n```\nCreateBookPayload is a payload for creating a book\n\n```go\ntype CreateBookResp struct {\n\tBook RespBook `json:\"book\"`\n}\n```\nCreateBookResp is the response from create book api\n\n```go\nfunc CreateBook(ctx infra.DnoteCtx, label string) (CreateBookResp, error)\n```\nCreateBook creates a new book in the server\n\n```go\ntype CreateNotePayload struct {\n\tBookUUID string `json:\"book_uuid\"`\n\tBody     string `json:\"content\"`\n}\n```\nCreateNotePayload is a payload for creating a note\n\n```go\ntype CreateNoteResp struct {\n\tResult RespNote `json:\"result\"`\n}\n```\nCreateNoteResp is the response from create note endpoint\n\n```go\nfunc CreateNote(ctx infra.DnoteCtx, bookUUID, content string) (CreateNoteResp, error)\n```\nCreateNote creates a note in the server\n\n```go\ntype DeleteBookResp struct {\n\tStatus int      `json:\"status\"`\n\tBook   RespBook `json:\"book\"`\n}\n```\nDeleteBookResp is the response from create book api\n\n```go\nfunc DeleteBook(ctx infra.DnoteCtx, uuid string) (DeleteBookResp, error)\n```\nDeleteBook deletes a book in the server\n\n```go\ntype DeleteNoteResp struct {\n\tStatus int      `json:\"status\"`\n\tResult RespNote `json:\"result\"`\n}\n```\nDeleteNoteResp is the response from remove note api\n\n```go\nfunc DeleteNote(ctx infra.DnoteCtx, uuid string) (DeleteNoteResp, error)\n```\nDeleteNote removes a note in the server\n\n```go\ntype GetBooksResp []struct {\n\tUUID  string `json:\"uuid\"`\n\tLabel string `json:\"label\"`\n}\n```\nGetBooksResp is a response from get books endpoint\n\n```go\nfunc GetBooks(ctx infra.DnoteCtx, sessionKey string) (GetBooksResp, error)\n```\nGetBooks gets books from the server\n\n```go\ntype GetSyncFragmentResp struct {\n\tFragment SyncFragment `json:\"fragment\"`\n}\n```\nGetSyncFragmentResp is the response from the get sync fragment endpoint\n\n```go\nfunc GetSyncFragment(ctx infra.DnoteCtx, afterUSN int) (GetSyncFragmentResp, error)\n```\nGetSyncFragment gets a sync fragment response from the server\n\n```go\ntype GetSyncStateResp struct {\n\tFullSyncBefore int   `json:\"full_sync_before\"`\n\tMaxUSN         int   `json:\"max_usn\"`\n\tCurrentTime    int64 `json:\"current_time\"`\n}\n```\nGetSyncStateResp is the response get sync state endpoint\n\n```go\nfunc GetSyncState(ctx infra.DnoteCtx) (GetSyncStateResp, error)\n```\nGetSyncState gets the sync state response from the server\n\n```go\ntype PresigninResponse struct {\n\tIteration int `json:\"iteration\"`\n}\n```\nPresigninResponse is a reponse from /v1/presignin endpoint\n\n```go\nfunc GetPresignin(ctx infra.DnoteCtx, email string) (PresigninResponse, error)\n```\nGetPresignin gets presignin credentials\n\n```go\ntype RespBook struct {\n\tID        int       `json:\"id\"`\n\tUUID      string    `json:\"uuid\"`\n\tUSN       int       `json:\"usn\"`\n\tCreatedAt time.Time `json:\"created_at\"`\n\tUpdatedAt time.Time `json:\"updated_at\"`\n\tLabel     string    `json:\"label\"`\n}\n```\nRespBook is the book in the response from the create book api\n\n```go\ntype RespNote struct {\n\tUUID      string       `json:\"uuid\"`\n\tCreatedAt time.Time    `json:\"created_at\"`\n\tUpdatedAt time.Time    `json:\"updated_at\"`\n\tBody      string       `json:\"content\"`\n\tAddedOn   int64        `json:\"added_on\"`\n\tPublic    bool         `json:\"public\"`\n\tUSN       int          `json:\"usn\"`\n\tBook      respNoteBook `json:\"book\"`\n\tUser      respNoteUser `json:\"user\"`\n}\n```\nRespNote is a note in the response\n\n```go\ntype SigninPayload struct {\n\tEmail   string `json:\"email\"`\n\tAuthKey string `json:\"auth_key\"`\n}\n```\nSigninPayload is a payload for /v1/signin\n\n```go\ntype SigninResponse struct {\n\tKey          string `json:\"key\"`\n\tExpiresAt    int64  `json:\"expires_at\"`\n\tCipherKeyEnc string `json:\"cipher_key_enc\"`\n}\n```\nSigninResponse is a response from /v1/signin endpoint\n\n```go\nfunc Signin(ctx infra.DnoteCtx, email, authKey string) (SigninResponse, error)\n```\nSignin requests a session token\n\n```go\ntype SyncFragBook struct {\n\tUUID      string    `json:\"uuid\"`\n\tUSN       int       `json:\"usn\"`\n\tCreatedAt time.Time `json:\"created_at\"`\n\tUpdatedAt time.Time `json:\"updated_at\"`\n\tAddedOn   int64     `json:\"added_on\"`\n\tLabel     string    `json:\"label\"`\n\tDeleted   bool      `json:\"deleted\"`\n}\n```\nSyncFragBook represents a book in a sync fragment and contains only the necessary information for the client to sync the note locally\n\n```go\ntype SyncFragNote struct {\n\tUUID      string    `json:\"uuid\"`\n\tBookUUID  string    `json:\"book_uuid\"`\n\tUSN       int       `json:\"usn\"`\n\tCreatedAt time.Time `json:\"created_at\"`\n\tUpdatedAt time.Time `json:\"updated_at\"`\n\tAddedOn   int64     `json:\"added_on\"`\n\tEditedOn  int64     `json:\"edited_on\"`\n\tBody      string    `json:\"content\"`\n\tPublic    bool      `json:\"public\"`\n\tDeleted   bool      `json:\"deleted\"`\n}\n```\nSyncFragNote represents a note in a sync fragment and contains only the necessary information for the client to sync the note locally\n\n```go\ntype SyncFragment struct {\n\tFragMaxUSN    int            `json:\"frag_max_usn\"`\n\tUserMaxUSN    int            `json:\"user_max_usn\"`\n\tCurrentTime   int64          `json:\"current_time\"`\n\tNotes         []SyncFragNote `json:\"notes\"`\n\tBooks         []SyncFragBook `json:\"books\"`\n\tExpungedNotes []string       `json:\"expunged_notes\"`\n\tExpungedBooks []string       `json:\"expunged_books\"`\n}\n```\nSyncFragment contains a piece of information about the server's state.\n\n```go\ntype UpdateBookResp struct {\n\tBook RespBook `json:\"book\"`\n}\n```\nUpdateBookResp is the response from create book api\n\n```go\nfunc UpdateBook(ctx infra.DnoteCtx, label, uuid string) (UpdateBookResp, error)\n```\nUpdateBook updates a book in the server\n\n```go\ntype UpdateNoteResp struct {\n\tStatus int      `json:\"status\"`\n\tResult RespNote `json:\"result\"`\n}\n```\nUpdateNoteResp is the response from create book api\n\n```go\nfunc UpdateNote(ctx infra.DnoteCtx, uuid, bookUUID, content string, public bool) (UpdateNoteResp, error)\n```\nUpdateNote updates a note in the server\n\n","path":"github.com/dNote/dnote/client","name":"client","synopsis":"Package client provides interfaces for interacting with the Dnote server and the data structures for responses","isRedistributable":true}
