From ddfc6042ffdf48e0072f2c2a08e34c8c3b16d7e5 Mon Sep 17 00:00:00 2001 From: ShivkeshMadasu Date: Mon, 17 Jul 2023 17:35:39 +0530 Subject: [PATCH 1/3] DEX-228 SDK references --- commonutils/logwrapper/logger.go | 6 ++ processMarkdown.go | 144 ++++++++++++++++++++++++++ serviceaccount/util/token.go | 3 + skyflow/client/client.go | 5 + skyflow/client/init.go | 1 + skyflow/client/token_utils.go | 1 + skyflow/common/common.go | 26 +++++ skyflow/common/helpers.go | 2 + skyflow/vaultapi/detokenize.go | 2 + skyflow/vaultapi/get_by_id.go | 2 + skyflow/vaultapi/insert.go | 3 + skyflow/vaultapi/invoke_connection.go | 2 + 12 files changed, 197 insertions(+) create mode 100644 processMarkdown.go diff --git a/commonutils/logwrapper/logger.go b/commonutils/logwrapper/logger.go index 30c83157..4c4147e4 100644 --- a/commonutils/logwrapper/logger.go +++ b/commonutils/logwrapper/logger.go @@ -5,6 +5,7 @@ package logger import "github.com/sirupsen/logrus" +// This is the description for LogLevel enum type LogLevel int const ( @@ -24,22 +25,27 @@ func init() { log.SetLevel(logrus.ErrorLevel) } +// Internal func Debug(args ...interface{}) { log.Debug(args...) } +// Internal func Info(args ...interface{}) { log.Info(args...) } +// Internal func Warn(args ...interface{}) { log.Warn(args...) } +// Internal func Error(args ...interface{}) { log.Error(args...) } +// This is the description for SetLogLevel function func SetLogLevel(level LogLevel) { switch level { case INFO: diff --git a/processMarkdown.go b/processMarkdown.go new file mode 100644 index 00000000..7787e62e --- /dev/null +++ b/processMarkdown.go @@ -0,0 +1,144 @@ +package main + +import ( + "fmt" + "io/ioutil" + "regexp" + "strings" +) + +func main() { + // Read the markdown file + files := []string{"client", "common", "logger", "util", "vaultapi"} + + for _, filename := range files { + file := "docs/" + filename + ".md" + data, err := ioutil.ReadFile(file) + if err != nil { + fmt.Println("Error reading file:", err) + return + } + // fmt.Println(data) + // Convert byte data to string + markdown := string(data) + + markdown = "{% env enable=\"goSdkRef\" %}\n\n" + markdown + + // Remove import statement + markdown = removeImportStatement(markdown) + + // Remove copyright statement + markdown = removeCopyrightStatement(markdown) + + // Remove functions with Deprecated description + markdown = removeDeprecatedOrInternal(markdown) + + // Represent type as h2 + markdown = changeTypeHeading(markdown) + + // Represent functions as h3 + markdown = changeFuncHeading(markdown) + + // Remove multiple empty lines + markdown = removeMultipleEmptyLines(markdown) + + markdown = markdown + "\n{% /env %}" + + // Write the modified markdown back to the file + err = ioutil.WriteFile(file, []byte(markdown), 0644) + if err != nil { + fmt.Println("Error writing file:", err) + return + } + } + + fmt.Println("Markdown files updated successfully.") + +} + +func removeImportStatement(markdown string) string { + // Use regex to match and remove import statement + importRegex := regexp.MustCompile(`--\n\s*import\s+"."\n`) + markdown = importRegex.ReplaceAllString(markdown, "") + + return markdown +} + +func removeCopyrightStatement(markdown string) string { + // Use regex to match and remove copyright statement + copyrightRegex := regexp.MustCompile(`\s*Copyright.*`) + markdown = copyrightRegex.ReplaceAllString(markdown, "") + + return markdown +} + +// func removeDeprecatedFunctions(markdown string) string { +// // Regular expression pattern to match the deprecated functions +// pattern := regexp.MustCompile(`(?s)(?m)#### func\s*((?!#### func).)*?Deprecated.*?\n\n`) +// return pattern.ReplaceAllString(markdown, "") +// } + +func sum(arr []int) int { + sum := 0 + for _, valueInt := range arr { + sum += valueInt + } + return sum +} + +func removeDeprecatedOrInternal(markdown string) string { + lines := strings.Split(markdown, "\n") + var result []string + var temp []int + startIndex := 0 + endIndex := 0 + for i, line := range lines { + if strings.HasPrefix(line, "#### func") { + startIndex = i + } else if strings.HasPrefix(line, "#### type") { + startIndex = i + } else if strings.HasPrefix(line, "Deprecated") { + endIndex = i + } else if strings.HasPrefix(line, "Internal") { + endIndex = i + } + + result = append(result, line) + if startIndex > 0 && endIndex > 0 { + result = append(result[:startIndex-(sum(temp)+1)]) + temp = append(temp, (endIndex-startIndex)+1) + startIndex = 0 + endIndex = 0 + } + } + + return strings.Join(result, "\n") +} + +func changeTypeHeading(markdown string) string { + // Regular expression pattern to match type headings (h4) + pattern := regexp.MustCompile(`#### type`) + + // Replace type heading (h4) with h2 + return pattern.ReplaceAllStringFunc(markdown, func(match string) string { + return strings.Replace(match, "####", "##", 1) + }) +} + +func changeFuncHeading(markdown string) string { + // Regular expression pattern to match func headings (h4) + pattern := regexp.MustCompile(`#### func`) + + // Replace func heading (h4) with h3 + return pattern.ReplaceAllStringFunc(markdown, func(match string) string { + return strings.Replace(match, "####", "###", 1) + }) +} + +func removeMultipleEmptyLines(markdown string) string { + // Regular expression pattern to match multiple empty lines + pattern := regexp.MustCompile(`\n{2,}`) + + // Replace multiple empty lines with a single empty line + return pattern.ReplaceAllString(markdown, "\n\n") +} \ No newline at end of file diff --git a/serviceaccount/util/token.go b/serviceaccount/util/token.go index 673be968..7a297f27 100644 --- a/serviceaccount/util/token.go +++ b/serviceaccount/util/token.go @@ -22,6 +22,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) +// This is the description for ResponseToken struct type ResponseToken struct { AccessToken string `json:"accessToken"` TokenType string `json:tokenType` @@ -66,6 +67,7 @@ func GenerateBearerToken(filePath string) (*ResponseToken, *errors.SkyflowError) return token, nil } +// This is the description for GenerateBearerTokenFromCreds function func GenerateBearerTokenFromCreds(credentials string) (*ResponseToken, *errors.SkyflowError) { credsMap := make(map[string]interface{}) @@ -234,6 +236,7 @@ func IsValid(tokenString string) bool { return !IsExpired(tokenString) } +// This is the description for IsExpired function func IsExpired(tokenString string) bool { if tokenString == "" { logger.Info(fmt.Sprintf(messages.EMPTY_BEARER_TOKEN, "ServiceAccountUtil")) diff --git a/skyflow/client/client.go b/skyflow/client/client.go index 3bab27fc..45546045 100644 --- a/skyflow/client/client.go +++ b/skyflow/client/client.go @@ -14,6 +14,7 @@ import ( vaultapi "github.com/skyflowapi/skyflow-go/skyflow/vaultapi" ) +// This is the description for Client struct type Client struct { configuration common.Configuration } @@ -22,6 +23,7 @@ var clientTag = "Client" var tokenUtils TokenUtils +// This is the description for Insert function func (client *Client) Insert(records map[string]interface{}, options ...common.InsertOptions) (common.InsertRecords, *errors.SkyflowError) { var tempOptions common.InsertOptions if len(options) == 0 { @@ -54,6 +56,7 @@ func (client *Client) Insert(records map[string]interface{}, options ...common.I return response, nil } +// This is the description for Detokenize function func (client *Client) Detokenize(records map[string]interface{}) (common.DetokenizeRecords, *errors.SkyflowError) { if client.configuration.TokenProvider == nil { @@ -81,6 +84,7 @@ func (client *Client) Detokenize(records map[string]interface{}) (common.Detoken return response, nil } +// This is the description for GetById function func (client *Client) GetById(records map[string]interface{}) (common.GetByIdRecords, *errors.SkyflowError) { if client.configuration.TokenProvider == nil { @@ -108,6 +112,7 @@ func (client *Client) GetById(records map[string]interface{}) (common.GetByIdRec return response, nil } +// This is the description for InvokeConnection function func (client *Client) InvokeConnection(connectionConfig common.ConnectionConfig) (common.ResponseBody, *errors.SkyflowError) { if client.configuration.TokenProvider == nil { diff --git a/skyflow/client/init.go b/skyflow/client/init.go index 8ffefe58..0d7a8de6 100644 --- a/skyflow/client/init.go +++ b/skyflow/client/init.go @@ -11,6 +11,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) +// This is the description for Init function func Init(configuration common.Configuration) Client { logger.Info(fmt.Sprintf(messages.INITIALIZING_SKYFLOW_CLIENT, clientTag)) return Client{configuration} diff --git a/skyflow/client/token_utils.go b/skyflow/client/token_utils.go index ea5d7005..3b31e9f4 100644 --- a/skyflow/client/token_utils.go +++ b/skyflow/client/token_utils.go @@ -14,6 +14,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) +// This is the description for TokenUtils struct type TokenUtils struct { Token string } diff --git a/skyflow/common/common.go b/skyflow/common/common.go index b9d71b4b..79a6937d 100644 --- a/skyflow/common/common.go +++ b/skyflow/common/common.go @@ -3,9 +3,13 @@ Copyright (c) 2022 Skyflow, Inc. */ package common +// Internal type ResponseBody map[string]interface{} + +// This is the description for TokenProvider type type TokenProvider func() (string, error) +// This is the description for RequestMethod type type RequestMethod int const ( @@ -16,10 +20,12 @@ const ( DELETE ) +// This is the description for RequestMethod function func (requestMethod RequestMethod) String() string { return [...]string{"GET", "POST", "PUT", "PATCH", "DELETE"}[requestMethod] } +// This is the description for RedactionType enum type RedactionType string const ( @@ -29,6 +35,7 @@ const ( REDACTED RedactionType = "REDACTED" ) +// This is the description for ConnectionConfig struct type ConnectionConfig struct { ConnectionURL string MethodName RequestMethod @@ -38,83 +45,102 @@ type ConnectionConfig struct { RequestHeader map[string]string } +// This is the description for InsertOptions struct type InsertOptions struct { Tokens bool Upsert []UpsertOptions } + +// This is the description for UpsertOptions struct type UpsertOptions struct { Table string Column string } +// This is the description for Configuration struct type Configuration struct { VaultID string VaultURL string TokenProvider TokenProvider } +// Internal type InsertRecords struct { Records []InsertRecord } +// Internal type InsertRecord struct { Table string Fields map[string]interface{} } +// Internal type DetokenizeInput struct { Records []RevealRecord } +// Internal type RevealRecord struct { Token string Redaction string } +// Internal type DetokenizeRecords struct { Records []DetokenizeRecord Errors []DetokenizeError } +// Internal type DetokenizeRecord struct { Token string Value string } +// Internal type DetokenizeError struct { Token string Error ResponseError } +// Internal type ResponseError struct { Code string Description string } +// Internal type GetByIdInput struct { Records []SkyflowIdRecord } +// Internal type GetByIdRecords struct { Records []GetByIdRecord Errors []GetByIdError } +// Internal type GetByIdRecord struct { Fields map[string]interface{} Table string } +// Internal type GetByIdError struct { Ids []string Error ResponseError } + +// Internal type SkyflowIdRecord struct { Ids []string Redaction RedactionType Table string } +// This is the description for ContentType enum type ContentType string const ( diff --git a/skyflow/common/helpers.go b/skyflow/common/helpers.go index 686480fd..40cfb35a 100644 --- a/skyflow/common/helpers.go +++ b/skyflow/common/helpers.go @@ -10,6 +10,7 @@ import ( logger "github.com/skyflowapi/skyflow-go/commonutils/logwrapper" ) +// Internal func AppendRequestId(message string, requestId string) string { if requestId == "" { return message @@ -18,6 +19,7 @@ func AppendRequestId(message string, requestId string) string { return message + " - requestId : " + requestId } +// Internal func CreateJsonMetadata() string { // Create a map to hold the key-value pairs data := map[string]string{ diff --git a/skyflow/vaultapi/detokenize.go b/skyflow/vaultapi/detokenize.go index 29346483..29719add 100644 --- a/skyflow/vaultapi/detokenize.go +++ b/skyflow/vaultapi/detokenize.go @@ -16,6 +16,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) +// This is the description for DetokenizeApi struct type DetokenizeApi struct { Configuration common.Configuration Records map[string]interface{} @@ -24,6 +25,7 @@ type DetokenizeApi struct { var detokenizeTag = "Detokenize" +// This is the description for Get function func (detokenize *DetokenizeApi) Get() (map[string]interface{}, *errors.SkyflowError) { err := detokenize.doValidations() diff --git a/skyflow/vaultapi/get_by_id.go b/skyflow/vaultapi/get_by_id.go index 742f5cd8..d70abc5d 100644 --- a/skyflow/vaultapi/get_by_id.go +++ b/skyflow/vaultapi/get_by_id.go @@ -17,6 +17,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) +// This is the description for GetByIdApi struct type GetByIdApi struct { Configuration common.Configuration Records map[string]interface{} @@ -25,6 +26,7 @@ type GetByIdApi struct { var getByIdTag = "GetById" +// This is the description for Get function func (g *GetByIdApi) Get() (map[string]interface{}, *errors.SkyflowError) { err := g.doValidations() diff --git a/skyflow/vaultapi/insert.go b/skyflow/vaultapi/insert.go index 843fe820..26491e62 100644 --- a/skyflow/vaultapi/insert.go +++ b/skyflow/vaultapi/insert.go @@ -18,6 +18,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) +// This is the description for InsertApi struct type InsertApi struct { Configuration common.Configuration Records map[string]interface{} @@ -26,6 +27,7 @@ type InsertApi struct { var insertTag = "Insert" +// This is the description for HTTPClient interface type HTTPClient interface { Do(req *http.Request) (*http.Response, error) } @@ -105,6 +107,7 @@ func (insertApi *InsertApi) doValidations() *errors.SkyflowError { return nil } +// This is the description for Post function func (insertApi *InsertApi) Post(token string) (common.ResponseBody, *errors.SkyflowError) { err := insertApi.doValidations() if err != nil { diff --git a/skyflow/vaultapi/invoke_connection.go b/skyflow/vaultapi/invoke_connection.go index f25828da..bbf75581 100644 --- a/skyflow/vaultapi/invoke_connection.go +++ b/skyflow/vaultapi/invoke_connection.go @@ -20,6 +20,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) +// This is the description for InvokeConnectionApi struct type InvokeConnectionApi struct { ConnectionConfig common.ConnectionConfig Token string @@ -41,6 +42,7 @@ func (InvokeConnectionApi *InvokeConnectionApi) doValidations() *errors.SkyflowE return nil } +// This is the description for Post function func (InvokeConnectionApi *InvokeConnectionApi) Post() (map[string]interface{}, *errors.SkyflowError) { validationError := InvokeConnectionApi.doValidations() From 3a8437878b2a6ebf3692d9190a71c0b659a7f316 Mon Sep 17 00:00:00 2001 From: kamal-skyflow Date: Wed, 9 Aug 2023 17:38:18 +0530 Subject: [PATCH 2/3] DEX-228 feat: added comments to this SDK --- commonutils/logwrapper/logger.go | 4 ++-- serviceaccount/util/token.go | 10 +++++----- skyflow/client/client.go | 10 +++++----- skyflow/client/init.go | 2 +- skyflow/client/token_utils.go | 2 +- skyflow/common/common.go | 18 +++++++++--------- skyflow/vaultapi/detokenize.go | 4 ++-- skyflow/vaultapi/get_by_id.go | 4 ++-- skyflow/vaultapi/insert.go | 6 +++--- skyflow/vaultapi/invoke_connection.go | 4 ++-- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/commonutils/logwrapper/logger.go b/commonutils/logwrapper/logger.go index 4c4147e4..d9929e58 100644 --- a/commonutils/logwrapper/logger.go +++ b/commonutils/logwrapper/logger.go @@ -5,7 +5,7 @@ package logger import "github.com/sirupsen/logrus" -// This is the description for LogLevel enum +// Supported log levels. type LogLevel int const ( @@ -45,7 +45,7 @@ func Error(args ...interface{}) { log.Error(args...) } -// This is the description for SetLogLevel function +// Sets the logging level for the application. Defaults to `ERROR`. func SetLogLevel(level LogLevel) { switch level { case INFO: diff --git a/serviceaccount/util/token.go b/serviceaccount/util/token.go index 7a297f27..4a827387 100644 --- a/serviceaccount/util/token.go +++ b/serviceaccount/util/token.go @@ -22,7 +22,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) -// This is the description for ResponseToken struct +// Represents the structure for a response containing an access token and its type. type ResponseToken struct { AccessToken string `json:"accessToken"` TokenType string `json:tokenType` @@ -36,7 +36,7 @@ func GenerateToken(filePath string) (*ResponseToken, *errors.SkyflowError) { return GenerateBearerToken(filePath) } -// GenerateBearerToken - Generates a Service Account Token from the given Service Account Credential file with a default timeout of 60minutes. +// Generates a service account token from the given service account credential file with a default timeout of 60 minutes. func GenerateBearerToken(filePath string) (*ResponseToken, *errors.SkyflowError) { var key map[string]interface{} @@ -67,7 +67,7 @@ func GenerateBearerToken(filePath string) (*ResponseToken, *errors.SkyflowError) return token, nil } -// This is the description for GenerateBearerTokenFromCreds function +// Generates a service account token from the given service account credential JSON string. func GenerateBearerTokenFromCreds(credentials string) (*ResponseToken, *errors.SkyflowError) { credsMap := make(map[string]interface{}) @@ -85,7 +85,7 @@ func GenerateBearerTokenFromCreds(credentials string) (*ResponseToken, *errors.S return token, nil } -// getSATokenFromCredsFile gets bearer token from service account endpoint +// Gets bearer token from service account credentials file. func getSATokenFromCredsFile(key map[string]interface{}) (*ResponseToken, *errors.SkyflowError) { privateKey := key["privateKey"] @@ -236,7 +236,7 @@ func IsValid(tokenString string) bool { return !IsExpired(tokenString) } -// This is the description for IsExpired function +// Checks if the provided service account token has expired. func IsExpired(tokenString string) bool { if tokenString == "" { logger.Info(fmt.Sprintf(messages.EMPTY_BEARER_TOKEN, "ServiceAccountUtil")) diff --git a/skyflow/client/client.go b/skyflow/client/client.go index 45546045..c9b2c21e 100644 --- a/skyflow/client/client.go +++ b/skyflow/client/client.go @@ -14,7 +14,7 @@ import ( vaultapi "github.com/skyflowapi/skyflow-go/skyflow/vaultapi" ) -// This is the description for Client struct +// Represents a client instance to interact with Skyflow's vault API. type Client struct { configuration common.Configuration } @@ -23,7 +23,7 @@ var clientTag = "Client" var tokenUtils TokenUtils -// This is the description for Insert function +// Inserts data into the vault. func (client *Client) Insert(records map[string]interface{}, options ...common.InsertOptions) (common.InsertRecords, *errors.SkyflowError) { var tempOptions common.InsertOptions if len(options) == 0 { @@ -56,7 +56,7 @@ func (client *Client) Insert(records map[string]interface{}, options ...common.I return response, nil } -// This is the description for Detokenize function +// Returns values that correspond to the specified tokens. func (client *Client) Detokenize(records map[string]interface{}) (common.DetokenizeRecords, *errors.SkyflowError) { if client.configuration.TokenProvider == nil { @@ -84,7 +84,7 @@ func (client *Client) Detokenize(records map[string]interface{}) (common.Detoken return response, nil } -// This is the description for GetById function +// Reveals records by Skyflow ID. func (client *Client) GetById(records map[string]interface{}) (common.GetByIdRecords, *errors.SkyflowError) { if client.configuration.TokenProvider == nil { @@ -112,7 +112,7 @@ func (client *Client) GetById(records map[string]interface{}) (common.GetByIdRec return response, nil } -// This is the description for InvokeConnection function +// Invokes a connection to an external service using the provided connection configuration. func (client *Client) InvokeConnection(connectionConfig common.ConnectionConfig) (common.ResponseBody, *errors.SkyflowError) { if client.configuration.TokenProvider == nil { diff --git a/skyflow/client/init.go b/skyflow/client/init.go index 0d7a8de6..20c197dd 100644 --- a/skyflow/client/init.go +++ b/skyflow/client/init.go @@ -11,7 +11,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) -// This is the description for Init function +// Initializes the Skyflow client. func Init(configuration common.Configuration) Client { logger.Info(fmt.Sprintf(messages.INITIALIZING_SKYFLOW_CLIENT, clientTag)) return Client{configuration} diff --git a/skyflow/client/token_utils.go b/skyflow/client/token_utils.go index 3b31e9f4..bacbfc9e 100644 --- a/skyflow/client/token_utils.go +++ b/skyflow/client/token_utils.go @@ -14,7 +14,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) -// This is the description for TokenUtils struct +// Represents a utility structure for handling bearer token. type TokenUtils struct { Token string } diff --git a/skyflow/common/common.go b/skyflow/common/common.go index 79a6937d..5e3e4afd 100644 --- a/skyflow/common/common.go +++ b/skyflow/common/common.go @@ -6,10 +6,10 @@ package common // Internal type ResponseBody map[string]interface{} -// This is the description for TokenProvider type +// Helper function that retrieves a Skyflow bearer token from your backend. type TokenProvider func() (string, error) -// This is the description for RequestMethod type +// Supported request methods. type RequestMethod int const ( @@ -20,12 +20,12 @@ const ( DELETE ) -// This is the description for RequestMethod function +// Returns the string representation of the RequestMethod. func (requestMethod RequestMethod) String() string { return [...]string{"GET", "POST", "PUT", "PATCH", "DELETE"}[requestMethod] } -// This is the description for RedactionType enum +// Supported redaction types. type RedactionType string const ( @@ -35,7 +35,7 @@ const ( REDACTED RedactionType = "REDACTED" ) -// This is the description for ConnectionConfig struct +// Supported connection configurations. type ConnectionConfig struct { ConnectionURL string MethodName RequestMethod @@ -45,19 +45,19 @@ type ConnectionConfig struct { RequestHeader map[string]string } -// This is the description for InsertOptions struct +// Wrapper for parameters required by insert options. type InsertOptions struct { Tokens bool Upsert []UpsertOptions } -// This is the description for UpsertOptions struct +// Wrapper for parameters required by upsert options. type UpsertOptions struct { Table string Column string } -// This is the description for Configuration struct +// Contains the parameters required for Skyflow client initialisation. type Configuration struct { VaultID string VaultURL string @@ -140,7 +140,7 @@ type SkyflowIdRecord struct { Table string } -// This is the description for ContentType enum +// Supported content types. type ContentType string const ( diff --git a/skyflow/vaultapi/detokenize.go b/skyflow/vaultapi/detokenize.go index 29719add..c81f2228 100644 --- a/skyflow/vaultapi/detokenize.go +++ b/skyflow/vaultapi/detokenize.go @@ -16,7 +16,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) -// This is the description for DetokenizeApi struct +// Represents the configuration and data required for performing detokenization. type DetokenizeApi struct { Configuration common.Configuration Records map[string]interface{} @@ -25,7 +25,7 @@ type DetokenizeApi struct { var detokenizeTag = "Detokenize" -// This is the description for Get function +// Reveals detokenized data using the Detokenize API. func (detokenize *DetokenizeApi) Get() (map[string]interface{}, *errors.SkyflowError) { err := detokenize.doValidations() diff --git a/skyflow/vaultapi/get_by_id.go b/skyflow/vaultapi/get_by_id.go index d70abc5d..7a85baf5 100644 --- a/skyflow/vaultapi/get_by_id.go +++ b/skyflow/vaultapi/get_by_id.go @@ -17,7 +17,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) -// This is the description for GetByIdApi struct +// Retrieves records using SkyflowID's. type GetByIdApi struct { Configuration common.Configuration Records map[string]interface{} @@ -26,7 +26,7 @@ type GetByIdApi struct { var getByIdTag = "GetById" -// This is the description for Get function +// Retrieves records by ID from the Skyflow vault. func (g *GetByIdApi) Get() (map[string]interface{}, *errors.SkyflowError) { err := g.doValidations() diff --git a/skyflow/vaultapi/insert.go b/skyflow/vaultapi/insert.go index 26491e62..1c0f89a6 100644 --- a/skyflow/vaultapi/insert.go +++ b/skyflow/vaultapi/insert.go @@ -18,7 +18,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) -// This is the description for InsertApi struct +// Inserts data into the vault. type InsertApi struct { Configuration common.Configuration Records map[string]interface{} @@ -27,7 +27,7 @@ type InsertApi struct { var insertTag = "Insert" -// This is the description for HTTPClient interface +// An interface for performing HTTP requests. type HTTPClient interface { Do(req *http.Request) (*http.Response, error) } @@ -107,7 +107,7 @@ func (insertApi *InsertApi) doValidations() *errors.SkyflowError { return nil } -// This is the description for Post function +// Internal func (insertApi *InsertApi) Post(token string) (common.ResponseBody, *errors.SkyflowError) { err := insertApi.doValidations() if err != nil { diff --git a/skyflow/vaultapi/invoke_connection.go b/skyflow/vaultapi/invoke_connection.go index bbf75581..51846117 100644 --- a/skyflow/vaultapi/invoke_connection.go +++ b/skyflow/vaultapi/invoke_connection.go @@ -20,7 +20,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) -// This is the description for InvokeConnectionApi struct +// Wrapper for the parameters that are required to invoke connections. type InvokeConnectionApi struct { ConnectionConfig common.ConnectionConfig Token string @@ -42,7 +42,7 @@ func (InvokeConnectionApi *InvokeConnectionApi) doValidations() *errors.SkyflowE return nil } -// This is the description for Post function +// Internal func (InvokeConnectionApi *InvokeConnectionApi) Post() (map[string]interface{}, *errors.SkyflowError) { validationError := InvokeConnectionApi.doValidations() From 958fd8255c83fa5b6c69f8b737a4ea171b122a86 Mon Sep 17 00:00:00 2001 From: kamal-skyflow Date: Thu, 10 Aug 2023 17:08:21 +0530 Subject: [PATCH 3/3] DEX-228 chore: made suggested changes --- skyflow/client/client.go | 2 +- skyflow/client/token_utils.go | 2 +- skyflow/vaultapi/get_by_id.go | 2 +- skyflow/vaultapi/insert.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/skyflow/client/client.go b/skyflow/client/client.go index c9b2c21e..ea5c6e05 100644 --- a/skyflow/client/client.go +++ b/skyflow/client/client.go @@ -14,7 +14,7 @@ import ( vaultapi "github.com/skyflowapi/skyflow-go/skyflow/vaultapi" ) -// Represents a client instance to interact with Skyflow's vault API. +// Represents a client instance that interacts with Skyflow's APIs. type Client struct { configuration common.Configuration } diff --git a/skyflow/client/token_utils.go b/skyflow/client/token_utils.go index bacbfc9e..912a519a 100644 --- a/skyflow/client/token_utils.go +++ b/skyflow/client/token_utils.go @@ -14,7 +14,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) -// Represents a utility structure for handling bearer token. +// Represents a utility structure for handling bearer tokens. type TokenUtils struct { Token string } diff --git a/skyflow/vaultapi/get_by_id.go b/skyflow/vaultapi/get_by_id.go index 7a85baf5..7628b4d3 100644 --- a/skyflow/vaultapi/get_by_id.go +++ b/skyflow/vaultapi/get_by_id.go @@ -17,7 +17,7 @@ import ( "github.com/skyflowapi/skyflow-go/skyflow/common" ) -// Retrieves records using SkyflowID's. +// Retrieves records using SkyflowIDs. type GetByIdApi struct { Configuration common.Configuration Records map[string]interface{} diff --git a/skyflow/vaultapi/insert.go b/skyflow/vaultapi/insert.go index 1c0f89a6..7f936a2a 100644 --- a/skyflow/vaultapi/insert.go +++ b/skyflow/vaultapi/insert.go @@ -27,7 +27,7 @@ type InsertApi struct { var insertTag = "Insert" -// An interface for performing HTTP requests. +// Interface for performing HTTP requests. type HTTPClient interface { Do(req *http.Request) (*http.Response, error) }