From 982af2dae40add8a8974b5cef318d6f1dead6d27 Mon Sep 17 00:00:00 2001 From: Samuel Lorch Date: Mon, 30 Aug 2021 19:03:01 +0200 Subject: [PATCH] add missing Comments to Public Functions --- api/api.go | 1 + api/auth.go | 1 + api/errors.go | 1 + api/resource_types.go | 1 + api/secrets.go | 1 + api/share.go | 5 ++++- helper/folder.go | 5 +++++ helper/resources.go | 2 ++ 8 files changed, 16 insertions(+), 1 deletion(-) diff --git a/api/api.go b/api/api.go index 0ea2a29..15225d8 100644 --- a/api/api.go +++ b/api/api.go @@ -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 { diff --git a/api/auth.go b/api/auth.go index c2dcfae..a128bff 100644 --- a/api/auth.go +++ b/api/auth.go @@ -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 } diff --git a/api/errors.go b/api/errors.go index 0d0c1f0..1190a85 100644 --- a/api/errors.go +++ b/api/errors.go @@ -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") ) diff --git a/api/resource_types.go b/api/resource_types.go index 09bd485..862180b 100644 --- a/api/resource_types.go +++ b/api/resource_types.go @@ -15,6 +15,7 @@ type ResourceType struct { Modified *Time `json:"modified,omitempty"` } +// GetResourceTypesOptions is a placeholder for future options type GetResourceTypesOptions struct { } diff --git a/api/secrets.go b/api/secrets.go index 9618a94..70979cd 100644 --- a/api/secrets.go +++ b/api/secrets.go @@ -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"` diff --git a/api/share.go b/api/share.go index 18a95c4..8e940f0 100644 --- a/api/share.go +++ b/api/share.go @@ -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"` } diff --git a/helper/folder.go b/helper/folder.go index 55b66bb..33895cd 100644 --- a/helper/folder.go +++ b/helper/folder.go @@ -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) } diff --git a/helper/resources.go b/helper/resources.go index 48ff413..248b487 100644 --- a/helper/resources.go +++ b/helper/resources.go @@ -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) }