From 042a583d743a585007000c12fcfd53319f398dbf Mon Sep 17 00:00:00 2001 From: Misha Ketslah Date: Thu, 10 Jan 2019 14:10:04 +0200 Subject: [PATCH 1/4] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5a790a5..97aee2f 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,14 @@ import ( "fmt" "os" - "github.com/codefresh-io/go-sdk/pkg/util" + "github.com/codefresh-io/go-sdk/pkg/utils" "github.com/codefresh-io/go-sdk/pkg/codefresh" ) func main() { path := fmt.Sprintf("%s/.cfconfig", os.Getenv("HOME")) - authOptions := util.ReadAuthContext(path, "") + authOptions := utils.ReadAuthContext(path, "") cf := codefresh.New(authOptions) cf.GetPipelines() } -``` \ No newline at end of file +``` From f1eb8e50d1814a0977a75516403c441ab7cb6cc8 Mon Sep 17 00:00:00 2001 From: Misha Ketslah Date: Thu, 10 Jan 2019 14:12:15 +0200 Subject: [PATCH 2/4] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 97aee2f..92f8826 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,10 @@ import ( func main() { path := fmt.Sprintf("%s/.cfconfig", os.Getenv("HOME")) - authOptions := utils.ReadAuthContext(path, "") + authOptions, err := utils.ReadAuthContext(path, "") + if err != nil { + panic("Failed to read parse file") + } cf := codefresh.New(authOptions) cf.GetPipelines() } From a7119944d0a5d064ccb36ed38047cb767e934800 Mon Sep 17 00:00:00 2001 From: Michael K Date: Sun, 13 Jan 2019 16:51:09 +0200 Subject: [PATCH 3/4] Proper working example --- README.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 92f8826..aeab54e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ `go get -u github.com/codefresh-io/go-sdk` ```go - import ( "fmt" "os" @@ -20,11 +19,23 @@ import ( func main() { path := fmt.Sprintf("%s/.cfconfig", os.Getenv("HOME")) - authOptions, err := utils.ReadAuthContext(path, "") + options, err := utils.ReadAuthContext(path, "") + if err != nil { + fmt.Println("Failed to read codefresh config file") + panic(err) + } + clientOptions := codefresh.ClientOptions{Host: options.URL, + Auth: codefresh.AuthOptions{Token: options.Token}} + cf := codefresh.New(&clientOptions) + pipelines, err := cf.GetPipelines() if err != nil { - panic("Failed to read parse file") + fmt.Println("Failed to get Pipelines from Codefresh API") + panic(err) + } + for _, p := range pipelines { + fmt.Printf("Pipeline: %+v\n\n", p) } - cf := codefresh.New(authOptions) - cf.GetPipelines() } + + ``` From 14f75bdccbe3e1b3bd050abbd4de2cf6da52af3b Mon Sep 17 00:00:00 2001 From: Michael K Date: Sun, 13 Jan 2019 18:13:43 +0200 Subject: [PATCH 4/4] fix according to changes in 0.5.1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aeab54e..d2c3a05 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ func main() { clientOptions := codefresh.ClientOptions{Host: options.URL, Auth: codefresh.AuthOptions{Token: options.Token}} cf := codefresh.New(&clientOptions) - pipelines, err := cf.GetPipelines() + pipelines, err := cf.Pipelines().List() if err != nil { fmt.Println("Failed to get Pipelines from Codefresh API") panic(err)