mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-15 09:30:33 -06:00
enhancement: add sharedWithMe graph beta endpoint (#7633)
This commit is contained in:
18
changelog/unreleased/enhancement-sharing-ng.md
Normal file
18
changelog/unreleased/enhancement-sharing-ng.md
Normal file
@@ -0,0 +1,18 @@
|
||||
Enhancement: Add Sharing NG endpoints
|
||||
|
||||
We've added new sharing ng endpoints to the graph beta api.
|
||||
The following endpoints are added:
|
||||
|
||||
* /v1beta1/me/drive/sharedByMe
|
||||
* /v1beta1/me/drive/sharedWithMe
|
||||
* /v1beta1/roleManagement/permissions/roleDefinitions
|
||||
* /v1beta1/roleManagement/permissions/roleDefinitions/{roleID}
|
||||
|
||||
https://github.com/owncloud/ocis/pull/7633
|
||||
https://github.com/owncloud/ocis/pull/7686
|
||||
https://github.com/owncloud/ocis/pull/7684
|
||||
https://github.com/owncloud/ocis/pull/7683
|
||||
https://github.com/owncloud/ocis/pull/7239
|
||||
https://github.com/owncloud/libre-graph-api/pull/112
|
||||
https://github.com/owncloud/ocis/issues/7436
|
||||
https://github.com/owncloud/ocis/issues/6993
|
||||
5
go.mod
5
go.mod
@@ -67,7 +67,7 @@ require (
|
||||
github.com/onsi/gomega v1.29.0
|
||||
github.com/open-policy-agent/opa v0.51.0
|
||||
github.com/orcaman/concurrent-map v1.0.0
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20231019070917-17ae03ef40e4
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20231107135330-011e9d4c45e3
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pkg/xattr v0.4.9
|
||||
github.com/prometheus/client_golang v1.17.0
|
||||
@@ -80,6 +80,7 @@ require (
|
||||
github.com/spf13/cobra v1.8.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/thejerf/suture/v4 v4.0.2
|
||||
github.com/tidwall/gjson v1.17.0
|
||||
github.com/tus/tusd v1.13.0
|
||||
github.com/urfave/cli/v2 v2.25.7
|
||||
github.com/xhit/go-simple-mail/v2 v2.16.0
|
||||
@@ -305,6 +306,8 @@ require (
|
||||
github.com/stretchr/objx v0.5.0 // indirect
|
||||
github.com/studio-b12/gowebdav v0.0.0-20221015232716-17255f2e7423 // indirect
|
||||
github.com/tchap/go-patricia/v2 v2.3.1 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208 // indirect
|
||||
github.com/trustelem/zxcvbn v1.0.1 // indirect
|
||||
github.com/wk8/go-ordered-map v1.0.0 // indirect
|
||||
|
||||
11
go.sum
11
go.sum
@@ -1774,8 +1774,8 @@ github.com/oracle/oci-go-sdk v24.3.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35uk
|
||||
github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HDbW65HOY=
|
||||
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||
github.com/ovh/go-ovh v1.1.0/go.mod h1:AxitLZ5HBRPyUd+Zl60Ajaag+rNTdVXWIkzfrVuTXWA=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20231019070917-17ae03ef40e4 h1:W2X4DGGEuNUeGCKOUK8c2NAC4kva8jq9knuv5ePLUiE=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20231019070917-17ae03ef40e4/go.mod h1:v2aAl5IwEI8t+GmcWvBd+bvJMYp9Vf1hekLuRf0UnEs=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20231107135330-011e9d4c45e3 h1:eUE3kNgr8PwcXeUKFkuEuz1+4hfCCmq+rKYQzk0OxtY=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20231107135330-011e9d4c45e3/go.mod h1:v2aAl5IwEI8t+GmcWvBd+bvJMYp9Vf1hekLuRf0UnEs=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
@@ -1990,6 +1990,13 @@ github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE
|
||||
github.com/thanhpk/randstr v1.0.4 h1:IN78qu/bR+My+gHCvMEXhR/i5oriVHcTB/BJJIRTsNo=
|
||||
github.com/thejerf/suture/v4 v4.0.2 h1:VxIH/J8uYvqJY1+9fxi5GBfGRkRZ/jlSOP6x9HijFQc=
|
||||
github.com/thejerf/suture/v4 v4.0.2/go.mod h1:g0e8vwskm9tI0jRjxrnA6lSr0q6OfPdWJVX7G5bVWRs=
|
||||
github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM=
|
||||
github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
|
||||
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208 h1:PM5hJF7HVfNWmCjMdEfbuOBNXSVF2cMFGgQTPdKCbwM=
|
||||
github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208/go.mod h1:BzWtXXrXzZUvMacR0oF/fbDDgUPO8L36tDMmRAf14ns=
|
||||
|
||||
@@ -15,6 +15,11 @@ import (
|
||||
"github.com/cs3org/reva/v2/pkg/storagespace"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/jellydator/ttlcache/v3"
|
||||
"go-micro.dev/v4/client"
|
||||
mevents "go-micro.dev/v4/events"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/keycloak"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
ehsvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/eventhistory/v0"
|
||||
@@ -23,10 +28,6 @@ import (
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/identity"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/service/v0/errorcode"
|
||||
"go-micro.dev/v4/client"
|
||||
mevents "go-micro.dev/v4/events"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
//go:generate make -C ../../.. generate
|
||||
|
||||
@@ -16,6 +16,8 @@ import (
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
ldapv3 "github.com/go-ldap/ldap/v3"
|
||||
"github.com/jellydator/ttlcache/v3"
|
||||
microstore "go-micro.dev/v4/store"
|
||||
|
||||
ocisldap "github.com/owncloud/ocis/v2/ocis-pkg/ldap"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/registry"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/roles"
|
||||
@@ -24,7 +26,6 @@ import (
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/identity"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/identity/ldap"
|
||||
graphm "github.com/owncloud/ocis/v2/services/graph/pkg/middleware"
|
||||
microstore "go-micro.dev/v4/store"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -95,11 +96,13 @@ type Service interface {
|
||||
GetDrives(w http.ResponseWriter, r *http.Request)
|
||||
GetSingleDrive(w http.ResponseWriter, r *http.Request)
|
||||
GetAllDrives(w http.ResponseWriter, r *http.Request)
|
||||
GetSharedByMe(w http.ResponseWriter, r *http.Request)
|
||||
CreateDrive(w http.ResponseWriter, r *http.Request)
|
||||
UpdateDrive(w http.ResponseWriter, r *http.Request)
|
||||
DeleteDrive(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
GetSharedByMe(w http.ResponseWriter, r *http.Request)
|
||||
ListSharedWithMe(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
GetRootDriveChildren(w http.ResponseWriter, r *http.Request)
|
||||
GetDriveItem(w http.ResponseWriter, r *http.Request)
|
||||
GetDriveItemChildren(w http.ResponseWriter, r *http.Request)
|
||||
@@ -190,6 +193,7 @@ func NewService(opts ...Option) (Graph, error) {
|
||||
r.Use(middleware.StripSlashes)
|
||||
r.Route("/v1beta1", func(r chi.Router) {
|
||||
r.Get("/me/drive/sharedByMe", svc.GetSharedByMe)
|
||||
r.Get("/me/drive/sharedWithMe", svc.ListSharedWithMe)
|
||||
r.Route("/roleManagement/permissions/roleDefinitions", func(r chi.Router) {
|
||||
r.Get("/", svc.GetRoleDefinitions)
|
||||
r.Get("/{roleID}", svc.GetRoleDefinition)
|
||||
@@ -208,9 +212,7 @@ func NewService(opts ...Option) (Graph, error) {
|
||||
r.Route("/me", func(r chi.Router) {
|
||||
r.Get("/", svc.GetMe)
|
||||
r.Get("/drive", svc.GetUserDrive)
|
||||
r.Route("/drives", func(r chi.Router) {
|
||||
r.Get("/", svc.GetDrives)
|
||||
})
|
||||
r.Get("/drives", svc.GetDrives)
|
||||
r.Get("/drive/root/children", svc.GetRootDriveChildren)
|
||||
r.Post("/changePassword", svc.ChangeOwnPassword)
|
||||
})
|
||||
|
||||
226
services/graph/pkg/service/v0/sharedwithme.go
Normal file
226
services/graph/pkg/service/v0/sharedwithme.go
Normal file
@@ -0,0 +1,226 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
|
||||
storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
"github.com/cs3org/reva/v2/pkg/storagespace"
|
||||
"github.com/go-chi/render"
|
||||
libregraph "github.com/owncloud/libre-graph-api-go"
|
||||
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/identity"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/service/v0/errorcode"
|
||||
)
|
||||
|
||||
// ListSharedWithMe lists the files shared with the current user.
|
||||
func (g Graph) ListSharedWithMe(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
driveItems, err := g.listSharedWithMe(ctx)
|
||||
if err != nil {
|
||||
g.logger.Error().Err(err).Msg("listSharedWithMe failed")
|
||||
errorcode.RenderError(w, r, err)
|
||||
return
|
||||
}
|
||||
|
||||
render.Status(r, http.StatusOK)
|
||||
render.JSON(w, r, &ListResponse{Value: driveItems})
|
||||
}
|
||||
|
||||
func (g Graph) listSharedWithMe(ctx context.Context) ([]libregraph.DriveItem, error) {
|
||||
gatewayClient, err := g.gatewaySelector.Next()
|
||||
if err != nil {
|
||||
g.logger.Error().Err(err).Msg("could not select next gateway client")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
listReceivedSharesResponse, err := gatewayClient.ListReceivedShares(ctx, &collaboration.ListReceivedSharesRequest{})
|
||||
if err != nil {
|
||||
g.logger.Error().Err(err).Msg("listing shares failed")
|
||||
return nil, errorcode.New(errorcode.GeneralException, err.Error())
|
||||
}
|
||||
|
||||
switch listReceivedSharesResponse.Status.Code {
|
||||
case rpc.Code_CODE_NOT_FOUND:
|
||||
return nil, identity.ErrNotFound
|
||||
}
|
||||
|
||||
var driveItems []libregraph.DriveItem
|
||||
for _, receivedShare := range listReceivedSharesResponse.GetShares() {
|
||||
share := receivedShare.GetShare()
|
||||
if share == nil {
|
||||
g.logger.Error().Interface("ListReceivedShares", listReceivedSharesResponse).Msg("unexpected empty ReceivedShare.Share")
|
||||
continue
|
||||
}
|
||||
|
||||
driveItem := &libregraph.DriveItem{}
|
||||
|
||||
statResponse, err := gatewayClient.Stat(ctx, &storageprovider.StatRequest{Ref: &storageprovider.Reference{ResourceId: share.GetResourceId()}})
|
||||
if err != nil {
|
||||
g.logger.Error().Err(err).Msg("could not stat")
|
||||
continue
|
||||
}
|
||||
if statResponse.GetStatus().GetCode() != rpc.Code_CODE_OK {
|
||||
g.logger.Error().Err(err).Msg("invalid stat response")
|
||||
continue
|
||||
}
|
||||
resourceInfo := statResponse.GetInfo()
|
||||
|
||||
var driveOwner *libregraph.Identity
|
||||
if userID := statResponse.GetInfo().GetOwner(); userID != nil {
|
||||
if user, err := g.identityCache.GetUser(ctx, userID.GetOpaqueId()); err != nil {
|
||||
g.logger.Error().Err(err).Msg("could not get user")
|
||||
continue
|
||||
} else {
|
||||
driveOwner = &libregraph.Identity{
|
||||
DisplayName: user.GetDisplayName(),
|
||||
Id: libregraph.PtrString(user.GetId()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var shareCreator *libregraph.Identity
|
||||
if userID := share.GetCreator(); userID != nil {
|
||||
if user, err := g.identityCache.GetUser(ctx, userID.GetOpaqueId()); err != nil {
|
||||
g.logger.Error().Err(err).Msg("could not get user")
|
||||
continue
|
||||
} else {
|
||||
shareCreator = &libregraph.Identity{
|
||||
DisplayName: user.GetDisplayName(),
|
||||
Id: libregraph.PtrString(user.GetId()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if cTime := share.GetCtime(); cTime != nil {
|
||||
driveItem.CreatedDateTime = libregraph.PtrTime(cs3TimestampToTime(cTime))
|
||||
}
|
||||
|
||||
driveItem.ETag = libregraph.PtrString(strings.Trim(statResponse.GetInfo().GetEtag(), "\""))
|
||||
|
||||
if id := share.GetId().GetOpaqueId(); id != "" {
|
||||
driveItem.Id = libregraph.PtrString(id)
|
||||
}
|
||||
|
||||
if mTime := share.GetMtime(); mTime != nil {
|
||||
driveItem.LastModifiedDateTime = libregraph.PtrTime(cs3TimestampToTime(mTime))
|
||||
}
|
||||
|
||||
if name := resourceInfo.GetName(); name != "" {
|
||||
driveItem.Name = libregraph.PtrString(name)
|
||||
}
|
||||
|
||||
{
|
||||
addParentReference := false
|
||||
parentReference := &libregraph.ItemReference{}
|
||||
|
||||
if id := share.GetId().GetOpaqueId(); id != "" {
|
||||
parentReference.DriveId = libregraph.PtrString(id)
|
||||
addParentReference = true
|
||||
}
|
||||
|
||||
if addParentReference {
|
||||
driveItem.ParentReference = parentReference
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
remoteItem := &libregraph.RemoteItem{}
|
||||
|
||||
if id := resourceInfo.GetId(); id != nil {
|
||||
remoteItem.Id = libregraph.PtrString(storagespace.FormatResourceID(*id))
|
||||
}
|
||||
|
||||
if mTime := resourceInfo.GetMtime(); mTime != nil {
|
||||
remoteItem.LastModifiedDateTime = libregraph.PtrTime(cs3TimestampToTime(mTime))
|
||||
}
|
||||
|
||||
if name := resourceInfo.GetName(); name != "" {
|
||||
remoteItem.Name = libregraph.PtrString(name)
|
||||
}
|
||||
|
||||
// fixMe:
|
||||
// - negative permission could distort the size, am i right?
|
||||
remoteItem.Size = libregraph.PtrInt64(int64(resourceInfo.GetSize()))
|
||||
|
||||
remoteItem.CreatedBy = &libregraph.IdentitySet{
|
||||
User: driveOwner,
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
addFileSystemInfo := false
|
||||
fileSystemInfo := &libregraph.FileSystemInfo{}
|
||||
|
||||
if cTime := share.GetCtime(); cTime != nil {
|
||||
// fixMe:
|
||||
// - ms uses the root resource ctime for that,
|
||||
// the stat response does not contain any information about this, use share instead?
|
||||
fileSystemInfo.CreatedDateTime = libregraph.PtrTime(cs3TimestampToTime(cTime))
|
||||
addFileSystemInfo = true
|
||||
}
|
||||
|
||||
if mTime := resourceInfo.GetMtime(); mTime != nil {
|
||||
fileSystemInfo.LastModifiedDateTime = libregraph.PtrTime(cs3TimestampToTime(mTime))
|
||||
addFileSystemInfo = true
|
||||
}
|
||||
|
||||
if addFileSystemInfo {
|
||||
remoteItem.FileSystemInfo = fileSystemInfo
|
||||
}
|
||||
}
|
||||
|
||||
switch resourceInfo.GetType() {
|
||||
case storageprovider.ResourceType_RESOURCE_TYPE_CONTAINER:
|
||||
remoteItem.Folder = &libregraph.Folder{}
|
||||
case storageprovider.ResourceType_RESOURCE_TYPE_FILE:
|
||||
openGraphFile := &libregraph.OpenGraphFile{}
|
||||
|
||||
if mimeType := resourceInfo.GetMimeType(); mimeType != "" {
|
||||
openGraphFile.MimeType = libregraph.PtrString(mimeType)
|
||||
}
|
||||
|
||||
remoteItem.File = openGraphFile
|
||||
case storageprovider.ResourceType_RESOURCE_TYPE_INVALID:
|
||||
g.logger.Error().Msg("invalid resource type")
|
||||
continue
|
||||
}
|
||||
|
||||
{
|
||||
addShared := false
|
||||
shared := &libregraph.Shared{
|
||||
Owner: &libregraph.IdentitySet{
|
||||
User: shareCreator,
|
||||
},
|
||||
SharedBy: &libregraph.IdentitySet{
|
||||
User: shareCreator,
|
||||
},
|
||||
}
|
||||
|
||||
if cTime := share.GetCtime(); cTime != nil {
|
||||
shared.SharedDateTime = libregraph.PtrTime(cs3TimestampToTime(cTime))
|
||||
addShared = true
|
||||
}
|
||||
|
||||
if shareCreator != nil {
|
||||
shared.Owner.User = shareCreator
|
||||
shared.SharedBy.User = shareCreator
|
||||
addShared = true
|
||||
}
|
||||
|
||||
if addShared {
|
||||
remoteItem.Shared = shared
|
||||
}
|
||||
}
|
||||
|
||||
driveItem.RemoteItem = remoteItem
|
||||
}
|
||||
|
||||
driveItems = append(driveItems, *driveItem)
|
||||
}
|
||||
|
||||
return driveItems, nil
|
||||
}
|
||||
370
services/graph/pkg/service/v0/sharedwithme_test.go
Normal file
370
services/graph/pkg/service/v0/sharedwithme_test.go
Normal file
@@ -0,0 +1,370 @@
|
||||
package svc_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"time"
|
||||
|
||||
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
|
||||
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
collaborationv1beta1 "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
|
||||
providerv1beta1 "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
typesv1beta1 "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/status"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
"github.com/cs3org/reva/v2/pkg/storagespace"
|
||||
"github.com/cs3org/reva/v2/pkg/utils"
|
||||
cs3mocks "github.com/cs3org/reva/v2/tests/cs3mocks/mocks"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/tidwall/gjson"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/config/defaults"
|
||||
identitymocks "github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks"
|
||||
service "github.com/owncloud/ocis/v2/services/graph/pkg/service/v0"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/service/v0/errorcode"
|
||||
)
|
||||
|
||||
var _ = Describe("SharedWithMe", func() {
|
||||
var (
|
||||
svc service.Service
|
||||
cfg *config.Config
|
||||
gatewayClient *cs3mocks.GatewayAPIClient
|
||||
gatewaySelector pool.Selectable[gateway.GatewayAPIClient]
|
||||
identityBackend *identitymocks.Backend
|
||||
ctx context.Context
|
||||
tape *httptest.ResponseRecorder
|
||||
)
|
||||
|
||||
BeforeEach(func() {
|
||||
pool.RemoveSelector("GatewaySelector" + "com.owncloud.api.gateway")
|
||||
gatewayClient = &cs3mocks.GatewayAPIClient{}
|
||||
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
|
||||
"GatewaySelector",
|
||||
"com.owncloud.api.gateway",
|
||||
func(cc *grpc.ClientConn) gateway.GatewayAPIClient {
|
||||
return gatewayClient
|
||||
},
|
||||
)
|
||||
|
||||
identityBackend = &identitymocks.Backend{}
|
||||
|
||||
tape = httptest.NewRecorder()
|
||||
ctx = context.Background()
|
||||
|
||||
cfg = defaults.FullDefaultConfig()
|
||||
cfg.Identity.LDAP.CACert = "" // skip the startup checks, we don't use LDAP at all in this tests
|
||||
cfg.TokenManager.JWTSecret = "loremipsum"
|
||||
cfg.Commons = &shared.Commons{}
|
||||
cfg.GRPCClientTLS = &shared.GRPCClientTLS{}
|
||||
|
||||
svc, _ = service.NewService(
|
||||
service.Config(cfg),
|
||||
service.WithGatewaySelector(gatewaySelector),
|
||||
service.WithIdentityBackend(identityBackend),
|
||||
)
|
||||
})
|
||||
|
||||
Describe("ListSharedWithMe", func() {
|
||||
var (
|
||||
listReceivedSharesResponse *collaborationv1beta1.ListReceivedSharesResponse
|
||||
statResponse *providerv1beta1.StatResponse
|
||||
getUserResponse *userv1beta1.GetUserResponse
|
||||
)
|
||||
|
||||
toResourceID := func(in string) *providerv1beta1.ResourceId {
|
||||
out, err := storagespace.ParseID(in)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
return &out
|
||||
}
|
||||
|
||||
BeforeEach(func() {
|
||||
|
||||
getUserResponse = &userv1beta1.GetUserResponse{
|
||||
Status: status.NewOK(ctx),
|
||||
User: &userv1beta1.User{
|
||||
Id: &userv1beta1.UserId{
|
||||
OpaqueId: "2699b42d-c6ca-4ce1-90de-89dedfb3022c",
|
||||
},
|
||||
DisplayName: "John Romero",
|
||||
},
|
||||
}
|
||||
|
||||
gatewayClient.On("GetUser", mock.Anything, mock.Anything).Return(getUserResponse, nil)
|
||||
|
||||
listReceivedSharesResponse = &collaborationv1beta1.ListReceivedSharesResponse{
|
||||
Status: status.NewOK(ctx),
|
||||
Shares: []*collaborationv1beta1.ReceivedShare{
|
||||
{Share: &collaborationv1beta1.Share{ResourceId: toResourceID("1$2!3")}},
|
||||
},
|
||||
}
|
||||
|
||||
gatewayClient.On("ListReceivedShares", mock.Anything, mock.Anything).Return(listReceivedSharesResponse, nil)
|
||||
|
||||
statResponse = &providerv1beta1.StatResponse{
|
||||
Status: status.NewOK(ctx),
|
||||
Info: &providerv1beta1.ResourceInfo{
|
||||
Type: providerv1beta1.ResourceType_RESOURCE_TYPE_CONTAINER,
|
||||
},
|
||||
}
|
||||
|
||||
gatewayClient.On("Stat", mock.Anything, mock.Anything).Return(func(_ context.Context, r *providerv1beta1.StatRequest, _ ...grpc.CallOption) (*providerv1beta1.StatResponse, error) {
|
||||
for _, share := range listReceivedSharesResponse.Shares {
|
||||
if share.Share.ResourceId != r.Ref.ResourceId {
|
||||
continue
|
||||
}
|
||||
|
||||
if statResponse.Info.Id == nil {
|
||||
statResponse.Info.Id = share.Share.ResourceId
|
||||
}
|
||||
|
||||
return statResponse, nil
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
})
|
||||
})
|
||||
|
||||
It("fails if no received shares were found", func() {
|
||||
listReceivedSharesResponse.Status = status.NewNotFound(ctx, "msg")
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
|
||||
Expect(tape.Code, errorcode.ItemNotFound)
|
||||
})
|
||||
|
||||
It("ignores hidden received shares by default", func() {
|
||||
listReceivedSharesResponse.Shares = append(listReceivedSharesResponse.Shares, &collaborationv1beta1.ReceivedShare{
|
||||
Hidden: true,
|
||||
})
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
|
||||
jsonData := gjson.Get(tape.Body.String(), "value")
|
||||
|
||||
Expect(len(listReceivedSharesResponse.Shares)).To(Equal(2))
|
||||
Expect(jsonData.Get("#").Num).To(Equal(float64(1)))
|
||||
})
|
||||
|
||||
It("includes hidden shares if explicitly stated", func() {
|
||||
listReceivedSharesResponse.Shares = append(listReceivedSharesResponse.Shares, &collaborationv1beta1.ReceivedShare{
|
||||
Hidden: true,
|
||||
Share: &collaborationv1beta1.Share{
|
||||
ResourceId: toResourceID("7$8!9"),
|
||||
},
|
||||
})
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe?show-hidden=true", nil),
|
||||
)
|
||||
|
||||
jsonData := gjson.Get(tape.Body.String(), "value")
|
||||
|
||||
Expect(len(listReceivedSharesResponse.Shares)).To(Equal(2))
|
||||
Expect(jsonData.Get("#").Num).To(Equal(float64(2)))
|
||||
})
|
||||
|
||||
It("populates the driveItem properties", func() {
|
||||
|
||||
share := listReceivedSharesResponse.Shares[0].Share
|
||||
share.Id = &collaborationv1beta1.ShareId{OpaqueId: "1:2:3"}
|
||||
share.Ctime = &typesv1beta1.Timestamp{Seconds: 4000}
|
||||
share.Mtime = &typesv1beta1.Timestamp{Seconds: 40000}
|
||||
|
||||
etag := "5ffb8e4bec7026050af7fde9482b289a"
|
||||
|
||||
resourceInfo := statResponse.Info
|
||||
resourceInfo.Name = "some folder"
|
||||
resourceInfo.Etag = "\"" + etag + "\""
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
|
||||
jsonData := gjson.Get(tape.Body.String(), "value.0")
|
||||
|
||||
Expect(jsonData.Get("createdDateTime").String()).To(Equal(utils.TSToTime(share.Ctime).Format(time.RFC3339Nano)))
|
||||
Expect(jsonData.Get("eTag").String()).To(Equal(etag))
|
||||
Expect(jsonData.Get("id").String()).To(Equal(share.Id.OpaqueId))
|
||||
Expect(jsonData.Get("lastModifiedDateTime").String()).To(Equal(utils.TSToTime(share.Mtime).Format(time.RFC3339Nano)))
|
||||
Expect(jsonData.Get("name").String()).To(Equal(resourceInfo.Name))
|
||||
})
|
||||
|
||||
It("populates the driveItem parentReference properties", func() {
|
||||
share := listReceivedSharesResponse.Shares[0].Share
|
||||
share.Id = &collaborationv1beta1.ShareId{OpaqueId: "1:2:3"}
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
|
||||
jsonData := gjson.Get(tape.Body.String(), "value.0.parentReference")
|
||||
|
||||
Expect(jsonData.Get("driveId").String()).To(Equal(share.Id.OpaqueId))
|
||||
})
|
||||
|
||||
It("populates the driveItem remoteItem properties", func() {
|
||||
|
||||
share := listReceivedSharesResponse.Shares[0].Share
|
||||
|
||||
resourceInfo := statResponse.Info
|
||||
resourceInfo.Name = "some folder"
|
||||
resourceInfo.Mtime = &typesv1beta1.Timestamp{Seconds: 40000}
|
||||
resourceInfo.Size = 500
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
|
||||
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem")
|
||||
|
||||
Expect(jsonData.Get("id").String()).To(Equal(storagespace.FormatResourceID(*share.ResourceId)))
|
||||
Expect(jsonData.Get("lastModifiedDateTime").String()).To(Equal(utils.TSToTime(resourceInfo.Mtime).Format(time.RFC3339Nano)))
|
||||
Expect(jsonData.Get("name").String()).To(Equal(resourceInfo.Name))
|
||||
Expect(jsonData.Get("size").Num).To(Equal(float64(resourceInfo.Size)))
|
||||
})
|
||||
|
||||
It("populates the driveItem.remoteItem.createdBy properties", func() {
|
||||
driveOwner := getUserResponse.User
|
||||
|
||||
resourceInfo := statResponse.Info
|
||||
resourceInfo.Owner = driveOwner.Id
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
|
||||
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem.createdBy")
|
||||
|
||||
Expect(jsonData.Get("user.displayName").String()).To(Equal(driveOwner.DisplayName))
|
||||
Expect(jsonData.Get("user.id").String()).To(Equal(driveOwner.Id.OpaqueId))
|
||||
})
|
||||
|
||||
It("populates the driveItem.remoteItem.fileSystemInfo properties", func() {
|
||||
|
||||
share := listReceivedSharesResponse.Shares[0].Share
|
||||
share.Ctime = &typesv1beta1.Timestamp{Seconds: 400}
|
||||
|
||||
resourceInfo := statResponse.Info
|
||||
resourceInfo.Mtime = &typesv1beta1.Timestamp{Seconds: 4000}
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
|
||||
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem.fileSystemInfo")
|
||||
|
||||
Expect(jsonData.Get("createdDateTime").String()).To(Equal(utils.TSToTime(share.Ctime).Format(time.RFC3339Nano)))
|
||||
Expect(jsonData.Get("lastModifiedDateTime").String()).To(Equal(utils.TSToTime(resourceInfo.Mtime).Format(time.RFC3339Nano)))
|
||||
})
|
||||
|
||||
It("populates the driveItem.remoteItem.folder properties", func() {
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
|
||||
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem")
|
||||
|
||||
Expect(jsonData.Get("file").Exists()).To(BeFalse())
|
||||
Expect(jsonData.Get("folder.childCount").Num).To(Equal(float64(0)))
|
||||
})
|
||||
|
||||
It("populates the driveItem.remoteItem.file properties", func() {
|
||||
resourceInfo := statResponse.Info
|
||||
resourceInfo.Type = providerv1beta1.ResourceType_RESOURCE_TYPE_FILE
|
||||
resourceInfo.MimeType = "application/pdf"
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
|
||||
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem")
|
||||
|
||||
Expect(jsonData.Get("folder").Exists()).To(BeFalse())
|
||||
Expect(jsonData.Get("file.mimeType").String()).To(Equal(resourceInfo.MimeType))
|
||||
})
|
||||
|
||||
It("populates the driveItem.remoteItem.folder properties", func() {
|
||||
resourceInfo := statResponse.Info
|
||||
resourceInfo.Type = providerv1beta1.ResourceType_RESOURCE_TYPE_CONTAINER
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
|
||||
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem")
|
||||
|
||||
Expect(jsonData.Get("folder").Exists()).To(BeTrue())
|
||||
})
|
||||
|
||||
It("populates the driveItem.remoteItem.shared properties", func() {
|
||||
share := listReceivedSharesResponse.Shares[0].Share
|
||||
share.Ctime = &typesv1beta1.Timestamp{Seconds: 4000}
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
|
||||
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem.shared")
|
||||
|
||||
Expect(jsonData.Get("sharedDateTime").String()).To(Equal(utils.TSToTime(share.Ctime).Format(time.RFC3339Nano)))
|
||||
})
|
||||
|
||||
It("populates the driveItem.remoteItem.shared.owner properties", func() {
|
||||
shareCreator := getUserResponse.User
|
||||
|
||||
share := listReceivedSharesResponse.Shares[0].Share
|
||||
share.Creator = shareCreator.Id
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
|
||||
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem.shared.owner")
|
||||
|
||||
Expect(jsonData.Get("user.displayName").String()).To(Equal(shareCreator.DisplayName))
|
||||
Expect(jsonData.Get("user.id").String()).To(Equal(shareCreator.Id.OpaqueId))
|
||||
})
|
||||
|
||||
It("populates the driveItem.remoteItem.shared.sharedBy properties", func() {
|
||||
shareCreator := getUserResponse.User
|
||||
|
||||
share := listReceivedSharesResponse.Shares[0].Share
|
||||
share.Creator = shareCreator.Id
|
||||
|
||||
svc.ListSharedWithMe(
|
||||
tape,
|
||||
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
|
||||
)
|
||||
|
||||
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem.shared.sharedBy")
|
||||
|
||||
Expect(jsonData.Get("user.displayName").String()).To(Equal(shareCreator.DisplayName))
|
||||
Expect(jsonData.Get("user.id").String()).To(Equal(shareCreator.Id.OpaqueId))
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -13,12 +13,13 @@ import (
|
||||
revactx "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
libregraph "github.com/owncloud/libre-graph-api-go"
|
||||
"go-micro.dev/v4/selector"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/oidc"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/registry"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/service/v0/errorcode"
|
||||
"github.com/owncloud/ocis/v2/services/proxy/pkg/config"
|
||||
"go-micro.dev/v4/selector"
|
||||
)
|
||||
|
||||
type cs3backend struct {
|
||||
@@ -231,7 +232,7 @@ func (c cs3backend) setupLibregraphClient(ctx context.Context, cs3token string)
|
||||
lgconf := libregraph.NewConfiguration()
|
||||
lgconf.Servers = libregraph.ServerConfigurations{
|
||||
{
|
||||
URL: fmt.Sprintf("%s://%s/graph/v1.0", node.Metadata["protocol"], node.Address),
|
||||
URL: fmt.Sprintf("%s://%s/graph", node.Metadata["protocol"], node.Address),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// PatchTimeNow is here to path the package time now func,
|
||||
// this only exists for the tests context
|
||||
// PatchTimeNow is here to patch the package time now func,
|
||||
// which is used in the test suite
|
||||
func PatchTimeNow(t func() time.Time) {
|
||||
timeNow = t
|
||||
}
|
||||
|
||||
144
vendor/github.com/owncloud/libre-graph-api-go/README.md
generated
vendored
144
vendor/github.com/owncloud/libre-graph-api-go/README.md
generated
vendored
@@ -73,81 +73,81 @@ ctx = context.WithValue(context.Background(), libregraph.ContextOperationServerV
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0*
|
||||
All URIs are relative to *https://ocis.ocis-traefik.latest.owncloud.works/graph*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*ApplicationsApi* | [**GetApplication**](docs/ApplicationsApi.md#getapplication) | **Get** /applications/{application-id} | Get application by id
|
||||
*ApplicationsApi* | [**ListApplications**](docs/ApplicationsApi.md#listapplications) | **Get** /applications | Get all applications
|
||||
*DrivesApi* | [**CreateDrive**](docs/DrivesApi.md#createdrive) | **Post** /drives | Create a new drive of a specific type
|
||||
*DrivesApi* | [**DeleteDrive**](docs/DrivesApi.md#deletedrive) | **Delete** /drives/{drive-id} | Delete a specific space
|
||||
*DrivesApi* | [**GetDrive**](docs/DrivesApi.md#getdrive) | **Get** /drives/{drive-id} | Get drive by id
|
||||
*DrivesApi* | [**UpdateDrive**](docs/DrivesApi.md#updatedrive) | **Patch** /drives/{drive-id} | Update the drive
|
||||
*DrivesGetDrivesApi* | [**ListAllDrives**](docs/DrivesGetDrivesApi.md#listalldrives) | **Get** /drives | Get all available drives
|
||||
*DrivesPermissionsApi* | [**CreateLink**](docs/DrivesPermissionsApi.md#createlink) | **Post** /drives/{drive-id}/items/{item-id}/createLink | Create a sharing link for a DriveItem
|
||||
*DrivesPermissionsApi* | [**DeletePermission**](docs/DrivesPermissionsApi.md#deletepermission) | **Delete** /drives/{drive-id}/items/{item-id}/permissions/{perm-id} | Delete entity from groups
|
||||
*DrivesPermissionsApi* | [**GetPermission**](docs/DrivesPermissionsApi.md#getpermission) | **Get** /drives/{drive-id}/items/{item-id}/permissions/{perm-id} | Get sharing permission for a file or folder
|
||||
*DrivesPermissionsApi* | [**Invite**](docs/DrivesPermissionsApi.md#invite) | **Post** /drives/{drive-id}/items/{item-id}/invite | Send a sharing invitation
|
||||
*DrivesPermissionsApi* | [**ListPermissions**](docs/DrivesPermissionsApi.md#listpermissions) | **Get** /drives/{drive-id}/items/{item-id}/permissions | List the effective sharing permissions on a driveItem.
|
||||
*DrivesPermissionsApi* | [**UpdatePermission**](docs/DrivesPermissionsApi.md#updatepermission) | **Patch** /drives/{drive-id}/items/{item-id}/permissions/{perm-id} | Update sharing permission
|
||||
*DrivesRootApi* | [**GetRoot**](docs/DrivesRootApi.md#getroot) | **Get** /drives/{drive-id}/root | Get root from arbitrary space
|
||||
*EducationClassApi* | [**AddUserToClass**](docs/EducationClassApi.md#addusertoclass) | **Post** /education/classes/{class-id}/members/$ref | Assign a user to a class
|
||||
*EducationClassApi* | [**CreateClass**](docs/EducationClassApi.md#createclass) | **Post** /education/classes | Add new education class
|
||||
*EducationClassApi* | [**DeleteClass**](docs/EducationClassApi.md#deleteclass) | **Delete** /education/classes/{class-id} | Delete education class
|
||||
*EducationClassApi* | [**DeleteUserFromClass**](docs/EducationClassApi.md#deleteuserfromclass) | **Delete** /education/classes/{class-id}/members/{user-id}/$ref | Unassign user from a class
|
||||
*EducationClassApi* | [**GetClass**](docs/EducationClassApi.md#getclass) | **Get** /education/classes/{class-id} | Get class by key
|
||||
*EducationClassApi* | [**ListClassMembers**](docs/EducationClassApi.md#listclassmembers) | **Get** /education/classes/{class-id}/members | Get the educationClass resources owned by an educationSchool
|
||||
*EducationClassApi* | [**ListClasses**](docs/EducationClassApi.md#listclasses) | **Get** /education/classes | list education classes
|
||||
*EducationClassApi* | [**UpdateClass**](docs/EducationClassApi.md#updateclass) | **Patch** /education/classes/{class-id} | Update properties of a education class
|
||||
*EducationClassTeachersApi* | [**AddTeacherToClass**](docs/EducationClassTeachersApi.md#addteachertoclass) | **Post** /education/classes/{class-id}/teachers/$ref | Assign a teacher to a class
|
||||
*EducationClassTeachersApi* | [**DeleteTeacherFromClass**](docs/EducationClassTeachersApi.md#deleteteacherfromclass) | **Delete** /education/classes/{class-id}/teachers/{user-id}/$ref | Unassign user as teacher of a class
|
||||
*EducationClassTeachersApi* | [**GetTeachers**](docs/EducationClassTeachersApi.md#getteachers) | **Get** /education/classes/{class-id}/teachers | Get the teachers for a class
|
||||
*EducationSchoolApi* | [**AddClassToSchool**](docs/EducationSchoolApi.md#addclasstoschool) | **Post** /education/schools/{school-id}/classes/$ref | Assign a class to a school
|
||||
*EducationSchoolApi* | [**AddUserToSchool**](docs/EducationSchoolApi.md#addusertoschool) | **Post** /education/schools/{school-id}/users/$ref | Assign a user to a school
|
||||
*EducationSchoolApi* | [**CreateSchool**](docs/EducationSchoolApi.md#createschool) | **Post** /education/schools | Add new school
|
||||
*EducationSchoolApi* | [**DeleteClassFromSchool**](docs/EducationSchoolApi.md#deleteclassfromschool) | **Delete** /education/schools/{school-id}/classes/{class-id}/$ref | Unassign class from a school
|
||||
*EducationSchoolApi* | [**DeleteSchool**](docs/EducationSchoolApi.md#deleteschool) | **Delete** /education/schools/{school-id} | Delete school
|
||||
*EducationSchoolApi* | [**DeleteUserFromSchool**](docs/EducationSchoolApi.md#deleteuserfromschool) | **Delete** /education/schools/{school-id}/users/{user-id}/$ref | Unassign user from a school
|
||||
*EducationSchoolApi* | [**GetSchool**](docs/EducationSchoolApi.md#getschool) | **Get** /education/schools/{school-id} | Get the properties of a specific school
|
||||
*EducationSchoolApi* | [**ListSchoolClasses**](docs/EducationSchoolApi.md#listschoolclasses) | **Get** /education/schools/{school-id}/classes | Get the educationClass resources owned by an educationSchool
|
||||
*EducationSchoolApi* | [**ListSchoolUsers**](docs/EducationSchoolApi.md#listschoolusers) | **Get** /education/schools/{school-id}/users | Get the educationUser resources associated with an educationSchool
|
||||
*EducationSchoolApi* | [**ListSchools**](docs/EducationSchoolApi.md#listschools) | **Get** /education/schools | Get a list of schools and their properties
|
||||
*EducationSchoolApi* | [**UpdateSchool**](docs/EducationSchoolApi.md#updateschool) | **Patch** /education/schools/{school-id} | Update properties of a school
|
||||
*EducationUserApi* | [**CreateEducationUser**](docs/EducationUserApi.md#createeducationuser) | **Post** /education/users | Add new education user
|
||||
*EducationUserApi* | [**DeleteEducationUser**](docs/EducationUserApi.md#deleteeducationuser) | **Delete** /education/users/{user-id} | Delete educationUser
|
||||
*EducationUserApi* | [**GetEducationUser**](docs/EducationUserApi.md#geteducationuser) | **Get** /education/users/{user-id} | Get properties of educationUser
|
||||
*EducationUserApi* | [**ListEducationUsers**](docs/EducationUserApi.md#listeducationusers) | **Get** /education/users | Get entities from education users
|
||||
*EducationUserApi* | [**UpdateEducationUser**](docs/EducationUserApi.md#updateeducationuser) | **Patch** /education/users/{user-id} | Update properties of educationUser
|
||||
*GroupApi* | [**AddMember**](docs/GroupApi.md#addmember) | **Post** /groups/{group-id}/members/$ref | Add a member to a group
|
||||
*GroupApi* | [**DeleteGroup**](docs/GroupApi.md#deletegroup) | **Delete** /groups/{group-id} | Delete entity from groups
|
||||
*GroupApi* | [**DeleteMember**](docs/GroupApi.md#deletemember) | **Delete** /groups/{group-id}/members/{directory-object-id}/$ref | Delete member from a group
|
||||
*GroupApi* | [**GetGroup**](docs/GroupApi.md#getgroup) | **Get** /groups/{group-id} | Get entity from groups by key
|
||||
*GroupApi* | [**ListMembers**](docs/GroupApi.md#listmembers) | **Get** /groups/{group-id}/members | Get a list of the group's direct members
|
||||
*GroupApi* | [**UpdateGroup**](docs/GroupApi.md#updategroup) | **Patch** /groups/{group-id} | Update entity in groups
|
||||
*GroupsApi* | [**CreateGroup**](docs/GroupsApi.md#creategroup) | **Post** /groups | Add new entity to groups
|
||||
*GroupsApi* | [**ListGroups**](docs/GroupsApi.md#listgroups) | **Get** /groups | Get entities from groups
|
||||
*MeChangepasswordApi* | [**ChangeOwnPassword**](docs/MeChangepasswordApi.md#changeownpassword) | **Post** /me/changePassword | Chanage your own password
|
||||
*MeDriveApi* | [**GetHome**](docs/MeDriveApi.md#gethome) | **Get** /me/drive | Get personal space for user
|
||||
*MeDriveApi* | [**ListSharedByMe**](docs/MeDriveApi.md#listsharedbyme) | **Get** /me/drive/sharedByMe | Get a list of driveItem objects shared by the current user.
|
||||
*MeDriveApi* | [**ListSharedWithMe**](docs/MeDriveApi.md#listsharedwithme) | **Get** /me/drive/sharedWithMe | Get a list of driveItem objects shared with the owner of a drive.
|
||||
*MeDriveRootApi* | [**HomeGetRoot**](docs/MeDriveRootApi.md#homegetroot) | **Get** /me/drive/root | Get root from personal space
|
||||
*MeDriveRootChildrenApi* | [**HomeGetChildren**](docs/MeDriveRootChildrenApi.md#homegetchildren) | **Get** /me/drive/root/children | Get children from drive
|
||||
*MeDrivesApi* | [**ListMyDrives**](docs/MeDrivesApi.md#listmydrives) | **Get** /me/drives | Get all drives where the current user is a regular member of
|
||||
*MeUserApi* | [**GetOwnUser**](docs/MeUserApi.md#getownuser) | **Get** /me | Get current user
|
||||
*RoleManagementApi* | [**GetPermissionRoleDefinition**](docs/RoleManagementApi.md#getpermissionroledefinition) | **Get** /roleManagement/permissions/roleDefinitions/{role-id} | Get unifiedRoleDefinition
|
||||
*RoleManagementApi* | [**ListPermissionRoleDefinitions**](docs/RoleManagementApi.md#listpermissionroledefinitions) | **Get** /roleManagement/permissions/roleDefinitions | List roleDefinitions
|
||||
*TagsApi* | [**AssignTags**](docs/TagsApi.md#assigntags) | **Put** /extensions/org.libregraph/tags | Assign tags to a resource
|
||||
*TagsApi* | [**GetTags**](docs/TagsApi.md#gettags) | **Get** /extensions/org.libregraph/tags | Get all known tags
|
||||
*TagsApi* | [**UnassignTags**](docs/TagsApi.md#unassigntags) | **Delete** /extensions/org.libregraph/tags | Unassign tags from a resource
|
||||
*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **Delete** /users/{user-id} | Delete entity from users
|
||||
*UserApi* | [**ExportPersonalData**](docs/UserApi.md#exportpersonaldata) | **Post** /users/{user-id}/exportPersonalData | export personal data of a user
|
||||
*UserApi* | [**GetUser**](docs/UserApi.md#getuser) | **Get** /users/{user-id} | Get entity from users by key
|
||||
*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **Patch** /users/{user-id} | Update entity in users
|
||||
*UserAppRoleAssignmentApi* | [**UserCreateAppRoleAssignments**](docs/UserAppRoleAssignmentApi.md#usercreateapproleassignments) | **Post** /users/{user-id}/appRoleAssignments | Grant an appRoleAssignment to a user
|
||||
*UserAppRoleAssignmentApi* | [**UserDeleteAppRoleAssignments**](docs/UserAppRoleAssignmentApi.md#userdeleteapproleassignments) | **Delete** /users/{user-id}/appRoleAssignments/{appRoleAssignment-id} | Delete the appRoleAssignment from a user
|
||||
*UserAppRoleAssignmentApi* | [**UserListAppRoleAssignments**](docs/UserAppRoleAssignmentApi.md#userlistapproleassignments) | **Get** /users/{user-id}/appRoleAssignments | Get appRoleAssignments from a user
|
||||
*UsersApi* | [**CreateUser**](docs/UsersApi.md#createuser) | **Post** /users | Add new entity to users
|
||||
*UsersApi* | [**ListUsers**](docs/UsersApi.md#listusers) | **Get** /users | Get entities from users
|
||||
*ApplicationsApi* | [**GetApplication**](docs/ApplicationsApi.md#getapplication) | **Get** /v1.0/applications/{application-id} | Get application by id
|
||||
*ApplicationsApi* | [**ListApplications**](docs/ApplicationsApi.md#listapplications) | **Get** /v1.0/applications | Get all applications
|
||||
*DrivesApi* | [**CreateDrive**](docs/DrivesApi.md#createdrive) | **Post** /v1.0/drives | Create a new drive of a specific type
|
||||
*DrivesApi* | [**DeleteDrive**](docs/DrivesApi.md#deletedrive) | **Delete** /v1.0/drives/{drive-id} | Delete a specific space
|
||||
*DrivesApi* | [**GetDrive**](docs/DrivesApi.md#getdrive) | **Get** /v1.0/drives/{drive-id} | Get drive by id
|
||||
*DrivesApi* | [**UpdateDrive**](docs/DrivesApi.md#updatedrive) | **Patch** /v1.0/drives/{drive-id} | Update the drive
|
||||
*DrivesGetDrivesApi* | [**ListAllDrives**](docs/DrivesGetDrivesApi.md#listalldrives) | **Get** /v1.0/drives | Get all available drives
|
||||
*DrivesPermissionsApi* | [**CreateLink**](docs/DrivesPermissionsApi.md#createlink) | **Post** /v1beta1/drives/{drive-id}/items/{item-id}/createLink | Create a sharing link for a DriveItem
|
||||
*DrivesPermissionsApi* | [**DeletePermission**](docs/DrivesPermissionsApi.md#deletepermission) | **Delete** /v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id} | Remove access to a DriveItem
|
||||
*DrivesPermissionsApi* | [**GetPermission**](docs/DrivesPermissionsApi.md#getpermission) | **Get** /v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id} | Get sharing permission for a file or folder
|
||||
*DrivesPermissionsApi* | [**Invite**](docs/DrivesPermissionsApi.md#invite) | **Post** /v1beta1/drives/{drive-id}/items/{item-id}/invite | Send a sharing invitation
|
||||
*DrivesPermissionsApi* | [**ListPermissions**](docs/DrivesPermissionsApi.md#listpermissions) | **Get** /v1beta1/drives/{drive-id}/items/{item-id}/permissions | List the effective sharing permissions on a driveItem.
|
||||
*DrivesPermissionsApi* | [**UpdatePermission**](docs/DrivesPermissionsApi.md#updatepermission) | **Patch** /v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id} | Update sharing permission
|
||||
*DrivesRootApi* | [**GetRoot**](docs/DrivesRootApi.md#getroot) | **Get** /v1.0/drives/{drive-id}/root | Get root from arbitrary space
|
||||
*EducationClassApi* | [**AddUserToClass**](docs/EducationClassApi.md#addusertoclass) | **Post** /v1.0/education/classes/{class-id}/members/$ref | Assign a user to a class
|
||||
*EducationClassApi* | [**CreateClass**](docs/EducationClassApi.md#createclass) | **Post** /v1.0/education/classes | Add new education class
|
||||
*EducationClassApi* | [**DeleteClass**](docs/EducationClassApi.md#deleteclass) | **Delete** /v1.0/education/classes/{class-id} | Delete education class
|
||||
*EducationClassApi* | [**DeleteUserFromClass**](docs/EducationClassApi.md#deleteuserfromclass) | **Delete** /v1.0/education/classes/{class-id}/members/{user-id}/$ref | Unassign user from a class
|
||||
*EducationClassApi* | [**GetClass**](docs/EducationClassApi.md#getclass) | **Get** /v1.0/education/classes/{class-id} | Get class by key
|
||||
*EducationClassApi* | [**ListClassMembers**](docs/EducationClassApi.md#listclassmembers) | **Get** /v1.0/education/classes/{class-id}/members | Get the educationClass resources owned by an educationSchool
|
||||
*EducationClassApi* | [**ListClasses**](docs/EducationClassApi.md#listclasses) | **Get** /v1.0/education/classes | list education classes
|
||||
*EducationClassApi* | [**UpdateClass**](docs/EducationClassApi.md#updateclass) | **Patch** /v1.0/education/classes/{class-id} | Update properties of a education class
|
||||
*EducationClassTeachersApi* | [**AddTeacherToClass**](docs/EducationClassTeachersApi.md#addteachertoclass) | **Post** /v1.0/education/classes/{class-id}/teachers/$ref | Assign a teacher to a class
|
||||
*EducationClassTeachersApi* | [**DeleteTeacherFromClass**](docs/EducationClassTeachersApi.md#deleteteacherfromclass) | **Delete** /v1.0/education/classes/{class-id}/teachers/{user-id}/$ref | Unassign user as teacher of a class
|
||||
*EducationClassTeachersApi* | [**GetTeachers**](docs/EducationClassTeachersApi.md#getteachers) | **Get** /v1.0/education/classes/{class-id}/teachers | Get the teachers for a class
|
||||
*EducationSchoolApi* | [**AddClassToSchool**](docs/EducationSchoolApi.md#addclasstoschool) | **Post** /v1.0/education/schools/{school-id}/classes/$ref | Assign a class to a school
|
||||
*EducationSchoolApi* | [**AddUserToSchool**](docs/EducationSchoolApi.md#addusertoschool) | **Post** /v1.0/education/schools/{school-id}/users/$ref | Assign a user to a school
|
||||
*EducationSchoolApi* | [**CreateSchool**](docs/EducationSchoolApi.md#createschool) | **Post** /v1.0/education/schools | Add new school
|
||||
*EducationSchoolApi* | [**DeleteClassFromSchool**](docs/EducationSchoolApi.md#deleteclassfromschool) | **Delete** /v1.0/education/schools/{school-id}/classes/{class-id}/$ref | Unassign class from a school
|
||||
*EducationSchoolApi* | [**DeleteSchool**](docs/EducationSchoolApi.md#deleteschool) | **Delete** /v1.0/education/schools/{school-id} | Delete school
|
||||
*EducationSchoolApi* | [**DeleteUserFromSchool**](docs/EducationSchoolApi.md#deleteuserfromschool) | **Delete** /v1.0/education/schools/{school-id}/users/{user-id}/$ref | Unassign user from a school
|
||||
*EducationSchoolApi* | [**GetSchool**](docs/EducationSchoolApi.md#getschool) | **Get** /v1.0/education/schools/{school-id} | Get the properties of a specific school
|
||||
*EducationSchoolApi* | [**ListSchoolClasses**](docs/EducationSchoolApi.md#listschoolclasses) | **Get** /v1.0/education/schools/{school-id}/classes | Get the educationClass resources owned by an educationSchool
|
||||
*EducationSchoolApi* | [**ListSchoolUsers**](docs/EducationSchoolApi.md#listschoolusers) | **Get** /v1.0/education/schools/{school-id}/users | Get the educationUser resources associated with an educationSchool
|
||||
*EducationSchoolApi* | [**ListSchools**](docs/EducationSchoolApi.md#listschools) | **Get** /v1.0/education/schools | Get a list of schools and their properties
|
||||
*EducationSchoolApi* | [**UpdateSchool**](docs/EducationSchoolApi.md#updateschool) | **Patch** /v1.0/education/schools/{school-id} | Update properties of a school
|
||||
*EducationUserApi* | [**CreateEducationUser**](docs/EducationUserApi.md#createeducationuser) | **Post** /v1.0/education/users | Add new education user
|
||||
*EducationUserApi* | [**DeleteEducationUser**](docs/EducationUserApi.md#deleteeducationuser) | **Delete** /v1.0/education/users/{user-id} | Delete educationUser
|
||||
*EducationUserApi* | [**GetEducationUser**](docs/EducationUserApi.md#geteducationuser) | **Get** /v1.0/education/users/{user-id} | Get properties of educationUser
|
||||
*EducationUserApi* | [**ListEducationUsers**](docs/EducationUserApi.md#listeducationusers) | **Get** /v1.0/education/users | Get entities from education users
|
||||
*EducationUserApi* | [**UpdateEducationUser**](docs/EducationUserApi.md#updateeducationuser) | **Patch** /v1.0/education/users/{user-id} | Update properties of educationUser
|
||||
*GroupApi* | [**AddMember**](docs/GroupApi.md#addmember) | **Post** /v1.0/groups/{group-id}/members/$ref | Add a member to a group
|
||||
*GroupApi* | [**DeleteGroup**](docs/GroupApi.md#deletegroup) | **Delete** /v1.0/groups/{group-id} | Delete entity from groups
|
||||
*GroupApi* | [**DeleteMember**](docs/GroupApi.md#deletemember) | **Delete** /v1.0/groups/{group-id}/members/{directory-object-id}/$ref | Delete member from a group
|
||||
*GroupApi* | [**GetGroup**](docs/GroupApi.md#getgroup) | **Get** /v1.0/groups/{group-id} | Get entity from groups by key
|
||||
*GroupApi* | [**ListMembers**](docs/GroupApi.md#listmembers) | **Get** /v1.0/groups/{group-id}/members | Get a list of the group's direct members
|
||||
*GroupApi* | [**UpdateGroup**](docs/GroupApi.md#updategroup) | **Patch** /v1.0/groups/{group-id} | Update entity in groups
|
||||
*GroupsApi* | [**CreateGroup**](docs/GroupsApi.md#creategroup) | **Post** /v1.0/groups | Add new entity to groups
|
||||
*GroupsApi* | [**ListGroups**](docs/GroupsApi.md#listgroups) | **Get** /v1.0/groups | Get entities from groups
|
||||
*MeChangepasswordApi* | [**ChangeOwnPassword**](docs/MeChangepasswordApi.md#changeownpassword) | **Post** /v1.0/me/changePassword | Chanage your own password
|
||||
*MeDriveApi* | [**GetHome**](docs/MeDriveApi.md#gethome) | **Get** /v1.0/me/drive | Get personal space for user
|
||||
*MeDriveApi* | [**ListSharedByMe**](docs/MeDriveApi.md#listsharedbyme) | **Get** /v1beta1/me/drive/sharedByMe | Get a list of driveItem objects shared by the current user.
|
||||
*MeDriveApi* | [**ListSharedWithMe**](docs/MeDriveApi.md#listsharedwithme) | **Get** /v1beta1/me/drive/sharedWithMe | Get a list of driveItem objects shared with the owner of a drive.
|
||||
*MeDriveRootApi* | [**HomeGetRoot**](docs/MeDriveRootApi.md#homegetroot) | **Get** /v1.0/me/drive/root | Get root from personal space
|
||||
*MeDriveRootChildrenApi* | [**HomeGetChildren**](docs/MeDriveRootChildrenApi.md#homegetchildren) | **Get** /v1.0/me/drive/root/children | Get children from drive
|
||||
*MeDrivesApi* | [**ListMyDrives**](docs/MeDrivesApi.md#listmydrives) | **Get** /v1.0/me/drives | Get all drives where the current user is a regular member of
|
||||
*MeUserApi* | [**GetOwnUser**](docs/MeUserApi.md#getownuser) | **Get** /v1.0/me | Get current user
|
||||
*RoleManagementApi* | [**GetPermissionRoleDefinition**](docs/RoleManagementApi.md#getpermissionroledefinition) | **Get** /v1beta1/roleManagement/permissions/roleDefinitions/{role-id} | Get unifiedRoleDefinition
|
||||
*RoleManagementApi* | [**ListPermissionRoleDefinitions**](docs/RoleManagementApi.md#listpermissionroledefinitions) | **Get** /v1beta1/roleManagement/permissions/roleDefinitions | List roleDefinitions
|
||||
*TagsApi* | [**AssignTags**](docs/TagsApi.md#assigntags) | **Put** /v1.0/extensions/org.libregraph/tags | Assign tags to a resource
|
||||
*TagsApi* | [**GetTags**](docs/TagsApi.md#gettags) | **Get** /v1.0/extensions/org.libregraph/tags | Get all known tags
|
||||
*TagsApi* | [**UnassignTags**](docs/TagsApi.md#unassigntags) | **Delete** /v1.0/extensions/org.libregraph/tags | Unassign tags from a resource
|
||||
*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **Delete** /v1.0/users/{user-id} | Delete entity from users
|
||||
*UserApi* | [**ExportPersonalData**](docs/UserApi.md#exportpersonaldata) | **Post** /v1.0/users/{user-id}/exportPersonalData | export personal data of a user
|
||||
*UserApi* | [**GetUser**](docs/UserApi.md#getuser) | **Get** /v1.0/users/{user-id} | Get entity from users by key
|
||||
*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **Patch** /v1.0/users/{user-id} | Update entity in users
|
||||
*UserAppRoleAssignmentApi* | [**UserCreateAppRoleAssignments**](docs/UserAppRoleAssignmentApi.md#usercreateapproleassignments) | **Post** /v1.0/users/{user-id}/appRoleAssignments | Grant an appRoleAssignment to a user
|
||||
*UserAppRoleAssignmentApi* | [**UserDeleteAppRoleAssignments**](docs/UserAppRoleAssignmentApi.md#userdeleteapproleassignments) | **Delete** /v1.0/users/{user-id}/appRoleAssignments/{appRoleAssignment-id} | Delete the appRoleAssignment from a user
|
||||
*UserAppRoleAssignmentApi* | [**UserListAppRoleAssignments**](docs/UserAppRoleAssignmentApi.md#userlistapproleassignments) | **Get** /v1.0/users/{user-id}/appRoleAssignments | Get appRoleAssignments from a user
|
||||
*UsersApi* | [**CreateUser**](docs/UsersApi.md#createuser) | **Post** /v1.0/users | Add new entity to users
|
||||
*UsersApi* | [**ListUsers**](docs/UsersApi.md#listusers) | **Get** /v1.0/users | Get entities from users
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
4
vendor/github.com/owncloud/libre-graph-api-go/api_applications.go
generated
vendored
4
vendor/github.com/owncloud/libre-graph-api-go/api_applications.go
generated
vendored
@@ -62,7 +62,7 @@ func (a *ApplicationsApiService) GetApplicationExecute(r ApiGetApplicationReques
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/applications/{application-id}"
|
||||
localVarPath := localBasePath + "/v1.0/applications/{application-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"application-id"+"}", url.PathEscape(parameterValueToString(r.applicationId, "applicationId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -168,7 +168,7 @@ func (a *ApplicationsApiService) ListApplicationsExecute(r ApiListApplicationsRe
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/applications"
|
||||
localVarPath := localBasePath + "/v1.0/applications"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
||||
8
vendor/github.com/owncloud/libre-graph-api-go/api_drives.go
generated
vendored
8
vendor/github.com/owncloud/libre-graph-api-go/api_drives.go
generated
vendored
@@ -66,7 +66,7 @@ func (a *DrivesApiService) CreateDriveExecute(r ApiCreateDriveRequest) (*Drive,
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/drives"
|
||||
localVarPath := localBasePath + "/v1.0/drives"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@@ -184,7 +184,7 @@ func (a *DrivesApiService) DeleteDriveExecute(r ApiDeleteDriveRequest) (*http.Re
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/drives/{drive-id}"
|
||||
localVarPath := localBasePath + "/v1.0/drives/{drive-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -287,7 +287,7 @@ func (a *DrivesApiService) GetDriveExecute(r ApiGetDriveRequest) (*Drive, *http.
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/drives/{drive-id}"
|
||||
localVarPath := localBasePath + "/v1.0/drives/{drive-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -403,7 +403,7 @@ func (a *DrivesApiService) UpdateDriveExecute(r ApiUpdateDriveRequest) (*Drive,
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/drives/{drive-id}"
|
||||
localVarPath := localBasePath + "/v1.0/drives/{drive-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
|
||||
2
vendor/github.com/owncloud/libre-graph-api-go/api_drives_get_drives.go
generated
vendored
2
vendor/github.com/owncloud/libre-graph-api-go/api_drives_get_drives.go
generated
vendored
@@ -72,7 +72,7 @@ func (a *DrivesGetDrivesApiService) ListAllDrivesExecute(r ApiListAllDrivesReque
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/drives"
|
||||
localVarPath := localBasePath + "/v1.0/drives"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
||||
14
vendor/github.com/owncloud/libre-graph-api-go/api_drives_permissions.go
generated
vendored
14
vendor/github.com/owncloud/libre-graph-api-go/api_drives_permissions.go
generated
vendored
@@ -89,7 +89,7 @@ func (a *DrivesPermissionsApiService) CreateLinkExecute(r ApiCreateLinkRequest)
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/drives/{drive-id}/items/{item-id}/createLink"
|
||||
localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/items/{item-id}/createLink"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"item-id"+"}", url.PathEscape(parameterValueToString(r.itemId, "itemId")), -1)
|
||||
|
||||
@@ -174,7 +174,7 @@ func (r ApiDeletePermissionRequest) Execute() (*http.Response, error) {
|
||||
}
|
||||
|
||||
/*
|
||||
DeletePermission Delete entity from groups
|
||||
DeletePermission Remove access to a DriveItem
|
||||
|
||||
Remove access to a DriveItem.
|
||||
|
||||
@@ -210,7 +210,7 @@ func (a *DrivesPermissionsApiService) DeletePermissionExecute(r ApiDeletePermiss
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/drives/{drive-id}/items/{item-id}/permissions/{perm-id}"
|
||||
localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"item-id"+"}", url.PathEscape(parameterValueToString(r.itemId, "itemId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"perm-id"+"}", url.PathEscape(parameterValueToString(r.permId, "permId")), -1)
|
||||
@@ -321,7 +321,7 @@ func (a *DrivesPermissionsApiService) GetPermissionExecute(r ApiGetPermissionReq
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/drives/{drive-id}/items/{item-id}/permissions/{perm-id}"
|
||||
localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"item-id"+"}", url.PathEscape(parameterValueToString(r.itemId, "itemId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"perm-id"+"}", url.PathEscape(parameterValueToString(r.permId, "permId")), -1)
|
||||
@@ -451,7 +451,7 @@ func (a *DrivesPermissionsApiService) InviteExecute(r ApiInviteRequest) (*Permis
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/drives/{drive-id}/items/{item-id}/invite"
|
||||
localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/items/{item-id}/invite"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"item-id"+"}", url.PathEscape(parameterValueToString(r.itemId, "itemId")), -1)
|
||||
|
||||
@@ -588,7 +588,7 @@ func (a *DrivesPermissionsApiService) ListPermissionsExecute(r ApiListPermission
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/drives/{drive-id}/items/{item-id}/permissions"
|
||||
localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/items/{item-id}/permissions"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"item-id"+"}", url.PathEscape(parameterValueToString(r.itemId, "itemId")), -1)
|
||||
|
||||
@@ -716,7 +716,7 @@ func (a *DrivesPermissionsApiService) UpdatePermissionExecute(r ApiUpdatePermiss
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/drives/{drive-id}/items/{item-id}/permissions/{perm-id}"
|
||||
localVarPath := localBasePath + "/v1beta1/drives/{drive-id}/items/{item-id}/permissions/{perm-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"item-id"+"}", url.PathEscape(parameterValueToString(r.itemId, "itemId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"perm-id"+"}", url.PathEscape(parameterValueToString(r.permId, "permId")), -1)
|
||||
|
||||
2
vendor/github.com/owncloud/libre-graph-api-go/api_drives_root.go
generated
vendored
2
vendor/github.com/owncloud/libre-graph-api-go/api_drives_root.go
generated
vendored
@@ -62,7 +62,7 @@ func (a *DrivesRootApiService) GetRootExecute(r ApiGetRootRequest) (*DriveItem,
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/drives/{drive-id}/root"
|
||||
localVarPath := localBasePath + "/v1.0/drives/{drive-id}/root"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"drive-id"+"}", url.PathEscape(parameterValueToString(r.driveId, "driveId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
|
||||
16
vendor/github.com/owncloud/libre-graph-api-go/api_education_class.go
generated
vendored
16
vendor/github.com/owncloud/libre-graph-api-go/api_education_class.go
generated
vendored
@@ -67,7 +67,7 @@ func (a *EducationClassApiService) AddUserToClassExecute(r ApiAddUserToClassRequ
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/classes/{class-id}/members/$ref"
|
||||
localVarPath := localBasePath + "/v1.0/education/classes/{class-id}/members/$ref"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"class-id"+"}", url.PathEscape(parameterValueToString(r.classId, "classId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -176,7 +176,7 @@ func (a *EducationClassApiService) CreateClassExecute(r ApiCreateClassRequest) (
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/classes"
|
||||
localVarPath := localBasePath + "/v1.0/education/classes"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@@ -287,7 +287,7 @@ func (a *EducationClassApiService) DeleteClassExecute(r ApiDeleteClassRequest) (
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/classes/{class-id}"
|
||||
localVarPath := localBasePath + "/v1.0/education/classes/{class-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"class-id"+"}", url.PathEscape(parameterValueToString(r.classId, "classId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -388,7 +388,7 @@ func (a *EducationClassApiService) DeleteUserFromClassExecute(r ApiDeleteUserFro
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/classes/{class-id}/members/{user-id}/$ref"
|
||||
localVarPath := localBasePath + "/v1.0/education/classes/{class-id}/members/{user-id}/$ref"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"class-id"+"}", url.PathEscape(parameterValueToString(r.classId, "classId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"user-id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||||
|
||||
@@ -489,7 +489,7 @@ func (a *EducationClassApiService) GetClassExecute(r ApiGetClassRequest) (*Educa
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/classes/{class-id}"
|
||||
localVarPath := localBasePath + "/v1.0/education/classes/{class-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"class-id"+"}", url.PathEscape(parameterValueToString(r.classId, "classId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -598,7 +598,7 @@ func (a *EducationClassApiService) ListClassMembersExecute(r ApiListClassMembers
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/classes/{class-id}/members"
|
||||
localVarPath := localBasePath + "/v1.0/education/classes/{class-id}/members"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"class-id"+"}", url.PathEscape(parameterValueToString(r.classId, "classId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -704,7 +704,7 @@ func (a *EducationClassApiService) ListClassesExecute(r ApiListClassesRequest) (
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/classes"
|
||||
localVarPath := localBasePath + "/v1.0/education/classes"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@@ -819,7 +819,7 @@ func (a *EducationClassApiService) UpdateClassExecute(r ApiUpdateClassRequest) (
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/classes/{class-id}"
|
||||
localVarPath := localBasePath + "/v1.0/education/classes/{class-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"class-id"+"}", url.PathEscape(parameterValueToString(r.classId, "classId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
|
||||
6
vendor/github.com/owncloud/libre-graph-api-go/api_education_class_teachers.go
generated
vendored
6
vendor/github.com/owncloud/libre-graph-api-go/api_education_class_teachers.go
generated
vendored
@@ -67,7 +67,7 @@ func (a *EducationClassTeachersApiService) AddTeacherToClassExecute(r ApiAddTeac
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/classes/{class-id}/teachers/$ref"
|
||||
localVarPath := localBasePath + "/v1.0/education/classes/{class-id}/teachers/$ref"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"class-id"+"}", url.PathEscape(parameterValueToString(r.classId, "classId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -173,7 +173,7 @@ func (a *EducationClassTeachersApiService) DeleteTeacherFromClassExecute(r ApiDe
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/classes/{class-id}/teachers/{user-id}/$ref"
|
||||
localVarPath := localBasePath + "/v1.0/education/classes/{class-id}/teachers/{user-id}/$ref"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"class-id"+"}", url.PathEscape(parameterValueToString(r.classId, "classId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"user-id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||||
|
||||
@@ -274,7 +274,7 @@ func (a *EducationClassTeachersApiService) GetTeachersExecute(r ApiGetTeachersRe
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/classes/{class-id}/teachers"
|
||||
localVarPath := localBasePath + "/v1.0/education/classes/{class-id}/teachers"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"class-id"+"}", url.PathEscape(parameterValueToString(r.classId, "classId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
|
||||
22
vendor/github.com/owncloud/libre-graph-api-go/api_education_school.go
generated
vendored
22
vendor/github.com/owncloud/libre-graph-api-go/api_education_school.go
generated
vendored
@@ -67,7 +67,7 @@ func (a *EducationSchoolApiService) AddClassToSchoolExecute(r ApiAddClassToSchoo
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/schools/{school-id}/classes/$ref"
|
||||
localVarPath := localBasePath + "/v1.0/education/schools/{school-id}/classes/$ref"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"school-id"+"}", url.PathEscape(parameterValueToString(r.schoolId, "schoolId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -177,7 +177,7 @@ func (a *EducationSchoolApiService) AddUserToSchoolExecute(r ApiAddUserToSchoolR
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/schools/{school-id}/users/$ref"
|
||||
localVarPath := localBasePath + "/v1.0/education/schools/{school-id}/users/$ref"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"school-id"+"}", url.PathEscape(parameterValueToString(r.schoolId, "schoolId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -286,7 +286,7 @@ func (a *EducationSchoolApiService) CreateSchoolExecute(r ApiCreateSchoolRequest
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/schools"
|
||||
localVarPath := localBasePath + "/v1.0/education/schools"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@@ -400,7 +400,7 @@ func (a *EducationSchoolApiService) DeleteClassFromSchoolExecute(r ApiDeleteClas
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/schools/{school-id}/classes/{class-id}/$ref"
|
||||
localVarPath := localBasePath + "/v1.0/education/schools/{school-id}/classes/{class-id}/$ref"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"school-id"+"}", url.PathEscape(parameterValueToString(r.schoolId, "schoolId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"class-id"+"}", url.PathEscape(parameterValueToString(r.classId, "classId")), -1)
|
||||
|
||||
@@ -501,7 +501,7 @@ func (a *EducationSchoolApiService) DeleteSchoolExecute(r ApiDeleteSchoolRequest
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/schools/{school-id}"
|
||||
localVarPath := localBasePath + "/v1.0/education/schools/{school-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"school-id"+"}", url.PathEscape(parameterValueToString(r.schoolId, "schoolId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -602,7 +602,7 @@ func (a *EducationSchoolApiService) DeleteUserFromSchoolExecute(r ApiDeleteUserF
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/schools/{school-id}/users/{user-id}/$ref"
|
||||
localVarPath := localBasePath + "/v1.0/education/schools/{school-id}/users/{user-id}/$ref"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"school-id"+"}", url.PathEscape(parameterValueToString(r.schoolId, "schoolId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"user-id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||||
|
||||
@@ -703,7 +703,7 @@ func (a *EducationSchoolApiService) GetSchoolExecute(r ApiGetSchoolRequest) (*Ed
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/schools/{school-id}"
|
||||
localVarPath := localBasePath + "/v1.0/education/schools/{school-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"school-id"+"}", url.PathEscape(parameterValueToString(r.schoolId, "schoolId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -812,7 +812,7 @@ func (a *EducationSchoolApiService) ListSchoolClassesExecute(r ApiListSchoolClas
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/schools/{school-id}/classes"
|
||||
localVarPath := localBasePath + "/v1.0/education/schools/{school-id}/classes"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"school-id"+"}", url.PathEscape(parameterValueToString(r.schoolId, "schoolId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -921,7 +921,7 @@ func (a *EducationSchoolApiService) ListSchoolUsersExecute(r ApiListSchoolUsersR
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/schools/{school-id}/users"
|
||||
localVarPath := localBasePath + "/v1.0/education/schools/{school-id}/users"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"school-id"+"}", url.PathEscape(parameterValueToString(r.schoolId, "schoolId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -1027,7 +1027,7 @@ func (a *EducationSchoolApiService) ListSchoolsExecute(r ApiListSchoolsRequest)
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/schools"
|
||||
localVarPath := localBasePath + "/v1.0/education/schools"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@@ -1142,7 +1142,7 @@ func (a *EducationSchoolApiService) UpdateSchoolExecute(r ApiUpdateSchoolRequest
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/schools/{school-id}"
|
||||
localVarPath := localBasePath + "/v1.0/education/schools/{school-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"school-id"+"}", url.PathEscape(parameterValueToString(r.schoolId, "schoolId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
|
||||
10
vendor/github.com/owncloud/libre-graph-api-go/api_education_user.go
generated
vendored
10
vendor/github.com/owncloud/libre-graph-api-go/api_education_user.go
generated
vendored
@@ -66,7 +66,7 @@ func (a *EducationUserApiService) CreateEducationUserExecute(r ApiCreateEducatio
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/users"
|
||||
localVarPath := localBasePath + "/v1.0/education/users"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@@ -177,7 +177,7 @@ func (a *EducationUserApiService) DeleteEducationUserExecute(r ApiDeleteEducatio
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/users/{user-id}"
|
||||
localVarPath := localBasePath + "/v1.0/education/users/{user-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"user-id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -284,7 +284,7 @@ func (a *EducationUserApiService) GetEducationUserExecute(r ApiGetEducationUserR
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/users/{user-id}"
|
||||
localVarPath := localBasePath + "/v1.0/education/users/{user-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"user-id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -407,7 +407,7 @@ func (a *EducationUserApiService) ListEducationUsersExecute(r ApiListEducationUs
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/users"
|
||||
localVarPath := localBasePath + "/v1.0/education/users"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@@ -528,7 +528,7 @@ func (a *EducationUserApiService) UpdateEducationUserExecute(r ApiUpdateEducatio
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/education/users/{user-id}"
|
||||
localVarPath := localBasePath + "/v1.0/education/users/{user-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"user-id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
|
||||
12
vendor/github.com/owncloud/libre-graph-api-go/api_group.go
generated
vendored
12
vendor/github.com/owncloud/libre-graph-api-go/api_group.go
generated
vendored
@@ -67,7 +67,7 @@ func (a *GroupApiService) AddMemberExecute(r ApiAddMemberRequest) (*http.Respons
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/groups/{group-id}/members/$ref"
|
||||
localVarPath := localBasePath + "/v1.0/groups/{group-id}/members/$ref"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"group-id"+"}", url.PathEscape(parameterValueToString(r.groupId, "groupId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -177,7 +177,7 @@ func (a *GroupApiService) DeleteGroupExecute(r ApiDeleteGroupRequest) (*http.Res
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/groups/{group-id}"
|
||||
localVarPath := localBasePath + "/v1.0/groups/{group-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"group-id"+"}", url.PathEscape(parameterValueToString(r.groupId, "groupId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -288,7 +288,7 @@ func (a *GroupApiService) DeleteMemberExecute(r ApiDeleteMemberRequest) (*http.R
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/groups/{group-id}/members/{directory-object-id}/$ref"
|
||||
localVarPath := localBasePath + "/v1.0/groups/{group-id}/members/{directory-object-id}/$ref"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"group-id"+"}", url.PathEscape(parameterValueToString(r.groupId, "groupId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"directory-object-id"+"}", url.PathEscape(parameterValueToString(r.directoryObjectId, "directoryObjectId")), -1)
|
||||
|
||||
@@ -406,7 +406,7 @@ func (a *GroupApiService) GetGroupExecute(r ApiGetGroupRequest) (*Group, *http.R
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/groups/{group-id}"
|
||||
localVarPath := localBasePath + "/v1.0/groups/{group-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"group-id"+"}", url.PathEscape(parameterValueToString(r.groupId, "groupId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -521,7 +521,7 @@ func (a *GroupApiService) ListMembersExecute(r ApiListMembersRequest) (*Collecti
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/groups/{group-id}/members"
|
||||
localVarPath := localBasePath + "/v1.0/groups/{group-id}/members"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"group-id"+"}", url.PathEscape(parameterValueToString(r.groupId, "groupId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -635,7 +635,7 @@ func (a *GroupApiService) UpdateGroupExecute(r ApiUpdateGroupRequest) (*http.Res
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/groups/{group-id}"
|
||||
localVarPath := localBasePath + "/v1.0/groups/{group-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"group-id"+"}", url.PathEscape(parameterValueToString(r.groupId, "groupId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
|
||||
4
vendor/github.com/owncloud/libre-graph-api-go/api_groups.go
generated
vendored
4
vendor/github.com/owncloud/libre-graph-api-go/api_groups.go
generated
vendored
@@ -65,7 +65,7 @@ func (a *GroupsApiService) CreateGroupExecute(r ApiCreateGroupRequest) (*Group,
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/groups"
|
||||
localVarPath := localBasePath + "/v1.0/groups"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@@ -203,7 +203,7 @@ func (a *GroupsApiService) ListGroupsExecute(r ApiListGroupsRequest) (*Collectio
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/groups"
|
||||
localVarPath := localBasePath + "/v1.0/groups"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
||||
2
vendor/github.com/owncloud/libre-graph-api-go/api_me_changepassword.go
generated
vendored
2
vendor/github.com/owncloud/libre-graph-api-go/api_me_changepassword.go
generated
vendored
@@ -63,7 +63,7 @@ func (a *MeChangepasswordApiService) ChangeOwnPasswordExecute(r ApiChangeOwnPass
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/me/changePassword"
|
||||
localVarPath := localBasePath + "/v1.0/me/changePassword"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
||||
6
vendor/github.com/owncloud/libre-graph-api-go/api_me_drive.go
generated
vendored
6
vendor/github.com/owncloud/libre-graph-api-go/api_me_drive.go
generated
vendored
@@ -58,7 +58,7 @@ func (a *MeDriveApiService) GetHomeExecute(r ApiGetHomeRequest) (*Drive, *http.R
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/me/drive"
|
||||
localVarPath := localBasePath + "/v1.0/me/drive"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@@ -166,7 +166,7 @@ func (a *MeDriveApiService) ListSharedByMeExecute(r ApiListSharedByMeRequest) (*
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/me/drive/sharedByMe"
|
||||
localVarPath := localBasePath + "/v1beta1/me/drive/sharedByMe"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@@ -274,7 +274,7 @@ func (a *MeDriveApiService) ListSharedWithMeExecute(r ApiListSharedWithMeRequest
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/me/drive/sharedWithMe"
|
||||
localVarPath := localBasePath + "/v1beta1/me/drive/sharedWithMe"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
||||
2
vendor/github.com/owncloud/libre-graph-api-go/api_me_drive_root.go
generated
vendored
2
vendor/github.com/owncloud/libre-graph-api-go/api_me_drive_root.go
generated
vendored
@@ -58,7 +58,7 @@ func (a *MeDriveRootApiService) HomeGetRootExecute(r ApiHomeGetRootRequest) (*Dr
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/me/drive/root"
|
||||
localVarPath := localBasePath + "/v1.0/me/drive/root"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
||||
2
vendor/github.com/owncloud/libre-graph-api-go/api_me_drive_root_children.go
generated
vendored
2
vendor/github.com/owncloud/libre-graph-api-go/api_me_drive_root_children.go
generated
vendored
@@ -58,7 +58,7 @@ func (a *MeDriveRootChildrenApiService) HomeGetChildrenExecute(r ApiHomeGetChild
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/me/drive/root/children"
|
||||
localVarPath := localBasePath + "/v1.0/me/drive/root/children"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
||||
2
vendor/github.com/owncloud/libre-graph-api-go/api_me_drives.go
generated
vendored
2
vendor/github.com/owncloud/libre-graph-api-go/api_me_drives.go
generated
vendored
@@ -72,7 +72,7 @@ func (a *MeDrivesApiService) ListMyDrivesExecute(r ApiListMyDrivesRequest) (*Col
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/me/drives"
|
||||
localVarPath := localBasePath + "/v1.0/me/drives"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
||||
2
vendor/github.com/owncloud/libre-graph-api-go/api_me_user.go
generated
vendored
2
vendor/github.com/owncloud/libre-graph-api-go/api_me_user.go
generated
vendored
@@ -65,7 +65,7 @@ func (a *MeUserApiService) GetOwnUserExecute(r ApiGetOwnUserRequest) (*User, *ht
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/me"
|
||||
localVarPath := localBasePath + "/v1.0/me"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
||||
4
vendor/github.com/owncloud/libre-graph-api-go/api_role_management.go
generated
vendored
4
vendor/github.com/owncloud/libre-graph-api-go/api_role_management.go
generated
vendored
@@ -65,7 +65,7 @@ func (a *RoleManagementApiService) GetPermissionRoleDefinitionExecute(r ApiGetPe
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/roleManagement/permissions/roleDefinitions/{role-id}"
|
||||
localVarPath := localBasePath + "/v1beta1/roleManagement/permissions/roleDefinitions/{role-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"role-id"+"}", url.PathEscape(parameterValueToString(r.roleId, "roleId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -174,7 +174,7 @@ func (a *RoleManagementApiService) ListPermissionRoleDefinitionsExecute(r ApiLis
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/roleManagement/permissions/roleDefinitions"
|
||||
localVarPath := localBasePath + "/v1beta1/roleManagement/permissions/roleDefinitions"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
||||
6
vendor/github.com/owncloud/libre-graph-api-go/api_tags.go
generated
vendored
6
vendor/github.com/owncloud/libre-graph-api-go/api_tags.go
generated
vendored
@@ -62,7 +62,7 @@ func (a *TagsApiService) AssignTagsExecute(r ApiAssignTagsRequest) (*http.Respon
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/extensions/org.libregraph/tags"
|
||||
localVarPath := localBasePath + "/v1.0/extensions/org.libregraph/tags"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@@ -160,7 +160,7 @@ func (a *TagsApiService) GetTagsExecute(r ApiGetTagsRequest) (*CollectionOfTags,
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/extensions/org.libregraph/tags"
|
||||
localVarPath := localBasePath + "/v1.0/extensions/org.libregraph/tags"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@@ -269,7 +269,7 @@ func (a *TagsApiService) UnassignTagsExecute(r ApiUnassignTagsRequest) (*http.Re
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/extensions/org.libregraph/tags"
|
||||
localVarPath := localBasePath + "/v1.0/extensions/org.libregraph/tags"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
||||
8
vendor/github.com/owncloud/libre-graph-api-go/api_user.go
generated
vendored
8
vendor/github.com/owncloud/libre-graph-api-go/api_user.go
generated
vendored
@@ -67,7 +67,7 @@ func (a *UserApiService) DeleteUserExecute(r ApiDeleteUserRequest) (*http.Respon
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/users/{user-id}"
|
||||
localVarPath := localBasePath + "/v1.0/users/{user-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"user-id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -175,7 +175,7 @@ func (a *UserApiService) ExportPersonalDataExecute(r ApiExportPersonalDataReques
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/users/{user-id}/exportPersonalData"
|
||||
localVarPath := localBasePath + "/v1.0/users/{user-id}/exportPersonalData"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"user-id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -291,7 +291,7 @@ func (a *UserApiService) GetUserExecute(r ApiGetUserRequest) (*User, *http.Respo
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/users/{user-id}"
|
||||
localVarPath := localBasePath + "/v1.0/users/{user-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"user-id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -413,7 +413,7 @@ func (a *UserApiService) UpdateUserExecute(r ApiUpdateUserRequest) (*User, *http
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/users/{user-id}"
|
||||
localVarPath := localBasePath + "/v1.0/users/{user-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"user-id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
|
||||
6
vendor/github.com/owncloud/libre-graph-api-go/api_user_app_role_assignment.go
generated
vendored
6
vendor/github.com/owncloud/libre-graph-api-go/api_user_app_role_assignment.go
generated
vendored
@@ -75,7 +75,7 @@ func (a *UserAppRoleAssignmentApiService) UserCreateAppRoleAssignmentsExecute(r
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/users/{user-id}/appRoleAssignments"
|
||||
localVarPath := localBasePath + "/v1.0/users/{user-id}/appRoleAssignments"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"user-id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
@@ -197,7 +197,7 @@ func (a *UserAppRoleAssignmentApiService) UserDeleteAppRoleAssignmentsExecute(r
|
||||
return nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/users/{user-id}/appRoleAssignments/{appRoleAssignment-id}"
|
||||
localVarPath := localBasePath + "/v1.0/users/{user-id}/appRoleAssignments/{appRoleAssignment-id}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"user-id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"appRoleAssignment-id"+"}", url.PathEscape(parameterValueToString(r.appRoleAssignmentId, "appRoleAssignmentId")), -1)
|
||||
|
||||
@@ -303,7 +303,7 @@ func (a *UserAppRoleAssignmentApiService) UserListAppRoleAssignmentsExecute(r Ap
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/users/{user-id}/appRoleAssignments"
|
||||
localVarPath := localBasePath + "/v1.0/users/{user-id}/appRoleAssignments"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"user-id"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
|
||||
4
vendor/github.com/owncloud/libre-graph-api-go/api_users.go
generated
vendored
4
vendor/github.com/owncloud/libre-graph-api-go/api_users.go
generated
vendored
@@ -65,7 +65,7 @@ func (a *UsersApiService) CreateUserExecute(r ApiCreateUserRequest) (*User, *htt
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/users"
|
||||
localVarPath := localBasePath + "/v1.0/users"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
@@ -210,7 +210,7 @@ func (a *UsersApiService) ListUsersExecute(r ApiListUsersRequest) (*CollectionOf
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/users"
|
||||
localVarPath := localBasePath + "/v1.0/users"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
|
||||
4
vendor/github.com/owncloud/libre-graph-api-go/configuration.go
generated
vendored
4
vendor/github.com/owncloud/libre-graph-api-go/configuration.go
generated
vendored
@@ -93,11 +93,11 @@ func NewConfiguration() *Configuration {
|
||||
Debug: false,
|
||||
Servers: ServerConfigurations{
|
||||
{
|
||||
URL: "https://ocis.ocis-traefik.latest.owncloud.works/graph/v1.0",
|
||||
URL: "https://ocis.ocis-traefik.latest.owncloud.works/graph",
|
||||
Description: "ownCloud Infinite Scale Latest",
|
||||
},
|
||||
{
|
||||
URL: "https://localhost:9200/graph/v1.0",
|
||||
URL: "https://localhost:9200/graph",
|
||||
Description: "ownCloud Infinite Scale Development Setup",
|
||||
},
|
||||
},
|
||||
|
||||
20
vendor/github.com/tidwall/gjson/LICENSE
generated
vendored
Normal file
20
vendor/github.com/tidwall/gjson/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Josh Baker
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
488
vendor/github.com/tidwall/gjson/README.md
generated
vendored
Normal file
488
vendor/github.com/tidwall/gjson/README.md
generated
vendored
Normal file
@@ -0,0 +1,488 @@
|
||||
<p align="center">
|
||||
<img
|
||||
src="logo.png"
|
||||
width="240" height="78" border="0" alt="GJSON">
|
||||
<br>
|
||||
<a href="https://godoc.org/github.com/tidwall/gjson"><img src="https://img.shields.io/badge/api-reference-blue.svg?style=flat-square" alt="GoDoc"></a>
|
||||
<a href="https://tidwall.com/gjson-play"><img src="https://img.shields.io/badge/%F0%9F%8F%90-playground-9900cc.svg?style=flat-square" alt="GJSON Playground"></a>
|
||||
<a href="SYNTAX.md"><img src="https://img.shields.io/badge/{}-syntax-33aa33.svg?style=flat-square" alt="GJSON Syntax"></a>
|
||||
|
||||
</p>
|
||||
|
||||
<p align="center">get json values quickly</a></p>
|
||||
|
||||
GJSON is a Go package that provides a [fast](#performance) and [simple](#get-a-value) way to get values from a json document.
|
||||
It has features such as [one line retrieval](#get-a-value), [dot notation paths](#path-syntax), [iteration](#iterate-through-an-object-or-array), and [parsing json lines](#json-lines).
|
||||
|
||||
Also check out [SJSON](https://github.com/tidwall/sjson) for modifying json, and the [JJ](https://github.com/tidwall/jj) command line tool.
|
||||
|
||||
This README is a quick overview of how to use GJSON, for more information check out [GJSON Syntax](SYNTAX.md).
|
||||
|
||||
GJSON is also available for [Python](https://github.com/volans-/gjson-py) and [Rust](https://github.com/tidwall/gjson.rs)
|
||||
|
||||
Getting Started
|
||||
===============
|
||||
|
||||
## Installing
|
||||
|
||||
To start using GJSON, install Go and run `go get`:
|
||||
|
||||
```sh
|
||||
$ go get -u github.com/tidwall/gjson
|
||||
```
|
||||
|
||||
This will retrieve the library.
|
||||
|
||||
## Get a value
|
||||
Get searches json for the specified path. A path is in dot syntax, such as "name.last" or "age". When the value is found it's returned immediately.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import "github.com/tidwall/gjson"
|
||||
|
||||
const json = `{"name":{"first":"Janet","last":"Prichard"},"age":47}`
|
||||
|
||||
func main() {
|
||||
value := gjson.Get(json, "name.last")
|
||||
println(value.String())
|
||||
}
|
||||
```
|
||||
|
||||
This will print:
|
||||
|
||||
```
|
||||
Prichard
|
||||
```
|
||||
*There's also the [GetMany](#get-multiple-values-at-once) function to get multiple values at once, and [GetBytes](#working-with-bytes) for working with JSON byte slices.*
|
||||
|
||||
## Path Syntax
|
||||
|
||||
Below is a quick overview of the path syntax, for more complete information please
|
||||
check out [GJSON Syntax](SYNTAX.md).
|
||||
|
||||
A path is a series of keys separated by a dot.
|
||||
A key may contain special wildcard characters '\*' and '?'.
|
||||
To access an array value use the index as the key.
|
||||
To get the number of elements in an array or to access a child path, use the '#' character.
|
||||
The dot and wildcard characters can be escaped with '\\'.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": {"first": "Tom", "last": "Anderson"},
|
||||
"age":37,
|
||||
"children": ["Sara","Alex","Jack"],
|
||||
"fav.movie": "Deer Hunter",
|
||||
"friends": [
|
||||
{"first": "Dale", "last": "Murphy", "age": 44, "nets": ["ig", "fb", "tw"]},
|
||||
{"first": "Roger", "last": "Craig", "age": 68, "nets": ["fb", "tw"]},
|
||||
{"first": "Jane", "last": "Murphy", "age": 47, "nets": ["ig", "tw"]}
|
||||
]
|
||||
}
|
||||
```
|
||||
```
|
||||
"name.last" >> "Anderson"
|
||||
"age" >> 37
|
||||
"children" >> ["Sara","Alex","Jack"]
|
||||
"children.#" >> 3
|
||||
"children.1" >> "Alex"
|
||||
"child*.2" >> "Jack"
|
||||
"c?ildren.0" >> "Sara"
|
||||
"fav\.movie" >> "Deer Hunter"
|
||||
"friends.#.first" >> ["Dale","Roger","Jane"]
|
||||
"friends.1.last" >> "Craig"
|
||||
```
|
||||
|
||||
You can also query an array for the first match by using `#(...)`, or find all
|
||||
matches with `#(...)#`. Queries support the `==`, `!=`, `<`, `<=`, `>`, `>=`
|
||||
comparison operators and the simple pattern matching `%` (like) and `!%`
|
||||
(not like) operators.
|
||||
|
||||
```
|
||||
friends.#(last=="Murphy").first >> "Dale"
|
||||
friends.#(last=="Murphy")#.first >> ["Dale","Jane"]
|
||||
friends.#(age>45)#.last >> ["Craig","Murphy"]
|
||||
friends.#(first%"D*").last >> "Murphy"
|
||||
friends.#(first!%"D*").last >> "Craig"
|
||||
friends.#(nets.#(=="fb"))#.first >> ["Dale","Roger"]
|
||||
```
|
||||
|
||||
*Please note that prior to v1.3.0, queries used the `#[...]` brackets. This was
|
||||
changed in v1.3.0 as to avoid confusion with the new
|
||||
[multipath](SYNTAX.md#multipaths) syntax. For backwards compatibility,
|
||||
`#[...]` will continue to work until the next major release.*
|
||||
|
||||
## Result Type
|
||||
|
||||
GJSON supports the json types `string`, `number`, `bool`, and `null`.
|
||||
Arrays and Objects are returned as their raw json types.
|
||||
|
||||
The `Result` type holds one of these:
|
||||
|
||||
```
|
||||
bool, for JSON booleans
|
||||
float64, for JSON numbers
|
||||
string, for JSON string literals
|
||||
nil, for JSON null
|
||||
```
|
||||
|
||||
To directly access the value:
|
||||
|
||||
```go
|
||||
result.Type // can be String, Number, True, False, Null, or JSON
|
||||
result.Str // holds the string
|
||||
result.Num // holds the float64 number
|
||||
result.Raw // holds the raw json
|
||||
result.Index // index of raw value in original json, zero means index unknown
|
||||
result.Indexes // indexes of all the elements that match on a path containing the '#' query character.
|
||||
```
|
||||
|
||||
There are a variety of handy functions that work on a result:
|
||||
|
||||
```go
|
||||
result.Exists() bool
|
||||
result.Value() interface{}
|
||||
result.Int() int64
|
||||
result.Uint() uint64
|
||||
result.Float() float64
|
||||
result.String() string
|
||||
result.Bool() bool
|
||||
result.Time() time.Time
|
||||
result.Array() []gjson.Result
|
||||
result.Map() map[string]gjson.Result
|
||||
result.Get(path string) Result
|
||||
result.ForEach(iterator func(key, value Result) bool)
|
||||
result.Less(token Result, caseSensitive bool) bool
|
||||
```
|
||||
|
||||
The `result.Value()` function returns an `interface{}` which requires type assertion and is one of the following Go types:
|
||||
|
||||
```go
|
||||
boolean >> bool
|
||||
number >> float64
|
||||
string >> string
|
||||
null >> nil
|
||||
array >> []interface{}
|
||||
object >> map[string]interface{}
|
||||
```
|
||||
|
||||
The `result.Array()` function returns back an array of values.
|
||||
If the result represents a non-existent value, then an empty array will be returned.
|
||||
If the result is not a JSON array, the return value will be an array containing one result.
|
||||
|
||||
### 64-bit integers
|
||||
|
||||
The `result.Int()` and `result.Uint()` calls are capable of reading all 64 bits, allowing for large JSON integers.
|
||||
|
||||
```go
|
||||
result.Int() int64 // -9223372036854775808 to 9223372036854775807
|
||||
result.Uint() uint64 // 0 to 18446744073709551615
|
||||
```
|
||||
|
||||
## Modifiers and path chaining
|
||||
|
||||
New in version 1.2 is support for modifier functions and path chaining.
|
||||
|
||||
A modifier is a path component that performs custom processing on the
|
||||
json.
|
||||
|
||||
Multiple paths can be "chained" together using the pipe character.
|
||||
This is useful for getting results from a modified query.
|
||||
|
||||
For example, using the built-in `@reverse` modifier on the above json document,
|
||||
we'll get `children` array and reverse the order:
|
||||
|
||||
```
|
||||
"children|@reverse" >> ["Jack","Alex","Sara"]
|
||||
"children|@reverse|0" >> "Jack"
|
||||
```
|
||||
|
||||
There are currently the following built-in modifiers:
|
||||
|
||||
- `@reverse`: Reverse an array or the members of an object.
|
||||
- `@ugly`: Remove all whitespace from a json document.
|
||||
- `@pretty`: Make the json document more human readable.
|
||||
- `@this`: Returns the current element. It can be used to retrieve the root element.
|
||||
- `@valid`: Ensure the json document is valid.
|
||||
- `@flatten`: Flattens an array.
|
||||
- `@join`: Joins multiple objects into a single object.
|
||||
- `@keys`: Returns an array of keys for an object.
|
||||
- `@values`: Returns an array of values for an object.
|
||||
- `@tostr`: Converts json to a string. Wraps a json string.
|
||||
- `@fromstr`: Converts a string from json. Unwraps a json string.
|
||||
- `@group`: Groups arrays of objects. See [e4fc67c](https://github.com/tidwall/gjson/commit/e4fc67c92aeebf2089fabc7872f010e340d105db).
|
||||
- `@dig`: Search for a value without providing its entire path. See [e8e87f2](https://github.com/tidwall/gjson/commit/e8e87f2a00dc41f3aba5631094e21f59a8cf8cbf).
|
||||
|
||||
### Modifier arguments
|
||||
|
||||
A modifier may accept an optional argument. The argument can be a valid JSON
|
||||
document or just characters.
|
||||
|
||||
For example, the `@pretty` modifier takes a json object as its argument.
|
||||
|
||||
```
|
||||
@pretty:{"sortKeys":true}
|
||||
```
|
||||
|
||||
Which makes the json pretty and orders all of its keys.
|
||||
|
||||
```json
|
||||
{
|
||||
"age":37,
|
||||
"children": ["Sara","Alex","Jack"],
|
||||
"fav.movie": "Deer Hunter",
|
||||
"friends": [
|
||||
{"age": 44, "first": "Dale", "last": "Murphy"},
|
||||
{"age": 68, "first": "Roger", "last": "Craig"},
|
||||
{"age": 47, "first": "Jane", "last": "Murphy"}
|
||||
],
|
||||
"name": {"first": "Tom", "last": "Anderson"}
|
||||
}
|
||||
```
|
||||
|
||||
*The full list of `@pretty` options are `sortKeys`, `indent`, `prefix`, and `width`.
|
||||
Please see [Pretty Options](https://github.com/tidwall/pretty#customized-output) for more information.*
|
||||
|
||||
### Custom modifiers
|
||||
|
||||
You can also add custom modifiers.
|
||||
|
||||
For example, here we create a modifier that makes the entire json document upper
|
||||
or lower case.
|
||||
|
||||
```go
|
||||
gjson.AddModifier("case", func(json, arg string) string {
|
||||
if arg == "upper" {
|
||||
return strings.ToUpper(json)
|
||||
}
|
||||
if arg == "lower" {
|
||||
return strings.ToLower(json)
|
||||
}
|
||||
return json
|
||||
})
|
||||
```
|
||||
|
||||
```
|
||||
"children|@case:upper" >> ["SARA","ALEX","JACK"]
|
||||
"children|@case:lower|@reverse" >> ["jack","alex","sara"]
|
||||
```
|
||||
|
||||
## JSON Lines
|
||||
|
||||
There's support for [JSON Lines](http://jsonlines.org/) using the `..` prefix, which treats a multilined document as an array.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
{"name": "Gilbert", "age": 61}
|
||||
{"name": "Alexa", "age": 34}
|
||||
{"name": "May", "age": 57}
|
||||
{"name": "Deloise", "age": 44}
|
||||
```
|
||||
|
||||
```
|
||||
..# >> 4
|
||||
..1 >> {"name": "Alexa", "age": 34}
|
||||
..3 >> {"name": "Deloise", "age": 44}
|
||||
..#.name >> ["Gilbert","Alexa","May","Deloise"]
|
||||
..#(name="May").age >> 57
|
||||
```
|
||||
|
||||
The `ForEachLines` function will iterate through JSON lines.
|
||||
|
||||
```go
|
||||
gjson.ForEachLine(json, func(line gjson.Result) bool{
|
||||
println(line.String())
|
||||
return true
|
||||
})
|
||||
```
|
||||
|
||||
## Get nested array values
|
||||
|
||||
Suppose you want all the last names from the following json:
|
||||
|
||||
```json
|
||||
{
|
||||
"programmers": [
|
||||
{
|
||||
"firstName": "Janet",
|
||||
"lastName": "McLaughlin",
|
||||
}, {
|
||||
"firstName": "Elliotte",
|
||||
"lastName": "Hunter",
|
||||
}, {
|
||||
"firstName": "Jason",
|
||||
"lastName": "Harold",
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
You would use the path "programmers.#.lastName" like such:
|
||||
|
||||
```go
|
||||
result := gjson.Get(json, "programmers.#.lastName")
|
||||
for _, name := range result.Array() {
|
||||
println(name.String())
|
||||
}
|
||||
```
|
||||
|
||||
You can also query an object inside an array:
|
||||
|
||||
```go
|
||||
name := gjson.Get(json, `programmers.#(lastName="Hunter").firstName`)
|
||||
println(name.String()) // prints "Elliotte"
|
||||
```
|
||||
|
||||
## Iterate through an object or array
|
||||
|
||||
The `ForEach` function allows for quickly iterating through an object or array.
|
||||
The key and value are passed to the iterator function for objects.
|
||||
Only the value is passed for arrays.
|
||||
Returning `false` from an iterator will stop iteration.
|
||||
|
||||
```go
|
||||
result := gjson.Get(json, "programmers")
|
||||
result.ForEach(func(key, value gjson.Result) bool {
|
||||
println(value.String())
|
||||
return true // keep iterating
|
||||
})
|
||||
```
|
||||
|
||||
## Simple Parse and Get
|
||||
|
||||
There's a `Parse(json)` function that will do a simple parse, and `result.Get(path)` that will search a result.
|
||||
|
||||
For example, all of these will return the same result:
|
||||
|
||||
```go
|
||||
gjson.Parse(json).Get("name").Get("last")
|
||||
gjson.Get(json, "name").Get("last")
|
||||
gjson.Get(json, "name.last")
|
||||
```
|
||||
|
||||
## Check for the existence of a value
|
||||
|
||||
Sometimes you just want to know if a value exists.
|
||||
|
||||
```go
|
||||
value := gjson.Get(json, "name.last")
|
||||
if !value.Exists() {
|
||||
println("no last name")
|
||||
} else {
|
||||
println(value.String())
|
||||
}
|
||||
|
||||
// Or as one step
|
||||
if gjson.Get(json, "name.last").Exists() {
|
||||
println("has a last name")
|
||||
}
|
||||
```
|
||||
|
||||
## Validate JSON
|
||||
|
||||
The `Get*` and `Parse*` functions expects that the json is well-formed. Bad json will not panic, but it may return back unexpected results.
|
||||
|
||||
If you are consuming JSON from an unpredictable source then you may want to validate prior to using GJSON.
|
||||
|
||||
```go
|
||||
if !gjson.Valid(json) {
|
||||
return errors.New("invalid json")
|
||||
}
|
||||
value := gjson.Get(json, "name.last")
|
||||
```
|
||||
|
||||
## Unmarshal to a map
|
||||
|
||||
To unmarshal to a `map[string]interface{}`:
|
||||
|
||||
```go
|
||||
m, ok := gjson.Parse(json).Value().(map[string]interface{})
|
||||
if !ok {
|
||||
// not a map
|
||||
}
|
||||
```
|
||||
|
||||
## Working with Bytes
|
||||
|
||||
If your JSON is contained in a `[]byte` slice, there's the [GetBytes](https://godoc.org/github.com/tidwall/gjson#GetBytes) function. This is preferred over `Get(string(data), path)`.
|
||||
|
||||
```go
|
||||
var json []byte = ...
|
||||
result := gjson.GetBytes(json, path)
|
||||
```
|
||||
|
||||
If you are using the `gjson.GetBytes(json, path)` function and you want to avoid converting `result.Raw` to a `[]byte`, then you can use this pattern:
|
||||
|
||||
```go
|
||||
var json []byte = ...
|
||||
result := gjson.GetBytes(json, path)
|
||||
var raw []byte
|
||||
if result.Index > 0 {
|
||||
raw = json[result.Index:result.Index+len(result.Raw)]
|
||||
} else {
|
||||
raw = []byte(result.Raw)
|
||||
}
|
||||
```
|
||||
|
||||
This is a best-effort no allocation sub slice of the original json. This method utilizes the `result.Index` field, which is the position of the raw data in the original json. It's possible that the value of `result.Index` equals zero, in which case the `result.Raw` is converted to a `[]byte`.
|
||||
|
||||
## Performance
|
||||
|
||||
Benchmarks of GJSON alongside [encoding/json](https://golang.org/pkg/encoding/json/),
|
||||
[ffjson](https://github.com/pquerna/ffjson),
|
||||
[EasyJSON](https://github.com/mailru/easyjson),
|
||||
[jsonparser](https://github.com/buger/jsonparser),
|
||||
and [json-iterator](https://github.com/json-iterator/go)
|
||||
|
||||
```
|
||||
BenchmarkGJSONGet-16 11644512 311 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkGJSONUnmarshalMap-16 1122678 3094 ns/op 1920 B/op 26 allocs/op
|
||||
BenchmarkJSONUnmarshalMap-16 516681 6810 ns/op 2944 B/op 69 allocs/op
|
||||
BenchmarkJSONUnmarshalStruct-16 697053 5400 ns/op 928 B/op 13 allocs/op
|
||||
BenchmarkJSONDecoder-16 330450 10217 ns/op 3845 B/op 160 allocs/op
|
||||
BenchmarkFFJSONLexer-16 1424979 2585 ns/op 880 B/op 8 allocs/op
|
||||
BenchmarkEasyJSONLexer-16 3000000 729 ns/op 501 B/op 5 allocs/op
|
||||
BenchmarkJSONParserGet-16 3000000 366 ns/op 21 B/op 0 allocs/op
|
||||
BenchmarkJSONIterator-16 3000000 869 ns/op 693 B/op 14 allocs/op
|
||||
```
|
||||
|
||||
JSON document used:
|
||||
|
||||
```json
|
||||
{
|
||||
"widget": {
|
||||
"debug": "on",
|
||||
"window": {
|
||||
"title": "Sample Konfabulator Widget",
|
||||
"name": "main_window",
|
||||
"width": 500,
|
||||
"height": 500
|
||||
},
|
||||
"image": {
|
||||
"src": "Images/Sun.png",
|
||||
"hOffset": 250,
|
||||
"vOffset": 250,
|
||||
"alignment": "center"
|
||||
},
|
||||
"text": {
|
||||
"data": "Click Here",
|
||||
"size": 36,
|
||||
"style": "bold",
|
||||
"vOffset": 100,
|
||||
"alignment": "center",
|
||||
"onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Each operation was rotated through one of the following search paths:
|
||||
|
||||
```
|
||||
widget.window.name
|
||||
widget.image.hOffset
|
||||
widget.text.onMouseUp
|
||||
```
|
||||
|
||||
*These benchmarks were run on a MacBook Pro 16" 2.4 GHz Intel Core i9 using Go 1.17 and can be found [here](https://github.com/tidwall/gjson-benchmarks).*
|
||||
360
vendor/github.com/tidwall/gjson/SYNTAX.md
generated
vendored
Normal file
360
vendor/github.com/tidwall/gjson/SYNTAX.md
generated
vendored
Normal file
@@ -0,0 +1,360 @@
|
||||
# GJSON Path Syntax
|
||||
|
||||
A GJSON Path is a text string syntax that describes a search pattern for quickly retreiving values from a JSON payload.
|
||||
|
||||
This document is designed to explain the structure of a GJSON Path through examples.
|
||||
|
||||
- [Path structure](#path-structure)
|
||||
- [Basic](#basic)
|
||||
- [Wildcards](#wildcards)
|
||||
- [Escape Character](#escape-character)
|
||||
- [Arrays](#arrays)
|
||||
- [Queries](#queries)
|
||||
- [Dot vs Pipe](#dot-vs-pipe)
|
||||
- [Modifiers](#modifiers)
|
||||
- [Multipaths](#multipaths)
|
||||
- [Literals](#literals)
|
||||
|
||||
The definitive implemenation is [github.com/tidwall/gjson](https://github.com/tidwall/gjson).
|
||||
Use the [GJSON Playground](https://gjson.dev) to experiment with the syntax online.
|
||||
|
||||
## Path structure
|
||||
|
||||
A GJSON Path is intended to be easily expressed as a series of components seperated by a `.` character.
|
||||
|
||||
Along with `.` character, there are a few more that have special meaning, including `|`, `#`, `@`, `\`, `*`, `!`, and `?`.
|
||||
|
||||
## Example
|
||||
|
||||
Given this JSON
|
||||
|
||||
```json
|
||||
{
|
||||
"name": {"first": "Tom", "last": "Anderson"},
|
||||
"age":37,
|
||||
"children": ["Sara","Alex","Jack"],
|
||||
"fav.movie": "Deer Hunter",
|
||||
"friends": [
|
||||
{"first": "Dale", "last": "Murphy", "age": 44, "nets": ["ig", "fb", "tw"]},
|
||||
{"first": "Roger", "last": "Craig", "age": 68, "nets": ["fb", "tw"]},
|
||||
{"first": "Jane", "last": "Murphy", "age": 47, "nets": ["ig", "tw"]}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The following GJSON Paths evaluate to the accompanying values.
|
||||
|
||||
### Basic
|
||||
|
||||
In many cases you'll just want to retreive values by object name or array index.
|
||||
|
||||
```go
|
||||
name.last "Anderson"
|
||||
name.first "Tom"
|
||||
age 37
|
||||
children ["Sara","Alex","Jack"]
|
||||
children.0 "Sara"
|
||||
children.1 "Alex"
|
||||
friends.1 {"first": "Roger", "last": "Craig", "age": 68}
|
||||
friends.1.first "Roger"
|
||||
```
|
||||
|
||||
### Wildcards
|
||||
|
||||
A key may contain the special wildcard characters `*` and `?`.
|
||||
The `*` will match on any zero+ characters, and `?` matches on any one character.
|
||||
|
||||
```go
|
||||
child*.2 "Jack"
|
||||
c?ildren.0 "Sara"
|
||||
```
|
||||
|
||||
### Escape character
|
||||
|
||||
Special purpose characters, such as `.`, `*`, and `?` can be escaped with `\`.
|
||||
|
||||
```go
|
||||
fav\.movie "Deer Hunter"
|
||||
```
|
||||
|
||||
You'll also need to make sure that the `\` character is correctly escaped when hardcoding a path in your source code.
|
||||
|
||||
```go
|
||||
// Go
|
||||
val := gjson.Get(json, "fav\\.movie") // must escape the slash
|
||||
val := gjson.Get(json, `fav\.movie`) // no need to escape the slash
|
||||
```
|
||||
|
||||
```rust
|
||||
// Rust
|
||||
let val = gjson::get(json, "fav\\.movie") // must escape the slash
|
||||
let val = gjson::get(json, r#"fav\.movie"#) // no need to escape the slash
|
||||
```
|
||||
|
||||
|
||||
### Arrays
|
||||
|
||||
The `#` character allows for digging into JSON Arrays.
|
||||
|
||||
To get the length of an array you'll just use the `#` all by itself.
|
||||
|
||||
```go
|
||||
friends.# 3
|
||||
friends.#.age [44,68,47]
|
||||
```
|
||||
|
||||
### Queries
|
||||
|
||||
You can also query an array for the first match by using `#(...)`, or find all matches with `#(...)#`.
|
||||
Queries support the `==`, `!=`, `<`, `<=`, `>`, `>=` comparison operators,
|
||||
and the simple pattern matching `%` (like) and `!%` (not like) operators.
|
||||
|
||||
```go
|
||||
friends.#(last=="Murphy").first "Dale"
|
||||
friends.#(last=="Murphy")#.first ["Dale","Jane"]
|
||||
friends.#(age>45)#.last ["Craig","Murphy"]
|
||||
friends.#(first%"D*").last "Murphy"
|
||||
friends.#(first!%"D*").last "Craig"
|
||||
```
|
||||
|
||||
To query for a non-object value in an array, you can forgo the string to the right of the operator.
|
||||
|
||||
```go
|
||||
children.#(!%"*a*") "Alex"
|
||||
children.#(%"*a*")# ["Sara","Jack"]
|
||||
```
|
||||
|
||||
Nested queries are allowed.
|
||||
|
||||
```go
|
||||
friends.#(nets.#(=="fb"))#.first >> ["Dale","Roger"]
|
||||
```
|
||||
|
||||
*Please note that prior to v1.3.0, queries used the `#[...]` brackets. This was
|
||||
changed in v1.3.0 as to avoid confusion with the new [multipath](#multipaths)
|
||||
syntax. For backwards compatibility, `#[...]` will continue to work until the
|
||||
next major release.*
|
||||
|
||||
The `~` (tilde) operator will convert a value to a boolean before comparison.
|
||||
|
||||
Supported tilde comparison type are:
|
||||
|
||||
```
|
||||
~true Converts true-ish values to true
|
||||
~false Converts false-ish and non-existent values to true
|
||||
~null Converts null and non-existent values to true
|
||||
~* Converts any existing value to true
|
||||
```
|
||||
|
||||
For example, using the following JSON:
|
||||
|
||||
```json
|
||||
{
|
||||
"vals": [
|
||||
{ "a": 1, "b": "data" },
|
||||
{ "a": 2, "b": true },
|
||||
{ "a": 3, "b": false },
|
||||
{ "a": 4, "b": "0" },
|
||||
{ "a": 5, "b": 0 },
|
||||
{ "a": 6, "b": "1" },
|
||||
{ "a": 7, "b": 1 },
|
||||
{ "a": 8, "b": "true" },
|
||||
{ "a": 9, "b": false },
|
||||
{ "a": 10, "b": null },
|
||||
{ "a": 11 }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
To query for all true-ish or false-ish values:
|
||||
|
||||
```
|
||||
vals.#(b==~true)#.a >> [2,6,7,8]
|
||||
vals.#(b==~false)#.a >> [3,4,5,9,10,11]
|
||||
```
|
||||
|
||||
The last value which was non-existent is treated as `false`
|
||||
|
||||
To query for null and explicit value existence:
|
||||
|
||||
```
|
||||
vals.#(b==~null)#.a >> [10,11]
|
||||
vals.#(b==~*)#.a >> [1,2,3,4,5,6,7,8,9,10]
|
||||
vals.#(b!=~*)#.a >> [11]
|
||||
```
|
||||
|
||||
### Dot vs Pipe
|
||||
|
||||
The `.` is standard separator, but it's also possible to use a `|`.
|
||||
In most cases they both end up returning the same results.
|
||||
The cases where`|` differs from `.` is when it's used after the `#` for [Arrays](#arrays) and [Queries](#queries).
|
||||
|
||||
Here are some examples
|
||||
|
||||
```go
|
||||
friends.0.first "Dale"
|
||||
friends|0.first "Dale"
|
||||
friends.0|first "Dale"
|
||||
friends|0|first "Dale"
|
||||
friends|# 3
|
||||
friends.# 3
|
||||
friends.#(last="Murphy")# [{"first": "Dale", "last": "Murphy", "age": 44},{"first": "Jane", "last": "Murphy", "age": 47}]
|
||||
friends.#(last="Murphy")#.first ["Dale","Jane"]
|
||||
friends.#(last="Murphy")#|first <non-existent>
|
||||
friends.#(last="Murphy")#.0 []
|
||||
friends.#(last="Murphy")#|0 {"first": "Dale", "last": "Murphy", "age": 44}
|
||||
friends.#(last="Murphy")#.# []
|
||||
friends.#(last="Murphy")#|# 2
|
||||
```
|
||||
|
||||
Let's break down a few of these.
|
||||
|
||||
The path `friends.#(last="Murphy")#` all by itself results in
|
||||
|
||||
```json
|
||||
[{"first": "Dale", "last": "Murphy", "age": 44},{"first": "Jane", "last": "Murphy", "age": 47}]
|
||||
```
|
||||
|
||||
The `.first` suffix will process the `first` path on each array element *before* returning the results. Which becomes
|
||||
|
||||
```json
|
||||
["Dale","Jane"]
|
||||
```
|
||||
|
||||
But the `|first` suffix actually processes the `first` path *after* the previous result.
|
||||
Since the previous result is an array, not an object, it's not possible to process
|
||||
because `first` does not exist.
|
||||
|
||||
Yet, `|0` suffix returns
|
||||
|
||||
```json
|
||||
{"first": "Dale", "last": "Murphy", "age": 44}
|
||||
```
|
||||
|
||||
Because `0` is the first index of the previous result.
|
||||
|
||||
### Modifiers
|
||||
|
||||
A modifier is a path component that performs custom processing on the JSON.
|
||||
|
||||
For example, using the built-in `@reverse` modifier on the above JSON payload will reverse the `children` array:
|
||||
|
||||
```go
|
||||
children.@reverse ["Jack","Alex","Sara"]
|
||||
children.@reverse.0 "Jack"
|
||||
```
|
||||
|
||||
There are currently the following built-in modifiers:
|
||||
|
||||
- `@reverse`: Reverse an array or the members of an object.
|
||||
- `@ugly`: Remove all whitespace from JSON.
|
||||
- `@pretty`: Make the JSON more human readable.
|
||||
- `@this`: Returns the current element. It can be used to retrieve the root element.
|
||||
- `@valid`: Ensure the json document is valid.
|
||||
- `@flatten`: Flattens an array.
|
||||
- `@join`: Joins multiple objects into a single object.
|
||||
- `@keys`: Returns an array of keys for an object.
|
||||
- `@values`: Returns an array of values for an object.
|
||||
- `@tostr`: Converts json to a string. Wraps a json string.
|
||||
- `@fromstr`: Converts a string from json. Unwraps a json string.
|
||||
- `@group`: Groups arrays of objects. See [e4fc67c](https://github.com/tidwall/gjson/commit/e4fc67c92aeebf2089fabc7872f010e340d105db).
|
||||
- `@dig`: Search for a value without providing its entire path. See [e8e87f2](https://github.com/tidwall/gjson/commit/e8e87f2a00dc41f3aba5631094e21f59a8cf8cbf).
|
||||
|
||||
#### Modifier arguments
|
||||
|
||||
A modifier may accept an optional argument. The argument can be a valid JSON payload or just characters.
|
||||
|
||||
For example, the `@pretty` modifier takes a json object as its argument.
|
||||
|
||||
```
|
||||
@pretty:{"sortKeys":true}
|
||||
```
|
||||
|
||||
Which makes the json pretty and orders all of its keys.
|
||||
|
||||
```json
|
||||
{
|
||||
"age":37,
|
||||
"children": ["Sara","Alex","Jack"],
|
||||
"fav.movie": "Deer Hunter",
|
||||
"friends": [
|
||||
{"age": 44, "first": "Dale", "last": "Murphy"},
|
||||
{"age": 68, "first": "Roger", "last": "Craig"},
|
||||
{"age": 47, "first": "Jane", "last": "Murphy"}
|
||||
],
|
||||
"name": {"first": "Tom", "last": "Anderson"}
|
||||
}
|
||||
```
|
||||
|
||||
*The full list of `@pretty` options are `sortKeys`, `indent`, `prefix`, and `width`.
|
||||
Please see [Pretty Options](https://github.com/tidwall/pretty#customized-output) for more information.*
|
||||
|
||||
#### Custom modifiers
|
||||
|
||||
You can also add custom modifiers.
|
||||
|
||||
For example, here we create a modifier which makes the entire JSON payload upper or lower case.
|
||||
|
||||
```go
|
||||
gjson.AddModifier("case", func(json, arg string) string {
|
||||
if arg == "upper" {
|
||||
return strings.ToUpper(json)
|
||||
}
|
||||
if arg == "lower" {
|
||||
return strings.ToLower(json)
|
||||
}
|
||||
return json
|
||||
})
|
||||
"children.@case:upper" ["SARA","ALEX","JACK"]
|
||||
"children.@case:lower.@reverse" ["jack","alex","sara"]
|
||||
```
|
||||
|
||||
*Note: Custom modifiers are not yet available in the Rust version*
|
||||
|
||||
### Multipaths
|
||||
|
||||
Starting with v1.3.0, GJSON added the ability to join multiple paths together
|
||||
to form new documents. Wrapping comma-separated paths between `[...]` or
|
||||
`{...}` will result in a new array or object, respectively.
|
||||
|
||||
For example, using the given multipath:
|
||||
|
||||
```
|
||||
{name.first,age,"the_murphys":friends.#(last="Murphy")#.first}
|
||||
```
|
||||
|
||||
Here we selected the first name, age, and the first name for friends with the
|
||||
last name "Murphy".
|
||||
|
||||
You'll notice that an optional key can be provided, in this case
|
||||
"the_murphys", to force assign a key to a value. Otherwise, the name of the
|
||||
actual field will be used, in this case "first". If a name cannot be
|
||||
determined, then "_" is used.
|
||||
|
||||
This results in
|
||||
|
||||
```json
|
||||
{"first":"Tom","age":37,"the_murphys":["Dale","Jane"]}
|
||||
```
|
||||
|
||||
### Literals
|
||||
|
||||
Starting with v1.12.0, GJSON added support of json literals, which provides a way for constructing static blocks of json. This is can be particularly useful when constructing a new json document using [multipaths](#multipaths).
|
||||
|
||||
A json literal begins with the '!' declaration character.
|
||||
|
||||
For example, using the given multipath:
|
||||
|
||||
```
|
||||
{name.first,age,"company":!"Happysoft","employed":!true}
|
||||
```
|
||||
|
||||
Here we selected the first name and age. Then add two new fields, "company" and "employed".
|
||||
|
||||
This results in
|
||||
|
||||
```json
|
||||
{"first":"Tom","age":37,"company":"Happysoft","employed":true}
|
||||
```
|
||||
|
||||
*See issue [#249](https://github.com/tidwall/gjson/issues/249) for additional context on JSON Literals.*
|
||||
3490
vendor/github.com/tidwall/gjson/gjson.go
generated
vendored
Normal file
3490
vendor/github.com/tidwall/gjson/gjson.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
vendor/github.com/tidwall/gjson/logo.png
generated
vendored
Normal file
BIN
vendor/github.com/tidwall/gjson/logo.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
20
vendor/github.com/tidwall/match/LICENSE
generated
vendored
Normal file
20
vendor/github.com/tidwall/match/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Josh Baker
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
29
vendor/github.com/tidwall/match/README.md
generated
vendored
Normal file
29
vendor/github.com/tidwall/match/README.md
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# Match
|
||||
|
||||
[](https://godoc.org/github.com/tidwall/match)
|
||||
|
||||
Match is a very simple pattern matcher where '*' matches on any
|
||||
number characters and '?' matches on any one character.
|
||||
|
||||
## Installing
|
||||
|
||||
```
|
||||
go get -u github.com/tidwall/match
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```go
|
||||
match.Match("hello", "*llo")
|
||||
match.Match("jello", "?ello")
|
||||
match.Match("hello", "h*o")
|
||||
```
|
||||
|
||||
|
||||
## Contact
|
||||
|
||||
Josh Baker [@tidwall](http://twitter.com/tidwall)
|
||||
|
||||
## License
|
||||
|
||||
Redcon source code is available under the MIT [License](/LICENSE).
|
||||
237
vendor/github.com/tidwall/match/match.go
generated
vendored
Normal file
237
vendor/github.com/tidwall/match/match.go
generated
vendored
Normal file
@@ -0,0 +1,237 @@
|
||||
// Package match provides a simple pattern matcher with unicode support.
|
||||
package match
|
||||
|
||||
import (
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// Match returns true if str matches pattern. This is a very
|
||||
// simple wildcard match where '*' matches on any number characters
|
||||
// and '?' matches on any one character.
|
||||
//
|
||||
// pattern:
|
||||
// { term }
|
||||
// term:
|
||||
// '*' matches any sequence of non-Separator characters
|
||||
// '?' matches any single non-Separator character
|
||||
// c matches character c (c != '*', '?', '\\')
|
||||
// '\\' c matches character c
|
||||
//
|
||||
func Match(str, pattern string) bool {
|
||||
if pattern == "*" {
|
||||
return true
|
||||
}
|
||||
return match(str, pattern, 0, nil, -1) == rMatch
|
||||
}
|
||||
|
||||
// MatchLimit is the same as Match but will limit the complexity of the match
|
||||
// operation. This is to avoid long running matches, specifically to avoid ReDos
|
||||
// attacks from arbritary inputs.
|
||||
//
|
||||
// How it works:
|
||||
// The underlying match routine is recursive and may call itself when it
|
||||
// encounters a sandwiched wildcard pattern, such as: `user:*:name`.
|
||||
// Everytime it calls itself a counter is incremented.
|
||||
// The operation is stopped when counter > maxcomp*len(str).
|
||||
func MatchLimit(str, pattern string, maxcomp int) (matched, stopped bool) {
|
||||
if pattern == "*" {
|
||||
return true, false
|
||||
}
|
||||
counter := 0
|
||||
r := match(str, pattern, len(str), &counter, maxcomp)
|
||||
if r == rStop {
|
||||
return false, true
|
||||
}
|
||||
return r == rMatch, false
|
||||
}
|
||||
|
||||
type result int
|
||||
|
||||
const (
|
||||
rNoMatch result = iota
|
||||
rMatch
|
||||
rStop
|
||||
)
|
||||
|
||||
func match(str, pat string, slen int, counter *int, maxcomp int) result {
|
||||
// check complexity limit
|
||||
if maxcomp > -1 {
|
||||
if *counter > slen*maxcomp {
|
||||
return rStop
|
||||
}
|
||||
*counter++
|
||||
}
|
||||
|
||||
for len(pat) > 0 {
|
||||
var wild bool
|
||||
pc, ps := rune(pat[0]), 1
|
||||
if pc > 0x7f {
|
||||
pc, ps = utf8.DecodeRuneInString(pat)
|
||||
}
|
||||
var sc rune
|
||||
var ss int
|
||||
if len(str) > 0 {
|
||||
sc, ss = rune(str[0]), 1
|
||||
if sc > 0x7f {
|
||||
sc, ss = utf8.DecodeRuneInString(str)
|
||||
}
|
||||
}
|
||||
switch pc {
|
||||
case '?':
|
||||
if ss == 0 {
|
||||
return rNoMatch
|
||||
}
|
||||
case '*':
|
||||
// Ignore repeating stars.
|
||||
for len(pat) > 1 && pat[1] == '*' {
|
||||
pat = pat[1:]
|
||||
}
|
||||
|
||||
// If this star is the last character then it must be a match.
|
||||
if len(pat) == 1 {
|
||||
return rMatch
|
||||
}
|
||||
|
||||
// Match and trim any non-wildcard suffix characters.
|
||||
var ok bool
|
||||
str, pat, ok = matchTrimSuffix(str, pat)
|
||||
if !ok {
|
||||
return rNoMatch
|
||||
}
|
||||
|
||||
// Check for single star again.
|
||||
if len(pat) == 1 {
|
||||
return rMatch
|
||||
}
|
||||
|
||||
// Perform recursive wildcard search.
|
||||
r := match(str, pat[1:], slen, counter, maxcomp)
|
||||
if r != rNoMatch {
|
||||
return r
|
||||
}
|
||||
if len(str) == 0 {
|
||||
return rNoMatch
|
||||
}
|
||||
wild = true
|
||||
default:
|
||||
if ss == 0 {
|
||||
return rNoMatch
|
||||
}
|
||||
if pc == '\\' {
|
||||
pat = pat[ps:]
|
||||
pc, ps = utf8.DecodeRuneInString(pat)
|
||||
if ps == 0 {
|
||||
return rNoMatch
|
||||
}
|
||||
}
|
||||
if sc != pc {
|
||||
return rNoMatch
|
||||
}
|
||||
}
|
||||
str = str[ss:]
|
||||
if !wild {
|
||||
pat = pat[ps:]
|
||||
}
|
||||
}
|
||||
if len(str) == 0 {
|
||||
return rMatch
|
||||
}
|
||||
return rNoMatch
|
||||
}
|
||||
|
||||
// matchTrimSuffix matches and trims any non-wildcard suffix characters.
|
||||
// Returns the trimed string and pattern.
|
||||
//
|
||||
// This is called because the pattern contains extra data after the wildcard
|
||||
// star. Here we compare any suffix characters in the pattern to the suffix of
|
||||
// the target string. Basically a reverse match that stops when a wildcard
|
||||
// character is reached. This is a little trickier than a forward match because
|
||||
// we need to evaluate an escaped character in reverse.
|
||||
//
|
||||
// Any matched characters will be trimmed from both the target
|
||||
// string and the pattern.
|
||||
func matchTrimSuffix(str, pat string) (string, string, bool) {
|
||||
// It's expected that the pattern has at least two bytes and the first byte
|
||||
// is a wildcard star '*'
|
||||
match := true
|
||||
for len(str) > 0 && len(pat) > 1 {
|
||||
pc, ps := utf8.DecodeLastRuneInString(pat)
|
||||
var esc bool
|
||||
for i := 0; ; i++ {
|
||||
if pat[len(pat)-ps-i-1] != '\\' {
|
||||
if i&1 == 1 {
|
||||
esc = true
|
||||
ps++
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
if pc == '*' && !esc {
|
||||
match = true
|
||||
break
|
||||
}
|
||||
sc, ss := utf8.DecodeLastRuneInString(str)
|
||||
if !((pc == '?' && !esc) || pc == sc) {
|
||||
match = false
|
||||
break
|
||||
}
|
||||
str = str[:len(str)-ss]
|
||||
pat = pat[:len(pat)-ps]
|
||||
}
|
||||
return str, pat, match
|
||||
}
|
||||
|
||||
var maxRuneBytes = [...]byte{244, 143, 191, 191}
|
||||
|
||||
// Allowable parses the pattern and determines the minimum and maximum allowable
|
||||
// values that the pattern can represent.
|
||||
// When the max cannot be determined, 'true' will be returned
|
||||
// for infinite.
|
||||
func Allowable(pattern string) (min, max string) {
|
||||
if pattern == "" || pattern[0] == '*' {
|
||||
return "", ""
|
||||
}
|
||||
|
||||
minb := make([]byte, 0, len(pattern))
|
||||
maxb := make([]byte, 0, len(pattern))
|
||||
var wild bool
|
||||
for i := 0; i < len(pattern); i++ {
|
||||
if pattern[i] == '*' {
|
||||
wild = true
|
||||
break
|
||||
}
|
||||
if pattern[i] == '?' {
|
||||
minb = append(minb, 0)
|
||||
maxb = append(maxb, maxRuneBytes[:]...)
|
||||
} else {
|
||||
minb = append(minb, pattern[i])
|
||||
maxb = append(maxb, pattern[i])
|
||||
}
|
||||
}
|
||||
if wild {
|
||||
r, n := utf8.DecodeLastRune(maxb)
|
||||
if r != utf8.RuneError {
|
||||
if r < utf8.MaxRune {
|
||||
r++
|
||||
if r > 0x7f {
|
||||
b := make([]byte, 4)
|
||||
nn := utf8.EncodeRune(b, r)
|
||||
maxb = append(maxb[:len(maxb)-n], b[:nn]...)
|
||||
} else {
|
||||
maxb = append(maxb[:len(maxb)-n], byte(r))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return string(minb), string(maxb)
|
||||
}
|
||||
|
||||
// IsPattern returns true if the string is a pattern.
|
||||
func IsPattern(str string) bool {
|
||||
for i := 0; i < len(str); i++ {
|
||||
if str[i] == '*' || str[i] == '?' {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
20
vendor/github.com/tidwall/pretty/LICENSE
generated
vendored
Normal file
20
vendor/github.com/tidwall/pretty/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Josh Baker
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
122
vendor/github.com/tidwall/pretty/README.md
generated
vendored
Normal file
122
vendor/github.com/tidwall/pretty/README.md
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
# Pretty
|
||||
|
||||
[](https://pkg.go.dev/github.com/tidwall/pretty)
|
||||
|
||||
Pretty is a Go package that provides [fast](#performance) methods for formatting JSON for human readability, or to compact JSON for smaller payloads.
|
||||
|
||||
Getting Started
|
||||
===============
|
||||
|
||||
## Installing
|
||||
|
||||
To start using Pretty, install Go and run `go get`:
|
||||
|
||||
```sh
|
||||
$ go get -u github.com/tidwall/pretty
|
||||
```
|
||||
|
||||
This will retrieve the library.
|
||||
|
||||
## Pretty
|
||||
|
||||
Using this example:
|
||||
|
||||
```json
|
||||
{"name": {"first":"Tom","last":"Anderson"}, "age":37,
|
||||
"children": ["Sara","Alex","Jack"],
|
||||
"fav.movie": "Deer Hunter", "friends": [
|
||||
{"first": "Janet", "last": "Murphy", "age": 44}
|
||||
]}
|
||||
```
|
||||
|
||||
The following code:
|
||||
```go
|
||||
result = pretty.Pretty(example)
|
||||
```
|
||||
|
||||
Will format the json to:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": {
|
||||
"first": "Tom",
|
||||
"last": "Anderson"
|
||||
},
|
||||
"age": 37,
|
||||
"children": ["Sara", "Alex", "Jack"],
|
||||
"fav.movie": "Deer Hunter",
|
||||
"friends": [
|
||||
{
|
||||
"first": "Janet",
|
||||
"last": "Murphy",
|
||||
"age": 44
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Color
|
||||
|
||||
Color will colorize the json for outputing to the screen.
|
||||
|
||||
```go
|
||||
result = pretty.Color(json, nil)
|
||||
```
|
||||
|
||||
Will add color to the result for printing to the terminal.
|
||||
The second param is used for a customizing the style, and passing nil will use the default `pretty.TerminalStyle`.
|
||||
|
||||
## Ugly
|
||||
|
||||
The following code:
|
||||
```go
|
||||
result = pretty.Ugly(example)
|
||||
```
|
||||
|
||||
Will format the json to:
|
||||
|
||||
```json
|
||||
{"name":{"first":"Tom","last":"Anderson"},"age":37,"children":["Sara","Alex","Jack"],"fav.movie":"Deer Hunter","friends":[{"first":"Janet","last":"Murphy","age":44}]}```
|
||||
```
|
||||
|
||||
## Customized output
|
||||
|
||||
There's a `PrettyOptions(json, opts)` function which allows for customizing the output with the following options:
|
||||
|
||||
```go
|
||||
type Options struct {
|
||||
// Width is an max column width for single line arrays
|
||||
// Default is 80
|
||||
Width int
|
||||
// Prefix is a prefix for all lines
|
||||
// Default is an empty string
|
||||
Prefix string
|
||||
// Indent is the nested indentation
|
||||
// Default is two spaces
|
||||
Indent string
|
||||
// SortKeys will sort the keys alphabetically
|
||||
// Default is false
|
||||
SortKeys bool
|
||||
}
|
||||
```
|
||||
## Performance
|
||||
|
||||
Benchmarks of Pretty alongside the builtin `encoding/json` Indent/Compact methods.
|
||||
```
|
||||
BenchmarkPretty-16 1000000 1034 ns/op 720 B/op 2 allocs/op
|
||||
BenchmarkPrettySortKeys-16 586797 1983 ns/op 2848 B/op 14 allocs/op
|
||||
BenchmarkUgly-16 4652365 254 ns/op 240 B/op 1 allocs/op
|
||||
BenchmarkUglyInPlace-16 6481233 183 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkJSONIndent-16 450654 2687 ns/op 1221 B/op 0 allocs/op
|
||||
BenchmarkJSONCompact-16 685111 1699 ns/op 442 B/op 0 allocs/op
|
||||
```
|
||||
|
||||
*These benchmarks were run on a MacBook Pro 2.4 GHz 8-Core Intel Core i9.*
|
||||
|
||||
## Contact
|
||||
Josh Baker [@tidwall](http://twitter.com/tidwall)
|
||||
|
||||
## License
|
||||
|
||||
Pretty source code is available under the MIT [License](/LICENSE).
|
||||
|
||||
682
vendor/github.com/tidwall/pretty/pretty.go
generated
vendored
Normal file
682
vendor/github.com/tidwall/pretty/pretty.go
generated
vendored
Normal file
@@ -0,0 +1,682 @@
|
||||
package pretty
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"sort"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Options is Pretty options
|
||||
type Options struct {
|
||||
// Width is an max column width for single line arrays
|
||||
// Default is 80
|
||||
Width int
|
||||
// Prefix is a prefix for all lines
|
||||
// Default is an empty string
|
||||
Prefix string
|
||||
// Indent is the nested indentation
|
||||
// Default is two spaces
|
||||
Indent string
|
||||
// SortKeys will sort the keys alphabetically
|
||||
// Default is false
|
||||
SortKeys bool
|
||||
}
|
||||
|
||||
// DefaultOptions is the default options for pretty formats.
|
||||
var DefaultOptions = &Options{Width: 80, Prefix: "", Indent: " ", SortKeys: false}
|
||||
|
||||
// Pretty converts the input json into a more human readable format where each
|
||||
// element is on it's own line with clear indentation.
|
||||
func Pretty(json []byte) []byte { return PrettyOptions(json, nil) }
|
||||
|
||||
// PrettyOptions is like Pretty but with customized options.
|
||||
func PrettyOptions(json []byte, opts *Options) []byte {
|
||||
if opts == nil {
|
||||
opts = DefaultOptions
|
||||
}
|
||||
buf := make([]byte, 0, len(json))
|
||||
if len(opts.Prefix) != 0 {
|
||||
buf = append(buf, opts.Prefix...)
|
||||
}
|
||||
buf, _, _, _ = appendPrettyAny(buf, json, 0, true,
|
||||
opts.Width, opts.Prefix, opts.Indent, opts.SortKeys,
|
||||
0, 0, -1)
|
||||
if len(buf) > 0 {
|
||||
buf = append(buf, '\n')
|
||||
}
|
||||
return buf
|
||||
}
|
||||
|
||||
// Ugly removes insignificant space characters from the input json byte slice
|
||||
// and returns the compacted result.
|
||||
func Ugly(json []byte) []byte {
|
||||
buf := make([]byte, 0, len(json))
|
||||
return ugly(buf, json)
|
||||
}
|
||||
|
||||
// UglyInPlace removes insignificant space characters from the input json
|
||||
// byte slice and returns the compacted result. This method reuses the
|
||||
// input json buffer to avoid allocations. Do not use the original bytes
|
||||
// slice upon return.
|
||||
func UglyInPlace(json []byte) []byte { return ugly(json, json) }
|
||||
|
||||
func ugly(dst, src []byte) []byte {
|
||||
dst = dst[:0]
|
||||
for i := 0; i < len(src); i++ {
|
||||
if src[i] > ' ' {
|
||||
dst = append(dst, src[i])
|
||||
if src[i] == '"' {
|
||||
for i = i + 1; i < len(src); i++ {
|
||||
dst = append(dst, src[i])
|
||||
if src[i] == '"' {
|
||||
j := i - 1
|
||||
for ; ; j-- {
|
||||
if src[j] != '\\' {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (j-i)%2 != 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
func isNaNOrInf(src []byte) bool {
|
||||
return src[0] == 'i' || //Inf
|
||||
src[0] == 'I' || // inf
|
||||
src[0] == '+' || // +Inf
|
||||
src[0] == 'N' || // Nan
|
||||
(src[0] == 'n' && len(src) > 1 && src[1] != 'u') // nan
|
||||
}
|
||||
|
||||
func appendPrettyAny(buf, json []byte, i int, pretty bool, width int, prefix, indent string, sortkeys bool, tabs, nl, max int) ([]byte, int, int, bool) {
|
||||
for ; i < len(json); i++ {
|
||||
if json[i] <= ' ' {
|
||||
continue
|
||||
}
|
||||
if json[i] == '"' {
|
||||
return appendPrettyString(buf, json, i, nl)
|
||||
}
|
||||
|
||||
if (json[i] >= '0' && json[i] <= '9') || json[i] == '-' || isNaNOrInf(json[i:]) {
|
||||
return appendPrettyNumber(buf, json, i, nl)
|
||||
}
|
||||
if json[i] == '{' {
|
||||
return appendPrettyObject(buf, json, i, '{', '}', pretty, width, prefix, indent, sortkeys, tabs, nl, max)
|
||||
}
|
||||
if json[i] == '[' {
|
||||
return appendPrettyObject(buf, json, i, '[', ']', pretty, width, prefix, indent, sortkeys, tabs, nl, max)
|
||||
}
|
||||
switch json[i] {
|
||||
case 't':
|
||||
return append(buf, 't', 'r', 'u', 'e'), i + 4, nl, true
|
||||
case 'f':
|
||||
return append(buf, 'f', 'a', 'l', 's', 'e'), i + 5, nl, true
|
||||
case 'n':
|
||||
return append(buf, 'n', 'u', 'l', 'l'), i + 4, nl, true
|
||||
}
|
||||
}
|
||||
return buf, i, nl, true
|
||||
}
|
||||
|
||||
type pair struct {
|
||||
kstart, kend int
|
||||
vstart, vend int
|
||||
}
|
||||
|
||||
type byKeyVal struct {
|
||||
sorted bool
|
||||
json []byte
|
||||
buf []byte
|
||||
pairs []pair
|
||||
}
|
||||
|
||||
func (arr *byKeyVal) Len() int {
|
||||
return len(arr.pairs)
|
||||
}
|
||||
func (arr *byKeyVal) Less(i, j int) bool {
|
||||
if arr.isLess(i, j, byKey) {
|
||||
return true
|
||||
}
|
||||
if arr.isLess(j, i, byKey) {
|
||||
return false
|
||||
}
|
||||
return arr.isLess(i, j, byVal)
|
||||
}
|
||||
func (arr *byKeyVal) Swap(i, j int) {
|
||||
arr.pairs[i], arr.pairs[j] = arr.pairs[j], arr.pairs[i]
|
||||
arr.sorted = true
|
||||
}
|
||||
|
||||
type byKind int
|
||||
|
||||
const (
|
||||
byKey byKind = 0
|
||||
byVal byKind = 1
|
||||
)
|
||||
|
||||
type jtype int
|
||||
|
||||
const (
|
||||
jnull jtype = iota
|
||||
jfalse
|
||||
jnumber
|
||||
jstring
|
||||
jtrue
|
||||
jjson
|
||||
)
|
||||
|
||||
func getjtype(v []byte) jtype {
|
||||
if len(v) == 0 {
|
||||
return jnull
|
||||
}
|
||||
switch v[0] {
|
||||
case '"':
|
||||
return jstring
|
||||
case 'f':
|
||||
return jfalse
|
||||
case 't':
|
||||
return jtrue
|
||||
case 'n':
|
||||
return jnull
|
||||
case '[', '{':
|
||||
return jjson
|
||||
default:
|
||||
return jnumber
|
||||
}
|
||||
}
|
||||
|
||||
func (arr *byKeyVal) isLess(i, j int, kind byKind) bool {
|
||||
k1 := arr.json[arr.pairs[i].kstart:arr.pairs[i].kend]
|
||||
k2 := arr.json[arr.pairs[j].kstart:arr.pairs[j].kend]
|
||||
var v1, v2 []byte
|
||||
if kind == byKey {
|
||||
v1 = k1
|
||||
v2 = k2
|
||||
} else {
|
||||
v1 = bytes.TrimSpace(arr.buf[arr.pairs[i].vstart:arr.pairs[i].vend])
|
||||
v2 = bytes.TrimSpace(arr.buf[arr.pairs[j].vstart:arr.pairs[j].vend])
|
||||
if len(v1) >= len(k1)+1 {
|
||||
v1 = bytes.TrimSpace(v1[len(k1)+1:])
|
||||
}
|
||||
if len(v2) >= len(k2)+1 {
|
||||
v2 = bytes.TrimSpace(v2[len(k2)+1:])
|
||||
}
|
||||
}
|
||||
t1 := getjtype(v1)
|
||||
t2 := getjtype(v2)
|
||||
if t1 < t2 {
|
||||
return true
|
||||
}
|
||||
if t1 > t2 {
|
||||
return false
|
||||
}
|
||||
if t1 == jstring {
|
||||
s1 := parsestr(v1)
|
||||
s2 := parsestr(v2)
|
||||
return string(s1) < string(s2)
|
||||
}
|
||||
if t1 == jnumber {
|
||||
n1, _ := strconv.ParseFloat(string(v1), 64)
|
||||
n2, _ := strconv.ParseFloat(string(v2), 64)
|
||||
return n1 < n2
|
||||
}
|
||||
return string(v1) < string(v2)
|
||||
|
||||
}
|
||||
|
||||
func parsestr(s []byte) []byte {
|
||||
for i := 1; i < len(s); i++ {
|
||||
if s[i] == '\\' {
|
||||
var str string
|
||||
json.Unmarshal(s, &str)
|
||||
return []byte(str)
|
||||
}
|
||||
if s[i] == '"' {
|
||||
return s[1:i]
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func appendPrettyObject(buf, json []byte, i int, open, close byte, pretty bool, width int, prefix, indent string, sortkeys bool, tabs, nl, max int) ([]byte, int, int, bool) {
|
||||
var ok bool
|
||||
if width > 0 {
|
||||
if pretty && open == '[' && max == -1 {
|
||||
// here we try to create a single line array
|
||||
max := width - (len(buf) - nl)
|
||||
if max > 3 {
|
||||
s1, s2 := len(buf), i
|
||||
buf, i, _, ok = appendPrettyObject(buf, json, i, '[', ']', false, width, prefix, "", sortkeys, 0, 0, max)
|
||||
if ok && len(buf)-s1 <= max {
|
||||
return buf, i, nl, true
|
||||
}
|
||||
buf = buf[:s1]
|
||||
i = s2
|
||||
}
|
||||
} else if max != -1 && open == '{' {
|
||||
return buf, i, nl, false
|
||||
}
|
||||
}
|
||||
buf = append(buf, open)
|
||||
i++
|
||||
var pairs []pair
|
||||
if open == '{' && sortkeys {
|
||||
pairs = make([]pair, 0, 8)
|
||||
}
|
||||
var n int
|
||||
for ; i < len(json); i++ {
|
||||
if json[i] <= ' ' {
|
||||
continue
|
||||
}
|
||||
if json[i] == close {
|
||||
if pretty {
|
||||
if open == '{' && sortkeys {
|
||||
buf = sortPairs(json, buf, pairs)
|
||||
}
|
||||
if n > 0 {
|
||||
nl = len(buf)
|
||||
if buf[nl-1] == ' ' {
|
||||
buf[nl-1] = '\n'
|
||||
} else {
|
||||
buf = append(buf, '\n')
|
||||
}
|
||||
}
|
||||
if buf[len(buf)-1] != open {
|
||||
buf = appendTabs(buf, prefix, indent, tabs)
|
||||
}
|
||||
}
|
||||
buf = append(buf, close)
|
||||
return buf, i + 1, nl, open != '{'
|
||||
}
|
||||
if open == '[' || json[i] == '"' {
|
||||
if n > 0 {
|
||||
buf = append(buf, ',')
|
||||
if width != -1 && open == '[' {
|
||||
buf = append(buf, ' ')
|
||||
}
|
||||
}
|
||||
var p pair
|
||||
if pretty {
|
||||
nl = len(buf)
|
||||
if buf[nl-1] == ' ' {
|
||||
buf[nl-1] = '\n'
|
||||
} else {
|
||||
buf = append(buf, '\n')
|
||||
}
|
||||
if open == '{' && sortkeys {
|
||||
p.kstart = i
|
||||
p.vstart = len(buf)
|
||||
}
|
||||
buf = appendTabs(buf, prefix, indent, tabs+1)
|
||||
}
|
||||
if open == '{' {
|
||||
buf, i, nl, _ = appendPrettyString(buf, json, i, nl)
|
||||
if sortkeys {
|
||||
p.kend = i
|
||||
}
|
||||
buf = append(buf, ':')
|
||||
if pretty {
|
||||
buf = append(buf, ' ')
|
||||
}
|
||||
}
|
||||
buf, i, nl, ok = appendPrettyAny(buf, json, i, pretty, width, prefix, indent, sortkeys, tabs+1, nl, max)
|
||||
if max != -1 && !ok {
|
||||
return buf, i, nl, false
|
||||
}
|
||||
if pretty && open == '{' && sortkeys {
|
||||
p.vend = len(buf)
|
||||
if p.kstart > p.kend || p.vstart > p.vend {
|
||||
// bad data. disable sorting
|
||||
sortkeys = false
|
||||
} else {
|
||||
pairs = append(pairs, p)
|
||||
}
|
||||
}
|
||||
i--
|
||||
n++
|
||||
}
|
||||
}
|
||||
return buf, i, nl, open != '{'
|
||||
}
|
||||
func sortPairs(json, buf []byte, pairs []pair) []byte {
|
||||
if len(pairs) == 0 {
|
||||
return buf
|
||||
}
|
||||
vstart := pairs[0].vstart
|
||||
vend := pairs[len(pairs)-1].vend
|
||||
arr := byKeyVal{false, json, buf, pairs}
|
||||
sort.Stable(&arr)
|
||||
if !arr.sorted {
|
||||
return buf
|
||||
}
|
||||
nbuf := make([]byte, 0, vend-vstart)
|
||||
for i, p := range pairs {
|
||||
nbuf = append(nbuf, buf[p.vstart:p.vend]...)
|
||||
if i < len(pairs)-1 {
|
||||
nbuf = append(nbuf, ',')
|
||||
nbuf = append(nbuf, '\n')
|
||||
}
|
||||
}
|
||||
return append(buf[:vstart], nbuf...)
|
||||
}
|
||||
|
||||
func appendPrettyString(buf, json []byte, i, nl int) ([]byte, int, int, bool) {
|
||||
s := i
|
||||
i++
|
||||
for ; i < len(json); i++ {
|
||||
if json[i] == '"' {
|
||||
var sc int
|
||||
for j := i - 1; j > s; j-- {
|
||||
if json[j] == '\\' {
|
||||
sc++
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
if sc%2 == 1 {
|
||||
continue
|
||||
}
|
||||
i++
|
||||
break
|
||||
}
|
||||
}
|
||||
return append(buf, json[s:i]...), i, nl, true
|
||||
}
|
||||
|
||||
func appendPrettyNumber(buf, json []byte, i, nl int) ([]byte, int, int, bool) {
|
||||
s := i
|
||||
i++
|
||||
for ; i < len(json); i++ {
|
||||
if json[i] <= ' ' || json[i] == ',' || json[i] == ':' || json[i] == ']' || json[i] == '}' {
|
||||
break
|
||||
}
|
||||
}
|
||||
return append(buf, json[s:i]...), i, nl, true
|
||||
}
|
||||
|
||||
func appendTabs(buf []byte, prefix, indent string, tabs int) []byte {
|
||||
if len(prefix) != 0 {
|
||||
buf = append(buf, prefix...)
|
||||
}
|
||||
if len(indent) == 2 && indent[0] == ' ' && indent[1] == ' ' {
|
||||
for i := 0; i < tabs; i++ {
|
||||
buf = append(buf, ' ', ' ')
|
||||
}
|
||||
} else {
|
||||
for i := 0; i < tabs; i++ {
|
||||
buf = append(buf, indent...)
|
||||
}
|
||||
}
|
||||
return buf
|
||||
}
|
||||
|
||||
// Style is the color style
|
||||
type Style struct {
|
||||
Key, String, Number [2]string
|
||||
True, False, Null [2]string
|
||||
Escape [2]string
|
||||
Brackets [2]string
|
||||
Append func(dst []byte, c byte) []byte
|
||||
}
|
||||
|
||||
func hexp(p byte) byte {
|
||||
switch {
|
||||
case p < 10:
|
||||
return p + '0'
|
||||
default:
|
||||
return (p - 10) + 'a'
|
||||
}
|
||||
}
|
||||
|
||||
// TerminalStyle is for terminals
|
||||
var TerminalStyle *Style
|
||||
|
||||
func init() {
|
||||
TerminalStyle = &Style{
|
||||
Key: [2]string{"\x1B[1m\x1B[94m", "\x1B[0m"},
|
||||
String: [2]string{"\x1B[32m", "\x1B[0m"},
|
||||
Number: [2]string{"\x1B[33m", "\x1B[0m"},
|
||||
True: [2]string{"\x1B[36m", "\x1B[0m"},
|
||||
False: [2]string{"\x1B[36m", "\x1B[0m"},
|
||||
Null: [2]string{"\x1B[2m", "\x1B[0m"},
|
||||
Escape: [2]string{"\x1B[35m", "\x1B[0m"},
|
||||
Brackets: [2]string{"\x1B[1m", "\x1B[0m"},
|
||||
Append: func(dst []byte, c byte) []byte {
|
||||
if c < ' ' && (c != '\r' && c != '\n' && c != '\t' && c != '\v') {
|
||||
dst = append(dst, "\\u00"...)
|
||||
dst = append(dst, hexp((c>>4)&0xF))
|
||||
return append(dst, hexp((c)&0xF))
|
||||
}
|
||||
return append(dst, c)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Color will colorize the json. The style parma is used for customizing
|
||||
// the colors. Passing nil to the style param will use the default
|
||||
// TerminalStyle.
|
||||
func Color(src []byte, style *Style) []byte {
|
||||
if style == nil {
|
||||
style = TerminalStyle
|
||||
}
|
||||
apnd := style.Append
|
||||
if apnd == nil {
|
||||
apnd = func(dst []byte, c byte) []byte {
|
||||
return append(dst, c)
|
||||
}
|
||||
}
|
||||
type stackt struct {
|
||||
kind byte
|
||||
key bool
|
||||
}
|
||||
var dst []byte
|
||||
var stack []stackt
|
||||
for i := 0; i < len(src); i++ {
|
||||
if src[i] == '"' {
|
||||
key := len(stack) > 0 && stack[len(stack)-1].key
|
||||
if key {
|
||||
dst = append(dst, style.Key[0]...)
|
||||
} else {
|
||||
dst = append(dst, style.String[0]...)
|
||||
}
|
||||
dst = apnd(dst, '"')
|
||||
esc := false
|
||||
uesc := 0
|
||||
for i = i + 1; i < len(src); i++ {
|
||||
if src[i] == '\\' {
|
||||
if key {
|
||||
dst = append(dst, style.Key[1]...)
|
||||
} else {
|
||||
dst = append(dst, style.String[1]...)
|
||||
}
|
||||
dst = append(dst, style.Escape[0]...)
|
||||
dst = apnd(dst, src[i])
|
||||
esc = true
|
||||
if i+1 < len(src) && src[i+1] == 'u' {
|
||||
uesc = 5
|
||||
} else {
|
||||
uesc = 1
|
||||
}
|
||||
} else if esc {
|
||||
dst = apnd(dst, src[i])
|
||||
if uesc == 1 {
|
||||
esc = false
|
||||
dst = append(dst, style.Escape[1]...)
|
||||
if key {
|
||||
dst = append(dst, style.Key[0]...)
|
||||
} else {
|
||||
dst = append(dst, style.String[0]...)
|
||||
}
|
||||
} else {
|
||||
uesc--
|
||||
}
|
||||
} else {
|
||||
dst = apnd(dst, src[i])
|
||||
}
|
||||
if src[i] == '"' {
|
||||
j := i - 1
|
||||
for ; ; j-- {
|
||||
if src[j] != '\\' {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (j-i)%2 != 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if esc {
|
||||
dst = append(dst, style.Escape[1]...)
|
||||
} else if key {
|
||||
dst = append(dst, style.Key[1]...)
|
||||
} else {
|
||||
dst = append(dst, style.String[1]...)
|
||||
}
|
||||
} else if src[i] == '{' || src[i] == '[' {
|
||||
stack = append(stack, stackt{src[i], src[i] == '{'})
|
||||
dst = append(dst, style.Brackets[0]...)
|
||||
dst = apnd(dst, src[i])
|
||||
dst = append(dst, style.Brackets[1]...)
|
||||
} else if (src[i] == '}' || src[i] == ']') && len(stack) > 0 {
|
||||
stack = stack[:len(stack)-1]
|
||||
dst = append(dst, style.Brackets[0]...)
|
||||
dst = apnd(dst, src[i])
|
||||
dst = append(dst, style.Brackets[1]...)
|
||||
} else if (src[i] == ':' || src[i] == ',') && len(stack) > 0 && stack[len(stack)-1].kind == '{' {
|
||||
stack[len(stack)-1].key = !stack[len(stack)-1].key
|
||||
dst = append(dst, style.Brackets[0]...)
|
||||
dst = apnd(dst, src[i])
|
||||
dst = append(dst, style.Brackets[1]...)
|
||||
} else {
|
||||
var kind byte
|
||||
if (src[i] >= '0' && src[i] <= '9') || src[i] == '-' || isNaNOrInf(src[i:]) {
|
||||
kind = '0'
|
||||
dst = append(dst, style.Number[0]...)
|
||||
} else if src[i] == 't' {
|
||||
kind = 't'
|
||||
dst = append(dst, style.True[0]...)
|
||||
} else if src[i] == 'f' {
|
||||
kind = 'f'
|
||||
dst = append(dst, style.False[0]...)
|
||||
} else if src[i] == 'n' {
|
||||
kind = 'n'
|
||||
dst = append(dst, style.Null[0]...)
|
||||
} else {
|
||||
dst = apnd(dst, src[i])
|
||||
}
|
||||
if kind != 0 {
|
||||
for ; i < len(src); i++ {
|
||||
if src[i] <= ' ' || src[i] == ',' || src[i] == ':' || src[i] == ']' || src[i] == '}' {
|
||||
i--
|
||||
break
|
||||
}
|
||||
dst = apnd(dst, src[i])
|
||||
}
|
||||
if kind == '0' {
|
||||
dst = append(dst, style.Number[1]...)
|
||||
} else if kind == 't' {
|
||||
dst = append(dst, style.True[1]...)
|
||||
} else if kind == 'f' {
|
||||
dst = append(dst, style.False[1]...)
|
||||
} else if kind == 'n' {
|
||||
dst = append(dst, style.Null[1]...)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Spec strips out comments and trailing commas and convert the input to a
|
||||
// valid JSON per the official spec: https://tools.ietf.org/html/rfc8259
|
||||
//
|
||||
// The resulting JSON will always be the same length as the input and it will
|
||||
// include all of the same line breaks at matching offsets. This is to ensure
|
||||
// the result can be later processed by a external parser and that that
|
||||
// parser will report messages or errors with the correct offsets.
|
||||
func Spec(src []byte) []byte {
|
||||
return spec(src, nil)
|
||||
}
|
||||
|
||||
// SpecInPlace is the same as Spec, but this method reuses the input json
|
||||
// buffer to avoid allocations. Do not use the original bytes slice upon return.
|
||||
func SpecInPlace(src []byte) []byte {
|
||||
return spec(src, src)
|
||||
}
|
||||
|
||||
func spec(src, dst []byte) []byte {
|
||||
dst = dst[:0]
|
||||
for i := 0; i < len(src); i++ {
|
||||
if src[i] == '/' {
|
||||
if i < len(src)-1 {
|
||||
if src[i+1] == '/' {
|
||||
dst = append(dst, ' ', ' ')
|
||||
i += 2
|
||||
for ; i < len(src); i++ {
|
||||
if src[i] == '\n' {
|
||||
dst = append(dst, '\n')
|
||||
break
|
||||
} else if src[i] == '\t' || src[i] == '\r' {
|
||||
dst = append(dst, src[i])
|
||||
} else {
|
||||
dst = append(dst, ' ')
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
if src[i+1] == '*' {
|
||||
dst = append(dst, ' ', ' ')
|
||||
i += 2
|
||||
for ; i < len(src)-1; i++ {
|
||||
if src[i] == '*' && src[i+1] == '/' {
|
||||
dst = append(dst, ' ', ' ')
|
||||
i++
|
||||
break
|
||||
} else if src[i] == '\n' || src[i] == '\t' ||
|
||||
src[i] == '\r' {
|
||||
dst = append(dst, src[i])
|
||||
} else {
|
||||
dst = append(dst, ' ')
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
dst = append(dst, src[i])
|
||||
if src[i] == '"' {
|
||||
for i = i + 1; i < len(src); i++ {
|
||||
dst = append(dst, src[i])
|
||||
if src[i] == '"' {
|
||||
j := i - 1
|
||||
for ; ; j-- {
|
||||
if src[j] != '\\' {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (j-i)%2 != 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if src[i] == '}' || src[i] == ']' {
|
||||
for j := len(dst) - 2; j >= 0; j-- {
|
||||
if dst[j] <= ' ' {
|
||||
continue
|
||||
}
|
||||
if dst[j] == ',' {
|
||||
dst[j] = ' '
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
11
vendor/modules.txt
vendored
11
vendor/modules.txt
vendored
@@ -1555,7 +1555,7 @@ github.com/opentracing/opentracing-go/log
|
||||
# github.com/orcaman/concurrent-map v1.0.0
|
||||
## explicit
|
||||
github.com/orcaman/concurrent-map
|
||||
# github.com/owncloud/libre-graph-api-go v1.0.5-0.20231019070917-17ae03ef40e4
|
||||
# github.com/owncloud/libre-graph-api-go v1.0.5-0.20231107135330-011e9d4c45e3
|
||||
## explicit; go 1.18
|
||||
github.com/owncloud/libre-graph-api-go
|
||||
# github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c
|
||||
@@ -1704,6 +1704,15 @@ github.com/tchap/go-patricia/v2/patricia
|
||||
# github.com/thejerf/suture/v4 v4.0.2
|
||||
## explicit; go 1.9
|
||||
github.com/thejerf/suture/v4
|
||||
# github.com/tidwall/gjson v1.17.0
|
||||
## explicit; go 1.12
|
||||
github.com/tidwall/gjson
|
||||
# github.com/tidwall/match v1.1.1
|
||||
## explicit; go 1.15
|
||||
github.com/tidwall/match
|
||||
# github.com/tidwall/pretty v1.2.1
|
||||
## explicit; go 1.16
|
||||
github.com/tidwall/pretty
|
||||
# github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208
|
||||
## explicit
|
||||
github.com/toorop/go-dkim
|
||||
|
||||
Reference in New Issue
Block a user