add missing Comments to Public Functions

This commit is contained in:
Samuel Lorch 2021-08-30 19:03:01 +02:00
parent b047c9c647
commit 982af2dae4
8 changed files with 16 additions and 1 deletions

View file

@ -30,6 +30,7 @@ func (c *Client) DoCustomRequest(ctx context.Context, method, path, version stri
return response, err
}
// DoCustomRequestAndReturnRawResponse Executes a Custom Request and returns a APIResponse and the Raw HTTP Response
func (c *Client) DoCustomRequestAndReturnRawResponse(ctx context.Context, method, path, version string, body interface{}, opts interface{}) (*http.Response, *APIResponse, error) {
u, err := addOptions(path, version, opts)
if err != nil {

View file

@ -176,6 +176,7 @@ func (c *Client) Logout(ctx context.Context) error {
return nil
}
// GetUserID Gets the ID of the Current User
func (c *Client) GetUserID() string {
return c.userID
}

View file

@ -3,6 +3,7 @@ package api
import "errors"
var (
// API Error Codes
ErrAPIResponseErrorStatusCode = errors.New("Error API JSON Response Status")
ErrAPIResponseUnknownStatusCode = errors.New("Unknown API JSON Response Status")
)

View file

@ -15,6 +15,7 @@ type ResourceType struct {
Modified *Time `json:"modified,omitempty"`
}
// GetResourceTypesOptions is a placeholder for future options
type GetResourceTypesOptions struct {
}

View file

@ -15,6 +15,7 @@ type Secret struct {
Modified *Time `json:"modified,omitempty"`
}
// SecretDataTypePasswordAndDescription is the format a secret of resource type "password-and-description" is stored in
type SecretDataTypePasswordAndDescription struct {
Password string `json:"password"`
Description string `json:"description,omitempty"`

View file

@ -11,20 +11,23 @@ type ResourceShareRequest struct {
Secrets []Secret `json:"secrets,omitempty"`
}
// ResourceShareSimulationResult is the Result of a Sharing Siumulation
// ResourceShareSimulationResult is the Result of a Sharing Simulation
type ResourceShareSimulationResult struct {
Changes ResourceShareSimulationChanges `json:"changes,omitempty"`
}
// ResourceShareSimulationChanges contains the Actual Changes
type ResourceShareSimulationChanges struct {
Added []ResourceShareSimulationChange `json:"added,omitempty"`
Removed []ResourceShareSimulationChange `json:"removed,omitempty"`
}
// ResourceShareSimulationChange is a single change
type ResourceShareSimulationChange struct {
User ResourceShareSimulationUser `json:"user,omitempty"`
}
// ResourceShareSimulationUser contains the users id
type ResourceShareSimulationUser struct {
ID string `json:"id,omitempty"`
}

View file

@ -6,6 +6,7 @@ import (
"github.com/speatzle/go-passbolt/api"
)
// CreateFolder Creates a new Folder
func CreateFolder(ctx context.Context, c *api.Client, folderParentID, name string) (string, error) {
f, err := c.CreateFolder(ctx, api.Folder{
Name: name,
@ -14,20 +15,24 @@ func CreateFolder(ctx context.Context, c *api.Client, folderParentID, name strin
return f.ID, err
}
// GetFolder Gets a Folder
func GetFolder(ctx context.Context, c *api.Client, folderID string) (string, string, error) {
f, err := c.GetFolder(ctx, folderID)
return f.FolderParentID, f.Name, err
}
// UpdateFolder Updates a Folder
func UpdateFolder(ctx context.Context, c *api.Client, folderID, name string) error {
_, err := c.UpdateFolder(ctx, folderID, api.Folder{Name: name})
return err
}
// DeleteFolder Deletes a Folder
func DeleteFolder(ctx context.Context, c *api.Client, folderID string) error {
return c.DeleteFolder(ctx, folderID)
}
// MoveFolder Moves a Folder into a Folder
func MoveFolder(ctx context.Context, c *api.Client, folderID, folderParentID string) error {
return c.MoveFolder(ctx, folderID, folderParentID)
}

View file

@ -199,10 +199,12 @@ func UpdateResource(ctx context.Context, c *api.Client, resourceID, name, userna
return nil
}
// DeleteResource Deletes a Resource
func DeleteResource(ctx context.Context, c *api.Client, resourceID string) error {
return c.DeleteResource(ctx, resourceID)
}
// MoveResource Moves a Resource into a Folder
func MoveResource(ctx context.Context, c *api.Client, resourceID, folderParentID string) error {
return c.MoveResource(ctx, resourceID, folderParentID)
}