blob: 3d0da86d9f14cdf190a1726cfb7fad3054ac6b95 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package main
import (
"context"
"fmt"
"io"
"net/http"
"github.com/xlgmokha/x/pkg/env"
"github.com/xlgmokha/x/pkg/x"
"gitlab.com/mokhax/stanuki/pkg/gitlab"
)
func main() {
token := env.Fetch("GITLAB_TOKEN", "")
url := "https://gitlab.com/api/v4/groups/9970/issues"
client := http.Client{}
request := x.Must(http.NewRequestWithContext(context.TODO(), "GET", url, nil))
request.Header.Add("Authorization", fmt.Sprintf("Bearer %v", token))
response := x.Must(client.Do(request))
if env.Fetch("DUMP", "") != "" {
fmt.Println(string(x.Must(io.ReadAll(response.Body))))
} else {
issues := x.Must(gitlab.FromIssues(response.Body))
for _, issue := range issues {
fmt.Printf("%v: %v\n", issue.ID, issue.Title)
}
}
}
|