forked from nscuro/dtrack-client
-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
license.go
41 lines (34 loc) · 1.01 KB
/
license.go
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
30
31
32
33
34
35
36
37
38
39
40
41
package dtrack
import (
"context"
"net/http"
"github.com/google/uuid"
)
type License struct {
UUID uuid.UUID `json:"uuid"`
Name string `json:"name"`
Text string `json:"text"`
Template string `json:"template"`
Header string `json:"header"`
Comment string `json:"comment"`
LicenseID string `json:"licenseId"`
OSIApproved bool `json:"isOsiApproved"`
FSFLibre bool `json:"isFsfLibre"`
DeprecatedLicenseID bool `json:"isDeprecatedLicenseId"`
SeeAlso []string `json:"seeAlso"`
}
type LicenseService struct {
client *Client
}
func (l LicenseService) GetAll(ctx context.Context, po PageOptions) (p Page[License], err error) {
req, err := l.client.newRequest(ctx, http.MethodGet, "/api/v1/license", withPageOptions(po))
if err != nil {
return
}
res, err := l.client.doRequest(req, &p.Items)
if err != nil {
return
}
p.TotalCount = res.TotalCount
return
}