-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(sharing): add endpoints to accept or decline a share
- Loading branch information
Showing
7 changed files
with
111 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package svc | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
|
||
storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" | ||
"github.com/go-chi/render" | ||
libregraph "github.com/owncloud/libre-graph-api-go" | ||
|
||
"github.com/owncloud/ocis/v2/ocis-pkg/log" | ||
"github.com/owncloud/ocis/v2/services/graph/pkg/errorcode" | ||
) | ||
|
||
type DrivesDriveItemServicer interface { | ||
CreateChildren(ctx context.Context, driveId, itemId storageprovider.ResourceId, driveItem libregraph.DriveItem) (libregraph.DriveItem, error) | ||
} | ||
|
||
type DrivesDriveItemService struct { | ||
logger log.Logger | ||
} | ||
|
||
func NewDrivesDriveItemService(logger log.Logger) (DrivesDriveItemService, error) { | ||
return DrivesDriveItemService{ | ||
logger: log.Logger{Logger: logger.With().Str("graph api", "DrivesDriveItemService").Logger()}, | ||
}, nil | ||
} | ||
|
||
func (s DrivesDriveItemService) CreateChildren(ctx context.Context, driveId, itemId storageprovider.ResourceId, driveItem libregraph.DriveItem) (libregraph.DriveItem, error) { | ||
return libregraph.DriveItem{}, nil | ||
} | ||
|
||
type DrivesDriveItemApi struct { | ||
logger log.Logger | ||
drivesDriveItemService DrivesDriveItemServicer | ||
} | ||
|
||
func NewDrivesDriveItemApi(drivesDriveItemService DrivesDriveItemServicer, logger log.Logger) (DrivesDriveItemApi, error) { | ||
return DrivesDriveItemApi{ | ||
logger: log.Logger{Logger: logger.With().Str("graph api", "DrivesDriveItemApi").Logger()}, | ||
drivesDriveItemService: drivesDriveItemService, | ||
}, nil | ||
} | ||
|
||
func (api DrivesDriveItemApi) Routes() []Route { | ||
return []Route{ | ||
{http.MethodPost, "/v1beta1/drives/{driveID}/items/{itemID}/children", api.CreateChildren}, | ||
} | ||
} | ||
|
||
func (api DrivesDriveItemApi) CreateChildren(w http.ResponseWriter, r *http.Request) { | ||
ctx := r.Context() | ||
driveID, itemID, err := GetDriveAndItemIDParam(r, &api.logger) | ||
if err != nil { | ||
errorcode.RenderError(w, r, err) | ||
return | ||
} | ||
|
||
driveItem, err := api.drivesDriveItemService. | ||
CreateChildren(ctx, driveID, itemID, libregraph.DriveItem{}) | ||
|
||
render.Status(r, http.StatusOK) | ||
render.JSON(w, r, driveItem) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters