alpha
Login
or
Join now
alice.pds.demo.boltless.dev
/
core
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
2
Pulls
1
Pipelines
knotclient: add typed request helper
author
oppiliappan
committer
Tangled
date
1 year ago
(May 22, 2025, 8:30 AM UTC)
commit
fab20bf9
fab20bf9f85e245cff58379d9b801629269777c0
parent
62713287
6271328740143067ec263af66be0493e7ca58693
+23
1 changed file
Expand all
Collapse all
Unified
Split
knotclient
unsigned.go
+23
knotclient/unsigned.go
View file
Reviewed
···
52
52
return http.NewRequest(method, reqUrl.String(), bytes.NewReader(body))
53
53
}
54
54
55
55
+
func do[T any](us *UnsignedClient, req *http.Request) (*T, error) {
56
56
+
resp, err := us.client.Do(req)
57
57
+
if err != nil {
58
58
+
return nil, err
59
59
+
}
60
60
+
defer resp.Body.Close()
61
61
+
62
62
+
body, err := io.ReadAll(resp.Body)
63
63
+
if err != nil {
64
64
+
log.Printf("Error reading response body: %v", err)
65
65
+
return nil, err
66
66
+
}
67
67
+
68
68
+
var result T
69
69
+
err = json.Unmarshal(body, &result)
70
70
+
if err != nil {
71
71
+
log.Printf("Error unmarshalling response body: %v", err)
72
72
+
return nil, err
73
73
+
}
74
74
+
75
75
+
return &result, nil
76
76
+
}
77
77
+
55
78
func (us *UnsignedClient) Index(ownerDid, repoName, ref string) (*http.Response, error) {
56
79
const (
57
80
Method = "GET"