Add GetNotebook RPC for pulling complete notebook data

New RPC returns notebook metadata, all pages, and all strokes for
a given server-side notebook ID. Enables desktop and other clients
to download notebooks from the server (pull sync).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 15:06:20 -07:00
parent 651eabe995
commit f1b67b9909
4 changed files with 340 additions and 78 deletions

View File

@@ -278,6 +278,134 @@ func (x *SyncNotebookResponse) GetSyncedAt() *timestamppb.Timestamp {
return nil return nil
} }
type GetNotebookRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
NotebookId int64 `protobuf:"varint,1,opt,name=notebook_id,json=notebookId,proto3" json:"notebook_id,omitempty"` // Server-side notebook ID
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetNotebookRequest) Reset() {
*x = GetNotebookRequest{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetNotebookRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetNotebookRequest) ProtoMessage() {}
func (x *GetNotebookRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetNotebookRequest.ProtoReflect.Descriptor instead.
func (*GetNotebookRequest) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{4}
}
func (x *GetNotebookRequest) GetNotebookId() int64 {
if x != nil {
return x.NotebookId
}
return 0
}
type GetNotebookResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
ServerNotebookId int64 `protobuf:"varint,1,opt,name=server_notebook_id,json=serverNotebookId,proto3" json:"server_notebook_id,omitempty"`
RemoteId int64 `protobuf:"varint,2,opt,name=remote_id,json=remoteId,proto3" json:"remote_id,omitempty"`
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
PageSize string `protobuf:"bytes,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
Pages []*PageData `protobuf:"bytes,5,rep,name=pages,proto3" json:"pages,omitempty"`
SyncedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=synced_at,json=syncedAt,proto3" json:"synced_at,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetNotebookResponse) Reset() {
*x = GetNotebookResponse{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetNotebookResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetNotebookResponse) ProtoMessage() {}
func (x *GetNotebookResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetNotebookResponse.ProtoReflect.Descriptor instead.
func (*GetNotebookResponse) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{5}
}
func (x *GetNotebookResponse) GetServerNotebookId() int64 {
if x != nil {
return x.ServerNotebookId
}
return 0
}
func (x *GetNotebookResponse) GetRemoteId() int64 {
if x != nil {
return x.RemoteId
}
return 0
}
func (x *GetNotebookResponse) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *GetNotebookResponse) GetPageSize() string {
if x != nil {
return x.PageSize
}
return ""
}
func (x *GetNotebookResponse) GetPages() []*PageData {
if x != nil {
return x.Pages
}
return nil
}
func (x *GetNotebookResponse) GetSyncedAt() *timestamppb.Timestamp {
if x != nil {
return x.SyncedAt
}
return nil
}
type DeleteNotebookRequest struct { type DeleteNotebookRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
NotebookId int64 `protobuf:"varint,1,opt,name=notebook_id,json=notebookId,proto3" json:"notebook_id,omitempty"` NotebookId int64 `protobuf:"varint,1,opt,name=notebook_id,json=notebookId,proto3" json:"notebook_id,omitempty"`
@@ -287,7 +415,7 @@ type DeleteNotebookRequest struct {
func (x *DeleteNotebookRequest) Reset() { func (x *DeleteNotebookRequest) Reset() {
*x = DeleteNotebookRequest{} *x = DeleteNotebookRequest{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[4] mi := &file_proto_engpad_v1_sync_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -299,7 +427,7 @@ func (x *DeleteNotebookRequest) String() string {
func (*DeleteNotebookRequest) ProtoMessage() {} func (*DeleteNotebookRequest) ProtoMessage() {}
func (x *DeleteNotebookRequest) ProtoReflect() protoreflect.Message { func (x *DeleteNotebookRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[4] mi := &file_proto_engpad_v1_sync_proto_msgTypes[6]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -312,7 +440,7 @@ func (x *DeleteNotebookRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteNotebookRequest.ProtoReflect.Descriptor instead. // Deprecated: Use DeleteNotebookRequest.ProtoReflect.Descriptor instead.
func (*DeleteNotebookRequest) Descriptor() ([]byte, []int) { func (*DeleteNotebookRequest) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{4} return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{6}
} }
func (x *DeleteNotebookRequest) GetNotebookId() int64 { func (x *DeleteNotebookRequest) GetNotebookId() int64 {
@@ -330,7 +458,7 @@ type DeleteNotebookResponse struct {
func (x *DeleteNotebookResponse) Reset() { func (x *DeleteNotebookResponse) Reset() {
*x = DeleteNotebookResponse{} *x = DeleteNotebookResponse{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[5] mi := &file_proto_engpad_v1_sync_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -342,7 +470,7 @@ func (x *DeleteNotebookResponse) String() string {
func (*DeleteNotebookResponse) ProtoMessage() {} func (*DeleteNotebookResponse) ProtoMessage() {}
func (x *DeleteNotebookResponse) ProtoReflect() protoreflect.Message { func (x *DeleteNotebookResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[5] mi := &file_proto_engpad_v1_sync_proto_msgTypes[7]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -355,7 +483,7 @@ func (x *DeleteNotebookResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteNotebookResponse.ProtoReflect.Descriptor instead. // Deprecated: Use DeleteNotebookResponse.ProtoReflect.Descriptor instead.
func (*DeleteNotebookResponse) Descriptor() ([]byte, []int) { func (*DeleteNotebookResponse) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{5} return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{7}
} }
type ListNotebooksRequest struct { type ListNotebooksRequest struct {
@@ -366,7 +494,7 @@ type ListNotebooksRequest struct {
func (x *ListNotebooksRequest) Reset() { func (x *ListNotebooksRequest) Reset() {
*x = ListNotebooksRequest{} *x = ListNotebooksRequest{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[6] mi := &file_proto_engpad_v1_sync_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -378,7 +506,7 @@ func (x *ListNotebooksRequest) String() string {
func (*ListNotebooksRequest) ProtoMessage() {} func (*ListNotebooksRequest) ProtoMessage() {}
func (x *ListNotebooksRequest) ProtoReflect() protoreflect.Message { func (x *ListNotebooksRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[6] mi := &file_proto_engpad_v1_sync_proto_msgTypes[8]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -391,7 +519,7 @@ func (x *ListNotebooksRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListNotebooksRequest.ProtoReflect.Descriptor instead. // Deprecated: Use ListNotebooksRequest.ProtoReflect.Descriptor instead.
func (*ListNotebooksRequest) Descriptor() ([]byte, []int) { func (*ListNotebooksRequest) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{6} return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{8}
} }
type ListNotebooksResponse struct { type ListNotebooksResponse struct {
@@ -403,7 +531,7 @@ type ListNotebooksResponse struct {
func (x *ListNotebooksResponse) Reset() { func (x *ListNotebooksResponse) Reset() {
*x = ListNotebooksResponse{} *x = ListNotebooksResponse{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[7] mi := &file_proto_engpad_v1_sync_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -415,7 +543,7 @@ func (x *ListNotebooksResponse) String() string {
func (*ListNotebooksResponse) ProtoMessage() {} func (*ListNotebooksResponse) ProtoMessage() {}
func (x *ListNotebooksResponse) ProtoReflect() protoreflect.Message { func (x *ListNotebooksResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[7] mi := &file_proto_engpad_v1_sync_proto_msgTypes[9]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -428,7 +556,7 @@ func (x *ListNotebooksResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListNotebooksResponse.ProtoReflect.Descriptor instead. // Deprecated: Use ListNotebooksResponse.ProtoReflect.Descriptor instead.
func (*ListNotebooksResponse) Descriptor() ([]byte, []int) { func (*ListNotebooksResponse) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{7} return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{9}
} }
func (x *ListNotebooksResponse) GetNotebooks() []*NotebookSummary { func (x *ListNotebooksResponse) GetNotebooks() []*NotebookSummary {
@@ -452,7 +580,7 @@ type NotebookSummary struct {
func (x *NotebookSummary) Reset() { func (x *NotebookSummary) Reset() {
*x = NotebookSummary{} *x = NotebookSummary{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[8] mi := &file_proto_engpad_v1_sync_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -464,7 +592,7 @@ func (x *NotebookSummary) String() string {
func (*NotebookSummary) ProtoMessage() {} func (*NotebookSummary) ProtoMessage() {}
func (x *NotebookSummary) ProtoReflect() protoreflect.Message { func (x *NotebookSummary) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[8] mi := &file_proto_engpad_v1_sync_proto_msgTypes[10]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -477,7 +605,7 @@ func (x *NotebookSummary) ProtoReflect() protoreflect.Message {
// Deprecated: Use NotebookSummary.ProtoReflect.Descriptor instead. // Deprecated: Use NotebookSummary.ProtoReflect.Descriptor instead.
func (*NotebookSummary) Descriptor() ([]byte, []int) { func (*NotebookSummary) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{8} return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{10}
} }
func (x *NotebookSummary) GetServerId() int64 { func (x *NotebookSummary) GetServerId() int64 {
@@ -532,7 +660,7 @@ type CreateShareLinkRequest struct {
func (x *CreateShareLinkRequest) Reset() { func (x *CreateShareLinkRequest) Reset() {
*x = CreateShareLinkRequest{} *x = CreateShareLinkRequest{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[9] mi := &file_proto_engpad_v1_sync_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -544,7 +672,7 @@ func (x *CreateShareLinkRequest) String() string {
func (*CreateShareLinkRequest) ProtoMessage() {} func (*CreateShareLinkRequest) ProtoMessage() {}
func (x *CreateShareLinkRequest) ProtoReflect() protoreflect.Message { func (x *CreateShareLinkRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[9] mi := &file_proto_engpad_v1_sync_proto_msgTypes[11]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -557,7 +685,7 @@ func (x *CreateShareLinkRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreateShareLinkRequest.ProtoReflect.Descriptor instead. // Deprecated: Use CreateShareLinkRequest.ProtoReflect.Descriptor instead.
func (*CreateShareLinkRequest) Descriptor() ([]byte, []int) { func (*CreateShareLinkRequest) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{9} return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{11}
} }
func (x *CreateShareLinkRequest) GetNotebookId() int64 { func (x *CreateShareLinkRequest) GetNotebookId() int64 {
@@ -585,7 +713,7 @@ type CreateShareLinkResponse struct {
func (x *CreateShareLinkResponse) Reset() { func (x *CreateShareLinkResponse) Reset() {
*x = CreateShareLinkResponse{} *x = CreateShareLinkResponse{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[10] mi := &file_proto_engpad_v1_sync_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -597,7 +725,7 @@ func (x *CreateShareLinkResponse) String() string {
func (*CreateShareLinkResponse) ProtoMessage() {} func (*CreateShareLinkResponse) ProtoMessage() {}
func (x *CreateShareLinkResponse) ProtoReflect() protoreflect.Message { func (x *CreateShareLinkResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[10] mi := &file_proto_engpad_v1_sync_proto_msgTypes[12]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -610,7 +738,7 @@ func (x *CreateShareLinkResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreateShareLinkResponse.ProtoReflect.Descriptor instead. // Deprecated: Use CreateShareLinkResponse.ProtoReflect.Descriptor instead.
func (*CreateShareLinkResponse) Descriptor() ([]byte, []int) { func (*CreateShareLinkResponse) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{10} return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{12}
} }
func (x *CreateShareLinkResponse) GetToken() string { func (x *CreateShareLinkResponse) GetToken() string {
@@ -643,7 +771,7 @@ type RevokeShareLinkRequest struct {
func (x *RevokeShareLinkRequest) Reset() { func (x *RevokeShareLinkRequest) Reset() {
*x = RevokeShareLinkRequest{} *x = RevokeShareLinkRequest{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[11] mi := &file_proto_engpad_v1_sync_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -655,7 +783,7 @@ func (x *RevokeShareLinkRequest) String() string {
func (*RevokeShareLinkRequest) ProtoMessage() {} func (*RevokeShareLinkRequest) ProtoMessage() {}
func (x *RevokeShareLinkRequest) ProtoReflect() protoreflect.Message { func (x *RevokeShareLinkRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[11] mi := &file_proto_engpad_v1_sync_proto_msgTypes[13]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -668,7 +796,7 @@ func (x *RevokeShareLinkRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use RevokeShareLinkRequest.ProtoReflect.Descriptor instead. // Deprecated: Use RevokeShareLinkRequest.ProtoReflect.Descriptor instead.
func (*RevokeShareLinkRequest) Descriptor() ([]byte, []int) { func (*RevokeShareLinkRequest) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{11} return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{13}
} }
func (x *RevokeShareLinkRequest) GetToken() string { func (x *RevokeShareLinkRequest) GetToken() string {
@@ -686,7 +814,7 @@ type RevokeShareLinkResponse struct {
func (x *RevokeShareLinkResponse) Reset() { func (x *RevokeShareLinkResponse) Reset() {
*x = RevokeShareLinkResponse{} *x = RevokeShareLinkResponse{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[12] mi := &file_proto_engpad_v1_sync_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -698,7 +826,7 @@ func (x *RevokeShareLinkResponse) String() string {
func (*RevokeShareLinkResponse) ProtoMessage() {} func (*RevokeShareLinkResponse) ProtoMessage() {}
func (x *RevokeShareLinkResponse) ProtoReflect() protoreflect.Message { func (x *RevokeShareLinkResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[12] mi := &file_proto_engpad_v1_sync_proto_msgTypes[14]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -711,7 +839,7 @@ func (x *RevokeShareLinkResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use RevokeShareLinkResponse.ProtoReflect.Descriptor instead. // Deprecated: Use RevokeShareLinkResponse.ProtoReflect.Descriptor instead.
func (*RevokeShareLinkResponse) Descriptor() ([]byte, []int) { func (*RevokeShareLinkResponse) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{12} return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{14}
} }
type ListShareLinksRequest struct { type ListShareLinksRequest struct {
@@ -723,7 +851,7 @@ type ListShareLinksRequest struct {
func (x *ListShareLinksRequest) Reset() { func (x *ListShareLinksRequest) Reset() {
*x = ListShareLinksRequest{} *x = ListShareLinksRequest{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[13] mi := &file_proto_engpad_v1_sync_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -735,7 +863,7 @@ func (x *ListShareLinksRequest) String() string {
func (*ListShareLinksRequest) ProtoMessage() {} func (*ListShareLinksRequest) ProtoMessage() {}
func (x *ListShareLinksRequest) ProtoReflect() protoreflect.Message { func (x *ListShareLinksRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[13] mi := &file_proto_engpad_v1_sync_proto_msgTypes[15]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -748,7 +876,7 @@ func (x *ListShareLinksRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListShareLinksRequest.ProtoReflect.Descriptor instead. // Deprecated: Use ListShareLinksRequest.ProtoReflect.Descriptor instead.
func (*ListShareLinksRequest) Descriptor() ([]byte, []int) { func (*ListShareLinksRequest) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{13} return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{15}
} }
func (x *ListShareLinksRequest) GetNotebookId() int64 { func (x *ListShareLinksRequest) GetNotebookId() int64 {
@@ -767,7 +895,7 @@ type ListShareLinksResponse struct {
func (x *ListShareLinksResponse) Reset() { func (x *ListShareLinksResponse) Reset() {
*x = ListShareLinksResponse{} *x = ListShareLinksResponse{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[14] mi := &file_proto_engpad_v1_sync_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -779,7 +907,7 @@ func (x *ListShareLinksResponse) String() string {
func (*ListShareLinksResponse) ProtoMessage() {} func (*ListShareLinksResponse) ProtoMessage() {}
func (x *ListShareLinksResponse) ProtoReflect() protoreflect.Message { func (x *ListShareLinksResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[14] mi := &file_proto_engpad_v1_sync_proto_msgTypes[16]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -792,7 +920,7 @@ func (x *ListShareLinksResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListShareLinksResponse.ProtoReflect.Descriptor instead. // Deprecated: Use ListShareLinksResponse.ProtoReflect.Descriptor instead.
func (*ListShareLinksResponse) Descriptor() ([]byte, []int) { func (*ListShareLinksResponse) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{14} return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{16}
} }
func (x *ListShareLinksResponse) GetLinks() []*ShareLinkInfo { func (x *ListShareLinksResponse) GetLinks() []*ShareLinkInfo {
@@ -814,7 +942,7 @@ type ShareLinkInfo struct {
func (x *ShareLinkInfo) Reset() { func (x *ShareLinkInfo) Reset() {
*x = ShareLinkInfo{} *x = ShareLinkInfo{}
mi := &file_proto_engpad_v1_sync_proto_msgTypes[15] mi := &file_proto_engpad_v1_sync_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -826,7 +954,7 @@ func (x *ShareLinkInfo) String() string {
func (*ShareLinkInfo) ProtoMessage() {} func (*ShareLinkInfo) ProtoMessage() {}
func (x *ShareLinkInfo) ProtoReflect() protoreflect.Message { func (x *ShareLinkInfo) ProtoReflect() protoreflect.Message {
mi := &file_proto_engpad_v1_sync_proto_msgTypes[15] mi := &file_proto_engpad_v1_sync_proto_msgTypes[17]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -839,7 +967,7 @@ func (x *ShareLinkInfo) ProtoReflect() protoreflect.Message {
// Deprecated: Use ShareLinkInfo.ProtoReflect.Descriptor instead. // Deprecated: Use ShareLinkInfo.ProtoReflect.Descriptor instead.
func (*ShareLinkInfo) Descriptor() ([]byte, []int) { func (*ShareLinkInfo) Descriptor() ([]byte, []int) {
return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{15} return file_proto_engpad_v1_sync_proto_rawDescGZIP(), []int{17}
} }
func (x *ShareLinkInfo) GetToken() string { func (x *ShareLinkInfo) GetToken() string {
@@ -896,7 +1024,17 @@ const file_proto_engpad_v1_sync_proto_rawDesc = "" +
"\fstroke_order\x18\x05 \x01(\x05R\vstrokeOrder\"}\n" + "\fstroke_order\x18\x05 \x01(\x05R\vstrokeOrder\"}\n" +
"\x14SyncNotebookResponse\x12,\n" + "\x14SyncNotebookResponse\x12,\n" +
"\x12server_notebook_id\x18\x01 \x01(\x03R\x10serverNotebookId\x127\n" + "\x12server_notebook_id\x18\x01 \x01(\x03R\x10serverNotebookId\x127\n" +
"\tsynced_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\bsyncedAt\"8\n" + "\tsynced_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\bsyncedAt\"5\n" +
"\x12GetNotebookRequest\x12\x1f\n" +
"\vnotebook_id\x18\x01 \x01(\x03R\n" +
"notebookId\"\xf7\x01\n" +
"\x13GetNotebookResponse\x12,\n" +
"\x12server_notebook_id\x18\x01 \x01(\x03R\x10serverNotebookId\x12\x1b\n" +
"\tremote_id\x18\x02 \x01(\x03R\bremoteId\x12\x14\n" +
"\x05title\x18\x03 \x01(\tR\x05title\x12\x1b\n" +
"\tpage_size\x18\x04 \x01(\tR\bpageSize\x12)\n" +
"\x05pages\x18\x05 \x03(\v2\x13.engpad.v1.PageDataR\x05pages\x127\n" +
"\tsynced_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\bsyncedAt\"8\n" +
"\x15DeleteNotebookRequest\x12\x1f\n" + "\x15DeleteNotebookRequest\x12\x1f\n" +
"\vnotebook_id\x18\x01 \x01(\x03R\n" + "\vnotebook_id\x18\x01 \x01(\x03R\n" +
"notebookId\"\x18\n" + "notebookId\"\x18\n" +
@@ -935,9 +1073,10 @@ const file_proto_engpad_v1_sync_proto_rawDesc = "" +
"\n" + "\n" +
"created_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" + "created_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" +
"\n" + "\n" +
"expires_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt2\x9a\x04\n" + "expires_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt2\xe8\x04\n" +
"\x11EngPadSyncService\x12O\n" + "\x11EngPadSyncService\x12O\n" +
"\fSyncNotebook\x12\x1e.engpad.v1.SyncNotebookRequest\x1a\x1f.engpad.v1.SyncNotebookResponse\x12U\n" + "\fSyncNotebook\x12\x1e.engpad.v1.SyncNotebookRequest\x1a\x1f.engpad.v1.SyncNotebookResponse\x12L\n" +
"\vGetNotebook\x12\x1d.engpad.v1.GetNotebookRequest\x1a\x1e.engpad.v1.GetNotebookResponse\x12U\n" +
"\x0eDeleteNotebook\x12 .engpad.v1.DeleteNotebookRequest\x1a!.engpad.v1.DeleteNotebookResponse\x12R\n" + "\x0eDeleteNotebook\x12 .engpad.v1.DeleteNotebookRequest\x1a!.engpad.v1.DeleteNotebookResponse\x12R\n" +
"\rListNotebooks\x12\x1f.engpad.v1.ListNotebooksRequest\x1a .engpad.v1.ListNotebooksResponse\x12X\n" + "\rListNotebooks\x12\x1f.engpad.v1.ListNotebooksRequest\x1a .engpad.v1.ListNotebooksResponse\x12X\n" +
"\x0fCreateShareLink\x12!.engpad.v1.CreateShareLinkRequest\x1a\".engpad.v1.CreateShareLinkResponse\x12X\n" + "\x0fCreateShareLink\x12!.engpad.v1.CreateShareLinkRequest\x1a\".engpad.v1.CreateShareLinkResponse\x12X\n" +
@@ -957,53 +1096,59 @@ func file_proto_engpad_v1_sync_proto_rawDescGZIP() []byte {
return file_proto_engpad_v1_sync_proto_rawDescData return file_proto_engpad_v1_sync_proto_rawDescData
} }
var file_proto_engpad_v1_sync_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_proto_engpad_v1_sync_proto_msgTypes = make([]protoimpl.MessageInfo, 18)
var file_proto_engpad_v1_sync_proto_goTypes = []any{ var file_proto_engpad_v1_sync_proto_goTypes = []any{
(*SyncNotebookRequest)(nil), // 0: engpad.v1.SyncNotebookRequest (*SyncNotebookRequest)(nil), // 0: engpad.v1.SyncNotebookRequest
(*PageData)(nil), // 1: engpad.v1.PageData (*PageData)(nil), // 1: engpad.v1.PageData
(*StrokeData)(nil), // 2: engpad.v1.StrokeData (*StrokeData)(nil), // 2: engpad.v1.StrokeData
(*SyncNotebookResponse)(nil), // 3: engpad.v1.SyncNotebookResponse (*SyncNotebookResponse)(nil), // 3: engpad.v1.SyncNotebookResponse
(*DeleteNotebookRequest)(nil), // 4: engpad.v1.DeleteNotebookRequest (*GetNotebookRequest)(nil), // 4: engpad.v1.GetNotebookRequest
(*DeleteNotebookResponse)(nil), // 5: engpad.v1.DeleteNotebookResponse (*GetNotebookResponse)(nil), // 5: engpad.v1.GetNotebookResponse
(*ListNotebooksRequest)(nil), // 6: engpad.v1.ListNotebooksRequest (*DeleteNotebookRequest)(nil), // 6: engpad.v1.DeleteNotebookRequest
(*ListNotebooksResponse)(nil), // 7: engpad.v1.ListNotebooksResponse (*DeleteNotebookResponse)(nil), // 7: engpad.v1.DeleteNotebookResponse
(*NotebookSummary)(nil), // 8: engpad.v1.NotebookSummary (*ListNotebooksRequest)(nil), // 8: engpad.v1.ListNotebooksRequest
(*CreateShareLinkRequest)(nil), // 9: engpad.v1.CreateShareLinkRequest (*ListNotebooksResponse)(nil), // 9: engpad.v1.ListNotebooksResponse
(*CreateShareLinkResponse)(nil), // 10: engpad.v1.CreateShareLinkResponse (*NotebookSummary)(nil), // 10: engpad.v1.NotebookSummary
(*RevokeShareLinkRequest)(nil), // 11: engpad.v1.RevokeShareLinkRequest (*CreateShareLinkRequest)(nil), // 11: engpad.v1.CreateShareLinkRequest
(*RevokeShareLinkResponse)(nil), // 12: engpad.v1.RevokeShareLinkResponse (*CreateShareLinkResponse)(nil), // 12: engpad.v1.CreateShareLinkResponse
(*ListShareLinksRequest)(nil), // 13: engpad.v1.ListShareLinksRequest (*RevokeShareLinkRequest)(nil), // 13: engpad.v1.RevokeShareLinkRequest
(*ListShareLinksResponse)(nil), // 14: engpad.v1.ListShareLinksResponse (*RevokeShareLinkResponse)(nil), // 14: engpad.v1.RevokeShareLinkResponse
(*ShareLinkInfo)(nil), // 15: engpad.v1.ShareLinkInfo (*ListShareLinksRequest)(nil), // 15: engpad.v1.ListShareLinksRequest
(*timestamppb.Timestamp)(nil), // 16: google.protobuf.Timestamp (*ListShareLinksResponse)(nil), // 16: engpad.v1.ListShareLinksResponse
(*ShareLinkInfo)(nil), // 17: engpad.v1.ShareLinkInfo
(*timestamppb.Timestamp)(nil), // 18: google.protobuf.Timestamp
} }
var file_proto_engpad_v1_sync_proto_depIdxs = []int32{ var file_proto_engpad_v1_sync_proto_depIdxs = []int32{
1, // 0: engpad.v1.SyncNotebookRequest.pages:type_name -> engpad.v1.PageData 1, // 0: engpad.v1.SyncNotebookRequest.pages:type_name -> engpad.v1.PageData
2, // 1: engpad.v1.PageData.strokes:type_name -> engpad.v1.StrokeData 2, // 1: engpad.v1.PageData.strokes:type_name -> engpad.v1.StrokeData
16, // 2: engpad.v1.SyncNotebookResponse.synced_at:type_name -> google.protobuf.Timestamp 18, // 2: engpad.v1.SyncNotebookResponse.synced_at:type_name -> google.protobuf.Timestamp
8, // 3: engpad.v1.ListNotebooksResponse.notebooks:type_name -> engpad.v1.NotebookSummary 1, // 3: engpad.v1.GetNotebookResponse.pages:type_name -> engpad.v1.PageData
16, // 4: engpad.v1.NotebookSummary.synced_at:type_name -> google.protobuf.Timestamp 18, // 4: engpad.v1.GetNotebookResponse.synced_at:type_name -> google.protobuf.Timestamp
16, // 5: engpad.v1.CreateShareLinkResponse.expires_at:type_name -> google.protobuf.Timestamp 10, // 5: engpad.v1.ListNotebooksResponse.notebooks:type_name -> engpad.v1.NotebookSummary
15, // 6: engpad.v1.ListShareLinksResponse.links:type_name -> engpad.v1.ShareLinkInfo 18, // 6: engpad.v1.NotebookSummary.synced_at:type_name -> google.protobuf.Timestamp
16, // 7: engpad.v1.ShareLinkInfo.created_at:type_name -> google.protobuf.Timestamp 18, // 7: engpad.v1.CreateShareLinkResponse.expires_at:type_name -> google.protobuf.Timestamp
16, // 8: engpad.v1.ShareLinkInfo.expires_at:type_name -> google.protobuf.Timestamp 17, // 8: engpad.v1.ListShareLinksResponse.links:type_name -> engpad.v1.ShareLinkInfo
0, // 9: engpad.v1.EngPadSyncService.SyncNotebook:input_type -> engpad.v1.SyncNotebookRequest 18, // 9: engpad.v1.ShareLinkInfo.created_at:type_name -> google.protobuf.Timestamp
4, // 10: engpad.v1.EngPadSyncService.DeleteNotebook:input_type -> engpad.v1.DeleteNotebookRequest 18, // 10: engpad.v1.ShareLinkInfo.expires_at:type_name -> google.protobuf.Timestamp
6, // 11: engpad.v1.EngPadSyncService.ListNotebooks:input_type -> engpad.v1.ListNotebooksRequest 0, // 11: engpad.v1.EngPadSyncService.SyncNotebook:input_type -> engpad.v1.SyncNotebookRequest
9, // 12: engpad.v1.EngPadSyncService.CreateShareLink:input_type -> engpad.v1.CreateShareLinkRequest 4, // 12: engpad.v1.EngPadSyncService.GetNotebook:input_type -> engpad.v1.GetNotebookRequest
11, // 13: engpad.v1.EngPadSyncService.RevokeShareLink:input_type -> engpad.v1.RevokeShareLinkRequest 6, // 13: engpad.v1.EngPadSyncService.DeleteNotebook:input_type -> engpad.v1.DeleteNotebookRequest
13, // 14: engpad.v1.EngPadSyncService.ListShareLinks:input_type -> engpad.v1.ListShareLinksRequest 8, // 14: engpad.v1.EngPadSyncService.ListNotebooks:input_type -> engpad.v1.ListNotebooksRequest
3, // 15: engpad.v1.EngPadSyncService.SyncNotebook:output_type -> engpad.v1.SyncNotebookResponse 11, // 15: engpad.v1.EngPadSyncService.CreateShareLink:input_type -> engpad.v1.CreateShareLinkRequest
5, // 16: engpad.v1.EngPadSyncService.DeleteNotebook:output_type -> engpad.v1.DeleteNotebookResponse 13, // 16: engpad.v1.EngPadSyncService.RevokeShareLink:input_type -> engpad.v1.RevokeShareLinkRequest
7, // 17: engpad.v1.EngPadSyncService.ListNotebooks:output_type -> engpad.v1.ListNotebooksResponse 15, // 17: engpad.v1.EngPadSyncService.ListShareLinks:input_type -> engpad.v1.ListShareLinksRequest
10, // 18: engpad.v1.EngPadSyncService.CreateShareLink:output_type -> engpad.v1.CreateShareLinkResponse 3, // 18: engpad.v1.EngPadSyncService.SyncNotebook:output_type -> engpad.v1.SyncNotebookResponse
12, // 19: engpad.v1.EngPadSyncService.RevokeShareLink:output_type -> engpad.v1.RevokeShareLinkResponse 5, // 19: engpad.v1.EngPadSyncService.GetNotebook:output_type -> engpad.v1.GetNotebookResponse
14, // 20: engpad.v1.EngPadSyncService.ListShareLinks:output_type -> engpad.v1.ListShareLinksResponse 7, // 20: engpad.v1.EngPadSyncService.DeleteNotebook:output_type -> engpad.v1.DeleteNotebookResponse
15, // [15:21] is the sub-list for method output_type 9, // 21: engpad.v1.EngPadSyncService.ListNotebooks:output_type -> engpad.v1.ListNotebooksResponse
9, // [9:15] is the sub-list for method input_type 12, // 22: engpad.v1.EngPadSyncService.CreateShareLink:output_type -> engpad.v1.CreateShareLinkResponse
9, // [9:9] is the sub-list for extension type_name 14, // 23: engpad.v1.EngPadSyncService.RevokeShareLink:output_type -> engpad.v1.RevokeShareLinkResponse
9, // [9:9] is the sub-list for extension extendee 16, // 24: engpad.v1.EngPadSyncService.ListShareLinks:output_type -> engpad.v1.ListShareLinksResponse
0, // [0:9] is the sub-list for field type_name 18, // [18:25] is the sub-list for method output_type
11, // [11:18] is the sub-list for method input_type
11, // [11:11] is the sub-list for extension type_name
11, // [11:11] is the sub-list for extension extendee
0, // [0:11] is the sub-list for field type_name
} }
func init() { file_proto_engpad_v1_sync_proto_init() } func init() { file_proto_engpad_v1_sync_proto_init() }
@@ -1017,7 +1162,7 @@ func file_proto_engpad_v1_sync_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_engpad_v1_sync_proto_rawDesc), len(file_proto_engpad_v1_sync_proto_rawDesc)), RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_engpad_v1_sync_proto_rawDesc), len(file_proto_engpad_v1_sync_proto_rawDesc)),
NumEnums: 0, NumEnums: 0,
NumMessages: 16, NumMessages: 18,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

View File

@@ -20,6 +20,7 @@ const _ = grpc.SupportPackageIsVersion9
const ( const (
EngPadSyncService_SyncNotebook_FullMethodName = "/engpad.v1.EngPadSyncService/SyncNotebook" EngPadSyncService_SyncNotebook_FullMethodName = "/engpad.v1.EngPadSyncService/SyncNotebook"
EngPadSyncService_GetNotebook_FullMethodName = "/engpad.v1.EngPadSyncService/GetNotebook"
EngPadSyncService_DeleteNotebook_FullMethodName = "/engpad.v1.EngPadSyncService/DeleteNotebook" EngPadSyncService_DeleteNotebook_FullMethodName = "/engpad.v1.EngPadSyncService/DeleteNotebook"
EngPadSyncService_ListNotebooks_FullMethodName = "/engpad.v1.EngPadSyncService/ListNotebooks" EngPadSyncService_ListNotebooks_FullMethodName = "/engpad.v1.EngPadSyncService/ListNotebooks"
EngPadSyncService_CreateShareLink_FullMethodName = "/engpad.v1.EngPadSyncService/CreateShareLink" EngPadSyncService_CreateShareLink_FullMethodName = "/engpad.v1.EngPadSyncService/CreateShareLink"
@@ -32,6 +33,7 @@ const (
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type EngPadSyncServiceClient interface { type EngPadSyncServiceClient interface {
SyncNotebook(ctx context.Context, in *SyncNotebookRequest, opts ...grpc.CallOption) (*SyncNotebookResponse, error) SyncNotebook(ctx context.Context, in *SyncNotebookRequest, opts ...grpc.CallOption) (*SyncNotebookResponse, error)
GetNotebook(ctx context.Context, in *GetNotebookRequest, opts ...grpc.CallOption) (*GetNotebookResponse, error)
DeleteNotebook(ctx context.Context, in *DeleteNotebookRequest, opts ...grpc.CallOption) (*DeleteNotebookResponse, error) DeleteNotebook(ctx context.Context, in *DeleteNotebookRequest, opts ...grpc.CallOption) (*DeleteNotebookResponse, error)
ListNotebooks(ctx context.Context, in *ListNotebooksRequest, opts ...grpc.CallOption) (*ListNotebooksResponse, error) ListNotebooks(ctx context.Context, in *ListNotebooksRequest, opts ...grpc.CallOption) (*ListNotebooksResponse, error)
CreateShareLink(ctx context.Context, in *CreateShareLinkRequest, opts ...grpc.CallOption) (*CreateShareLinkResponse, error) CreateShareLink(ctx context.Context, in *CreateShareLinkRequest, opts ...grpc.CallOption) (*CreateShareLinkResponse, error)
@@ -57,6 +59,16 @@ func (c *engPadSyncServiceClient) SyncNotebook(ctx context.Context, in *SyncNote
return out, nil return out, nil
} }
func (c *engPadSyncServiceClient) GetNotebook(ctx context.Context, in *GetNotebookRequest, opts ...grpc.CallOption) (*GetNotebookResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetNotebookResponse)
err := c.cc.Invoke(ctx, EngPadSyncService_GetNotebook_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *engPadSyncServiceClient) DeleteNotebook(ctx context.Context, in *DeleteNotebookRequest, opts ...grpc.CallOption) (*DeleteNotebookResponse, error) { func (c *engPadSyncServiceClient) DeleteNotebook(ctx context.Context, in *DeleteNotebookRequest, opts ...grpc.CallOption) (*DeleteNotebookResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteNotebookResponse) out := new(DeleteNotebookResponse)
@@ -112,6 +124,7 @@ func (c *engPadSyncServiceClient) ListShareLinks(ctx context.Context, in *ListSh
// for forward compatibility. // for forward compatibility.
type EngPadSyncServiceServer interface { type EngPadSyncServiceServer interface {
SyncNotebook(context.Context, *SyncNotebookRequest) (*SyncNotebookResponse, error) SyncNotebook(context.Context, *SyncNotebookRequest) (*SyncNotebookResponse, error)
GetNotebook(context.Context, *GetNotebookRequest) (*GetNotebookResponse, error)
DeleteNotebook(context.Context, *DeleteNotebookRequest) (*DeleteNotebookResponse, error) DeleteNotebook(context.Context, *DeleteNotebookRequest) (*DeleteNotebookResponse, error)
ListNotebooks(context.Context, *ListNotebooksRequest) (*ListNotebooksResponse, error) ListNotebooks(context.Context, *ListNotebooksRequest) (*ListNotebooksResponse, error)
CreateShareLink(context.Context, *CreateShareLinkRequest) (*CreateShareLinkResponse, error) CreateShareLink(context.Context, *CreateShareLinkRequest) (*CreateShareLinkResponse, error)
@@ -130,6 +143,9 @@ type UnimplementedEngPadSyncServiceServer struct{}
func (UnimplementedEngPadSyncServiceServer) SyncNotebook(context.Context, *SyncNotebookRequest) (*SyncNotebookResponse, error) { func (UnimplementedEngPadSyncServiceServer) SyncNotebook(context.Context, *SyncNotebookRequest) (*SyncNotebookResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SyncNotebook not implemented") return nil, status.Error(codes.Unimplemented, "method SyncNotebook not implemented")
} }
func (UnimplementedEngPadSyncServiceServer) GetNotebook(context.Context, *GetNotebookRequest) (*GetNotebookResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetNotebook not implemented")
}
func (UnimplementedEngPadSyncServiceServer) DeleteNotebook(context.Context, *DeleteNotebookRequest) (*DeleteNotebookResponse, error) { func (UnimplementedEngPadSyncServiceServer) DeleteNotebook(context.Context, *DeleteNotebookRequest) (*DeleteNotebookResponse, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteNotebook not implemented") return nil, status.Error(codes.Unimplemented, "method DeleteNotebook not implemented")
} }
@@ -184,6 +200,24 @@ func _EngPadSyncService_SyncNotebook_Handler(srv interface{}, ctx context.Contex
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _EngPadSyncService_GetNotebook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetNotebookRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EngPadSyncServiceServer).GetNotebook(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EngPadSyncService_GetNotebook_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EngPadSyncServiceServer).GetNotebook(ctx, req.(*GetNotebookRequest))
}
return interceptor(ctx, in, info, handler)
}
func _EngPadSyncService_DeleteNotebook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _EngPadSyncService_DeleteNotebook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteNotebookRequest) in := new(DeleteNotebookRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@@ -285,6 +319,10 @@ var EngPadSyncService_ServiceDesc = grpc.ServiceDesc{
MethodName: "SyncNotebook", MethodName: "SyncNotebook",
Handler: _EngPadSyncService_SyncNotebook_Handler, Handler: _EngPadSyncService_SyncNotebook_Handler,
}, },
{
MethodName: "GetNotebook",
Handler: _EngPadSyncService_GetNotebook_Handler,
},
{ {
MethodName: "DeleteNotebook", MethodName: "DeleteNotebook",
Handler: _EngPadSyncService_DeleteNotebook_Handler, Handler: _EngPadSyncService_DeleteNotebook_Handler,

View File

@@ -114,6 +114,71 @@ func (s *SyncService) SyncNotebook(ctx context.Context, req *pb.SyncNotebookRequ
}, nil }, nil
} }
func (s *SyncService) GetNotebook(ctx context.Context, req *pb.GetNotebookRequest) (*pb.GetNotebookResponse, error) {
userID, ok := UserIDFromContext(ctx)
if !ok {
return nil, status.Error(codes.Internal, "missing user context")
}
var resp pb.GetNotebookResponse
var syncedAt int64
err := s.DB.QueryRowContext(ctx,
"SELECT id, remote_id, title, page_size, synced_at FROM notebooks WHERE id = ? AND user_id = ?",
req.NotebookId, userID,
).Scan(&resp.ServerNotebookId, &resp.RemoteId, &resp.Title, &resp.PageSize, &syncedAt)
if err == sql.ErrNoRows {
return nil, status.Error(codes.NotFound, "notebook not found")
}
if err != nil {
return nil, status.Errorf(codes.Internal, "query notebook: %v", err)
}
resp.SyncedAt = timestamppb.New(time.UnixMilli(syncedAt))
pageRows, err := s.DB.QueryContext(ctx,
"SELECT id, remote_id, page_number FROM pages WHERE notebook_id = ? ORDER BY page_number",
resp.ServerNotebookId,
)
if err != nil {
return nil, status.Errorf(codes.Internal, "query pages: %v", err)
}
defer func() { _ = pageRows.Close() }()
for pageRows.Next() {
var pageID, remoteID int64
var pageNum int32
if err := pageRows.Scan(&pageID, &remoteID, &pageNum); err != nil {
return nil, status.Errorf(codes.Internal, "scan page: %v", err)
}
pd := &pb.PageData{
PageId: remoteID,
PageNumber: pageNum,
}
strokeRows, err := s.DB.QueryContext(ctx,
"SELECT pen_size, color, style, point_data, stroke_order FROM strokes WHERE page_id = ? ORDER BY stroke_order",
pageID,
)
if err != nil {
return nil, status.Errorf(codes.Internal, "query strokes: %v", err)
}
for strokeRows.Next() {
var sd pb.StrokeData
if err := strokeRows.Scan(&sd.PenSize, &sd.Color, &sd.Style, &sd.PointData, &sd.StrokeOrder); err != nil {
_ = strokeRows.Close()
return nil, status.Errorf(codes.Internal, "scan stroke: %v", err)
}
pd.Strokes = append(pd.Strokes, &sd)
}
_ = strokeRows.Close()
resp.Pages = append(resp.Pages, pd)
}
return &resp, nil
}
func (s *SyncService) DeleteNotebook(ctx context.Context, req *pb.DeleteNotebookRequest) (*pb.DeleteNotebookResponse, error) { func (s *SyncService) DeleteNotebook(ctx context.Context, req *pb.DeleteNotebookRequest) (*pb.DeleteNotebookResponse, error) {
userID, ok := UserIDFromContext(ctx) userID, ok := UserIDFromContext(ctx)
if !ok { if !ok {

View File

@@ -9,6 +9,7 @@ import "google/protobuf/timestamp.proto";
service EngPadSyncService { service EngPadSyncService {
rpc SyncNotebook(SyncNotebookRequest) returns (SyncNotebookResponse); rpc SyncNotebook(SyncNotebookRequest) returns (SyncNotebookResponse);
rpc GetNotebook(GetNotebookRequest) returns (GetNotebookResponse);
rpc DeleteNotebook(DeleteNotebookRequest) returns (DeleteNotebookResponse); rpc DeleteNotebook(DeleteNotebookRequest) returns (DeleteNotebookResponse);
rpc ListNotebooks(ListNotebooksRequest) returns (ListNotebooksResponse); rpc ListNotebooks(ListNotebooksRequest) returns (ListNotebooksResponse);
rpc CreateShareLink(CreateShareLinkRequest) returns (CreateShareLinkResponse); rpc CreateShareLink(CreateShareLinkRequest) returns (CreateShareLinkResponse);
@@ -42,6 +43,19 @@ message SyncNotebookResponse {
google.protobuf.Timestamp synced_at = 2; google.protobuf.Timestamp synced_at = 2;
} }
message GetNotebookRequest {
int64 notebook_id = 1; // Server-side notebook ID
}
message GetNotebookResponse {
int64 server_notebook_id = 1;
int64 remote_id = 2;
string title = 3;
string page_size = 4;
repeated PageData pages = 5;
google.protobuf.Timestamp synced_at = 6;
}
message DeleteNotebookRequest { message DeleteNotebookRequest {
int64 notebook_id = 1; int64 notebook_id = 1;
} }