@@ -2,8 +2,6 @@ package codefresh
22
33import (
44 "fmt"
5-
6- "github.com/codefresh-io/go-sdk/pkg/codefresh/model"
75)
86
97type (
1412 GetEnvironments () ([]CFEnvironment , error )
1513 SendEvent (name string , props map [string ]string ) error
1614 SendApplicationResources (resources * ApplicationResources ) error
17- List (gitSources model.GitSource ) ([]model.GitSource , error )
1815 }
1916
2017 gitops struct {
@@ -229,59 +226,3 @@ func (a *gitops) SendApplicationResources(resources *ApplicationResources) error
229226 }
230227 return nil
231228}
232-
233- func (a * gitops ) List (gitSources model.GitSource ) ([]model.GitSource , error ) {
234- jsonData := map [string ]interface {}{
235- "query" : `
236- {
237- gitSources(pagination: {}, project: "") {
238- edges {
239- node {
240- metadata {
241- name
242- }
243- source {
244- path
245- }
246- }
247- }
248- }
249- }
250- ` ,
251- }
252-
253- response , err := a .codefresh .requestAPI (& requestOptions {
254- method : "POST" ,
255- path : "/argo/api/graphql" ,
256- body : jsonData ,
257- })
258- if err != nil {
259- fmt .Printf ("The HTTP request failed with error %s\n " , err )
260- return nil , err
261- }
262- defer response .Body .Close ()
263-
264- // data, err := ioutil.ReadAll(response.Body)
265- // if err != nil {
266- // fmt.Printf("failed to read from response body")
267- // return nil, err
268- // }
269-
270- // res := graphqlRuntimesResponse{}
271- // err = json.Unmarshal(data, &res)
272-
273- // if err != nil {
274- // return nil, err
275- // }
276-
277- // gitSources := make([]model.GitSource, len(res.Data.Runtimes.Edges))
278- // for i := range res.Data.Runtimes.Edges {
279- // gitSources[i] = *res.Data.Runtimes.Edges[i].Node
280- // }
281-
282- // if len(res.Errors) > 0 {
283- // return nil, graphqlErrorResponse{errors: res.Errors}
284- // }
285-
286- return nil , nil
287- }
0 commit comments