@@ -5,17 +5,150 @@ https://developer.atlassian.com/server/confluence/confluence-rest-api-examples/
5
5
- Groovy version - https://github.com/AndriiMaliuta/confluence-rest-service-groovy
6
6
- Rust version - https://github.com/AndriiMaliuta/rust-atlas-rest
7
7
8
- ## Examples
8
+ # Native CLI app
9
9
10
10
### Confluence
11
11
``` bash
12
12
./atlas --type confluence --action getPage --id " 854950177"
13
13
./atlas --type confluence --action getPage --space " TEST" --title " Page A"
14
14
./atlas --type confluence --action getSpace --space " TEST"
15
-
16
15
```
17
16
18
17
### Jira
19
18
``` bash
20
- ./atlas --type confluence --action getIssue --key " AAA-3"
21
- ```
19
+ ./atlas --type jira --action getIssue --key " AAA-3"
20
+ ./atlas --type jira --action createIssue --summary " " --description " " --project " "
21
+ ```
22
+
23
+
24
+
25
+ ## Internal API examples
26
+ get services
27
+ ```
28
+ grpcurl -plaintext localhost:9093 list
29
+ ```
30
+
31
+ ### Pages
32
+ getPage
33
+ ``` curl
34
+ ./grpcurl -d '{"id": "123123"}' -plaintext localhost:50051 andmal.PageService.GetPage
35
+ ```
36
+
37
+ Create 20 pages
38
+ ``` go
39
+ for i := 2 ; i <= 20 ; i++ {
40
+ space := spaceServ.GetSpace (cloudDcUrl, lToken, " TEST" )
41
+ pageServ.CreateContent (cloudDcUrl, lToken, " page" , space.Key , space.Homepage .Id ,
42
+ fmt.Sprintf (" GO page %d " , i),
43
+ ranServ.RandomString (100 ))
44
+ }
45
+ ```
46
+
47
+ ``` go
48
+ // === ASYNC == several
49
+ var waitG sync.WaitGroup
50
+ for i := 11 ; i <= 30 ; i++ {
51
+ waitG.Add (1 )
52
+ bod := ranServ.RandomString (100 )
53
+ go func (count int ) {
54
+ space := spaceServ.GetSpace (cloudDcUrl, dcToken, " DEV15" )
55
+ pageServ.CreateContent (cloudDcUrl, dcToken, " page" , space.Key , space.Homepage .Id ,
56
+ fmt.Sprintf (" GO page %d " , count), bod)
57
+ }(i)
58
+ }
59
+ waitG.Wait ()
60
+ ```
61
+
62
+ ``` go
63
+ // ========== Get Page
64
+ fmt.Println (pageServ.GetPage (cloudDcUrl, lToken, " 98383" ))
65
+
66
+ ========== Create Page
67
+ space := spaceServ.GetSpace (locUrl, lToken, " BBB" )
68
+ pageServ.CreateContent (locUrl, lToken, " page" , space.Key , space.Homepage .Id , " GO page 1" ,
69
+ ranServ.RandomString (100 ))
70
+ ```
71
+
72
+ Create space(s)
73
+ ``` go
74
+ fmt.Println (spaceServ.CreateSpace (locUrl, lToken, " DEV2" , " DEV2" ))
75
+
76
+ for i := 3 ; i < 20 ; i++ {
77
+ fmt.Println (spaceServ.CreateSpace (locUrl, lToken, fmt.Sprintf (" DEV%d " , i), fmt.Sprintf (" DEV%d " , i)))
78
+ }
79
+
80
+ // Operations took '124.458869' secs
81
+ for a := 3 ; a <= 20 ; a++ {
82
+ // wg.Add(1)
83
+ go func () {
84
+ key := fmt.Sprintf (" DEV%d " , a)
85
+ sp := spaceServ.GetSpace (locUrl, lToken, key)
86
+ for i := 40 ; i < 45 ; i++ {
87
+ bod := ranServ.RandomString (15 )
88
+ pageServ.CreateContentAsync (locUrl, lToken, " page" ,
89
+ sp.Key ,
90
+ sp.Homepage .Id ,
91
+ fmt.Sprintf (" RST - %d " , i), bod)
92
+ }
93
+ }()
94
+
95
+ fmt.Println (spaceServ.CreateSpace (locUrl, lToken, fmt.Sprintf (" DEV%d " , a), fmt.Sprintf (" DEV%d " , a)))
96
+ }
97
+ ```
98
+
99
+ COMPLEX HIERARCHY
100
+ ``` go
101
+ var count int
102
+ for i := 40 ; i <= 50 ; i++ {
103
+ space := spaceServ.GetSpace (locUrl, lToken, fmt.Sprintf (" test%d " , i))
104
+ homePage := space.Homepage
105
+ for i := 1 ; i <= 100 ; i++ {
106
+ bod := ranServ.RandomString (100 )
107
+ pageServ.CreateContent (locUrl, lToken, " page" , space.Key , homePage.Id , fmt.Sprintf (" %s - %d " , homePage.Title , i), bod)
108
+ }
109
+ count += i
110
+ }
111
+
112
+ log.Printf (" %d pages created" , count)
113
+
114
+ // === GET space
115
+ // fmt.Println(spaceServ.GetSpace(locUrl, lToken, "DEV"))
116
+
117
+ // == Edit Page
118
+ fmt.Println (pageServ.UpdatePage (locUrl, lToken, " 2719745" , " lorem" , " lorem lorem lorem" ))
119
+
120
+ // == COPY page
121
+ pageServ.CopyPage (locUrl, lToken, " 65603" , " 2326554" , true , true , false )
122
+
123
+ // == COPY Hierarchy
124
+ log.Println (pageServ.CopyPageDescs (bhtUrl, bhToken, " " , " " , " " , true , true , false ))
125
+
126
+ // ==== ADD attach
127
+ for _ , att := range pageServ.GetPageAttaches (locUrl, lToken, " 2719753" ).Results {
128
+ fmt.Println (att.Id )
129
+ pageServ.CopyAttach (locUrl, lToken, " 2981909" , att.Id )
130
+ }
131
+
132
+ // ==== Get attaches
133
+ fmt.Println (pageServ.GetPageAttaches (locUrl, 1474565 ))
134
+
135
+ // === GET attach
136
+ fmt.Println (pageServ.GetAttach (locUrl, 1671169 ))
137
+
138
+ // === Download attach
139
+ pageServ.DownloadAttach (locUrl, 1671171 )
140
+
141
+
142
+
143
+ // === Comments
144
+ pageServ.AddComment (locUrl, lToken, " 2555915" , " 2555911" )
145
+ ```
146
+
147
+ ### Labels
148
+ ``` go
149
+ fmt.Println (labServ.GetPageLabels (locUrl, lToken, " 2719745" ))
150
+
151
+ // ===== COPY labels
152
+ labels := []string {" aaa" , " bbb" }
153
+ labServ.AddLabels (locUrl, lToken, " 2555907" , labels)
154
+ ```
0 commit comments