working commit

This commit is contained in:
2026-02-21 12:31:39 +02:00
parent 3220e2d78f
commit cd37a4508c
37 changed files with 354 additions and 319 deletions
+8 -9
View File
@@ -17,12 +17,11 @@ import (
"mstore/app/handler"
"mstore/app/operator"
"mstore/pkg/descr"
"mstore/pkg/auxid"
)
func (cli *Client) CreateAccount(ctx context.Context, hosturi, username, password string) (uint64, error) {
func (cli *Client) CreateAccount(ctx context.Context, hosturi, username, password string) (string, error) {
var err error
var res uint64
var res string
apiuri, err := setApiPath(hosturi, "/v3/api/account/create")
if err != nil {
@@ -54,7 +53,7 @@ func (cli *Client) CreateAccount(ctx context.Context, hosturi, username, passwor
return res, err
}
func (cli *Client) GetAccountByID(ctx context.Context, hosturi string, id uint64) (*descr.AccountShort, error) {
func (cli *Client) GetAccountByID(ctx context.Context, hosturi, accountID string) (*descr.AccountShort, error) {
var err error
res := &descr.AccountShort{}
@@ -64,7 +63,7 @@ func (cli *Client) GetAccountByID(ctx context.Context, hosturi string, id uint64
}
operParams := operator.GetAccountParams{
AccountID: id,
AccountID: accountID,
}
paramsJson, err := json.Marshal(operParams)
if err != nil {
@@ -121,7 +120,7 @@ func (cli *Client) GetAccountByName(ctx context.Context, hosturi, username strin
return res, err
}
func (cli *Client) UpdateAccountByID(ctx context.Context, hosturi string, id uint64, newUsername, newPassword string) error {
func (cli *Client) UpdateAccountByID(ctx context.Context, hosturi string, accountID, newUsername, newPassword string) error {
var err error
apipath, err := setApiPath(hosturi, "/v3/api/account/update")
@@ -129,7 +128,7 @@ func (cli *Client) UpdateAccountByID(ctx context.Context, hosturi string, id uin
return err
}
operParams := operator.UpdateAccountParams{
AccountID: id,
AccountID: accountID,
NewUsername: newUsername,
NewPassword: newPassword,
}
@@ -215,7 +214,7 @@ func (cli *Client) DeleteAccountByName(ctx context.Context, hosturi, username st
return err
}
func (cli *Client) DeleteAccountByID(ctx context.Context, hosturi string, id uint64) error {
func (cli *Client) DeleteAccountByID(ctx context.Context, hosturi, accountID string) error {
var err error
apipath, err := setApiPath(hosturi, "/v3/api/account/delete")
@@ -223,7 +222,7 @@ func (cli *Client) DeleteAccountByID(ctx context.Context, hosturi string, id uin
return err
}
operParams := operator.DeleteAccountParams{
AccountID: id,
AccountID: accountID,
}
paramsJson, err := json.Marshal(operParams)
if err != nil {
+3 -4
View File
@@ -23,7 +23,6 @@ import (
"mstore/pkg/auxhttp"
"mstore/pkg/descr"
"mstore/pkg/term"
)
func (cli *Client) FileInfo(ctx context.Context, fileuri string) (bool, *descr.File, error) {
@@ -209,7 +208,7 @@ func (cli *Client) DeleteFile(ctx context.Context, fileuri string) error {
return err
}
func (cli *Client) ListFiles(ctx context.Context, catalogURI string, usePathAs term.PathUsage) ([]descr.File, error) {
func (cli *Client) ListFiles(ctx context.Context, catalogURI, usePathAs string) ([]descr.File, error) {
var err error
res := make([]descr.File, 0)
@@ -277,7 +276,7 @@ func (cli *Client) ListFiles(ctx context.Context, catalogURI string, usePathAs t
return res, err
}
func (cli *Client) ListCollections(ctx context.Context, catalogURI string, usePathAs term.PathUsage) ([]string, error) {
func (cli *Client) ListCollections(ctx context.Context, catalogURI, usePathAs string) ([]string, error) {
var err error
res := make([]string, 0)
@@ -346,7 +345,7 @@ func (cli *Client) ListCollections(ctx context.Context, catalogURI string, usePa
return res, err
}
func (cli *Client) DeleteCollection(ctx context.Context, catalogURI string, usePathAs term.PathUsage, dryRun bool) ([]descr.File, error) {
func (cli *Client) DeleteCollection(ctx context.Context, catalogURI, usePathAs string, dryRun bool) ([]descr.File, error) {
var err error
res := make([]descr.File, 0)
+9 -11
View File
@@ -17,13 +17,11 @@ import (
"mstore/app/handler"
"mstore/app/operator"
"mstore/pkg/descr"
"mstore/pkg/term"
"mstore/pkg/auxid"
)
func (cli *Client) CreateGrantByAccountID(ctx context.Context, hosturi string, accountID uint64, right term.Right, pattern string) (uint64, error) {
func (cli *Client) CreateGrantByAccountID(ctx context.Context, hosturi string, accountID, right, pattern string) (string, error) {
var err error
var res uint64
var res string
apiuri, err := setApiPath(hosturi, "/v3/api/grant/create")
if err != nil {
@@ -56,9 +54,9 @@ func (cli *Client) CreateGrantByAccountID(ctx context.Context, hosturi string, a
return res, err
}
func (cli *Client) CreateGrantByUsername(ctx context.Context, hosturi, username string, right term.Right, pattern string) (uint64, error) {
func (cli *Client) CreateGrantByUsername(ctx context.Context, hosturi, username string, right string, pattern string) (string, error) {
var err error
var res uint64
var res string
apiuri, err := setApiPath(hosturi, "/v3/api/grant/create")
if err != nil {
@@ -91,7 +89,7 @@ func (cli *Client) CreateGrantByUsername(ctx context.Context, hosturi, username
return res, err
}
func (cli *Client) GetGrant(ctx context.Context, hosturi string, id uint64) (*descr.Grant, error) {
func (cli *Client) GetGrant(ctx context.Context, hosturi, grantID string) (*descr.Grant, error) {
var err error
res := &descr.Grant{}
@@ -100,7 +98,7 @@ func (cli *Client) GetGrant(ctx context.Context, hosturi string, id uint64) (*de
return res, err
}
operParams := operator.GetGrantParams{
GrantID: id,
GrantID: grantID,
}
paramsJson, err := json.Marshal(operParams)
if err != nil {
@@ -124,7 +122,7 @@ func (cli *Client) GetGrant(ctx context.Context, hosturi string, id uint64) (*de
return res, err
}
func (cli *Client) UpdateGrant(ctx context.Context, hosturi string, grantID uint64, newPattern string) error {
func (cli *Client) UpdateGrant(ctx context.Context, hosturi, grantID, newPattern string) error {
var err error
apipath, err := setApiPath(hosturi, "/v3/api/grant/update")
@@ -155,7 +153,7 @@ func (cli *Client) UpdateGrant(ctx context.Context, hosturi string, grantID uint
return err
}
func (cli *Client) DeleteGrant(ctx context.Context, hosturi string, grantID uint64) error {
func (cli *Client) DeleteGrant(ctx context.Context, hosturi, grantID string) error {
var err error
apipath, err := setApiPath(hosturi, "/v3/api/grant/delete")
@@ -186,7 +184,7 @@ func (cli *Client) DeleteGrant(ctx context.Context, hosturi string, grantID uint
return err
}
func (cli *Client) ListGrantsByAccountID(ctx context.Context, hosturi string, accountID uint64) ([]descr.Grant, error) {
func (cli *Client) ListGrantsByAccountID(ctx context.Context, hosturi, accountID string) ([]descr.Grant, error) {
var err error
res := make([]descr.Grant, 0)