diff options
Diffstat (limited to 'internal/api/api.go')
| -rw-r--r-- | internal/api/api.go | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/internal/api/api.go b/internal/api/api.go deleted file mode 100644 index 6c9ab3a..0000000 --- a/internal/api/api.go +++ /dev/null @@ -1,70 +0,0 @@ -// Package api contains type definitions for the gob API. -package api - -import "encoding/gob" - -type ErrorCode int - -//go:generate go tool stringer -type=ErrorCode -const ( - Ok ErrorCode = iota - Unauthenticated // missing credentials - PermissionDenied // invalid credentials, or login required - BadRequest // incorrect request format (try gob) - InvalidArgument // one or more arguments was invalid - NotFound // requested resource was not found - Internal // server encountered an unexpected error -) - -func (c ErrorCode) Error() string { - return c.String() -} - -type Response struct { - Status ErrorCode - Err string - Ok any -} - -type LoginResponse struct { - Token string -} - -type ListNotesRequest struct{} - -type ListNotesResponse struct { - Notes []string -} - -type CreateNoteRequest struct { - ContinuationToken []byte - FileName string - Chunk []byte - More bool -} - -type CreateNoteResponse struct { - Name string - ContinuationToken []byte -} - -type ReadNoteRequest struct { - Note string -} - -type ReadNoteResponseStream struct { - FileName string - Chunk []byte -} - -type DeleteNoteRequest struct{} - -type DeleteNoteResponse struct{} - -func init() { - gob.Register(&LoginResponse{}) - gob.Register(&ListNotesResponse{}) - gob.Register(&CreateNoteResponse{}) - gob.Register(&ReadNoteResponseStream{}) - gob.Register(&DeleteNoteResponse{}) -} |
