File tree Expand file tree Collapse file tree 3 files changed +54
-1
lines changed Expand file tree Collapse file tree 3 files changed +54
-1
lines changed Original file line number Diff line number Diff line change 1
- 0.19.2
1
+ 0.19.3
Original file line number Diff line number Diff line change 19
19
Tokens () ITokenAPI
20
20
RuntimeEnvironments () IRuntimeEnvironmentAPI
21
21
Workflows () IWorkflowAPI
22
+ Progresses () IProgressAPI
22
23
}
23
24
)
24
25
@@ -47,6 +48,10 @@ func (c *codefresh) Workflows() IWorkflowAPI {
47
48
return newWorkflowAPI (c )
48
49
}
49
50
51
+ func (c * codefresh ) Progresses () IProgressAPI {
52
+ return newProgressAPI (c )
53
+ }
54
+
50
55
func (c * codefresh ) requestAPI (opt * requestOptions ) (* http.Response , error ) {
51
56
var body []byte
52
57
finalURL := fmt .Sprintf ("%s%s" , c .host , opt .path )
Original file line number Diff line number Diff line change
1
+ package codefresh
2
+
3
+ import (
4
+ "fmt"
5
+ )
6
+
7
+ type (
8
+ IProgressAPI interface {
9
+ Get (string ) (* Progress , error )
10
+ }
11
+
12
+ progress struct {
13
+ codefresh Codefresh
14
+ }
15
+
16
+ Progress struct {
17
+ ID string `json:"id"`
18
+ Status string `json:"status"`
19
+ Location Location `json:"location"`
20
+ }
21
+
22
+ Location struct {
23
+ Type string `json:"type"`
24
+ URL string `json:"url"`
25
+ }
26
+ )
27
+
28
+ func newProgressAPI (codefresh Codefresh ) IProgressAPI {
29
+ return & progress {codefresh }
30
+ }
31
+
32
+ func (p * progress ) Get (id string ) (* Progress , error ) {
33
+ result := & Progress {}
34
+ resp , err := p .codefresh .requestAPI (& requestOptions {
35
+ path : fmt .Sprintf ("/api/progress/%s" , id ),
36
+ method : "GET" ,
37
+ })
38
+ // failed in api call
39
+ if err != nil {
40
+ return nil , err
41
+ }
42
+ err = p .codefresh .decodeResponseInto (resp , result )
43
+ // failed to decode
44
+ if err != nil {
45
+ return nil , err
46
+ }
47
+ return result , nil
48
+ }
You can’t perform that action at this time.
0 commit comments