Add preliminary API and fix space service methods

This commit is contained in:
mcrakhman 2022-10-16 17:59:16 +02:00 committed by Mikhail Iudin
parent 8b45d698c2
commit 3752fde5e1
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0
2 changed files with 20 additions and 4 deletions

18
client/api/controller.go Normal file
View File

@ -0,0 +1,18 @@
package api
type Controller interface {
CreateDerivedSpace() (id string, err error)
CreateSpace() (id string, err error)
GetAllSpacesIds() (ids []string, err error)
// LoadSpace asks node to load a particular space
LoadSpace(id string) (err error)
CreateDocument(spaceId string) (id string, err error)
GetAllDocumentIds(spaceId string) (ids []string, err error)
AddText(documentId, text string) (err error)
DumpDocumentTree(documentId string) (err error)
GetValidInvites(spaceId string) (invites []string, err error)
GenerateInvite(spaceId string) (invite string, err error)
JoinSpace(invite string) (err error)
}

View File

@ -22,8 +22,8 @@ func New() Service {
}
type Service interface {
CreateSpace(ctx context.Context, cache cache.TreeCache, payload SpaceCreatePayload) (Space, error)
DeriveSpace(ctx context.Context, cache cache.TreeCache, payload SpaceDerivePayload) (Space, error)
DeriveSpace(ctx context.Context, payload SpaceDerivePayload) (Space, error)
CreateSpace(ctx context.Context, payload SpaceCreatePayload) (Space, error)
GetSpace(ctx context.Context, id string) (sp Space, err error)
app.Component
}
@ -51,7 +51,6 @@ func (s *service) Name() (name string) {
func (s *service) CreateSpace(
ctx context.Context,
cache cache.TreeCache,
payload SpaceCreatePayload) (sp Space, err error) {
storageCreate, err := storagePayloadForSpaceCreate(payload)
if err != nil {
@ -67,7 +66,6 @@ func (s *service) CreateSpace(
func (s *service) DeriveSpace(
ctx context.Context,
cache cache.TreeCache,
payload SpaceDerivePayload) (sp Space, err error) {
storageCreate, err := storagePayloadForSpaceDerive(payload)
if err != nil {