GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( ade00f...013a6a )
by
unknown
01:57 queued 14s
created

mollie.*ClientsService.List   A

Complexity

Conditions 3

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 10
nop 2
dl 0
loc 15
rs 9.9
c 0
b 0
f 0
1
package mollie
2
3
import (
4
	"context"
5
	"encoding/json"
6
	"fmt"
7
	"time"
8
)
9
10
// LinkedClient describes a single client, linked to your partner account.
11
type LinkedClient struct {
12
	Resource              string            `json:"resource,omitempty"`
13
	ID                    string            `json:"id,omitempty"`
14
	OrganizationCreatedAt *time.Time        `json:"organizationCreatedAt,omitempty"`
15
	Links                 LinkedClientLinks `json:"_links,omitempty"`
16
}
17
18
// LinkedClientLinks contains URL objects relevant to the client.
19
type LinkedClientLinks struct {
20
	Self          *URL `json:"self,omitempty"`
21
	Organization  *URL `json:"organization,omitempty"`
22
	Onboarding    *URL `json:"onboarding,omitempty"`
23
	Documentation *URL `json:"documentation,omitempty"`
24
}
25
26
// GetLinkedClientOptions contains valid query parameters for the get clients endpoint.
27
type GetLinkedClientOptions struct {
28
	Embed []EmbedValue `url:"embed,omitempty"`
29
}
30
31
// LinkedClientList describes a list of partner clients.
32
type LinkedClientList struct {
33
	Count          int `json:"count,omitempty"`
34
	PartnerClients struct {
35
		Clients []*LinkedClient `json:"clients,omitempty"`
36
	} `json:"_embedded,omitempty"`
37
	Links PaginationLinks `json:"_links,omitempty"`
38
}
39
40
// ListLinkedClientsOptions contains valid query parameters for the list clients endpoint.
41
type ListLinkedClientsOptions struct {
42
	Limit int          `url:"limit,omitempty"`
43
	From  string       `url:"from,omitempty"`
44
	Embed []EmbedValue `url:"embed,omitempty"`
45
}
46
47
// ClientsService operates over the partners API.
48
type ClientsService service
49
50
// List retrieves all clients.
51
//
52
// See: https://docs.mollie.com/reference/v2/partners-api/list-clients
53
func (ps *ClientsService) List(ctx context.Context, opts *ListLinkedClientsOptions) (
54
	res *Response,
55
	pc *LinkedClientList,
56
	err error,
57
) {
58
	res, err = ps.client.get(ctx, "v2/clients", opts)
59
	if err != nil {
60
		return
61
	}
62
63
	if err = json.Unmarshal(res.content, &pc); err != nil {
64
		return
65
	}
66
67
	return
68
}
69
70
// Get retrieves a single client, linked to your partner account, by its ID.
71
//
72
// See: https://docs.mollie.com/reference/v2/partners-api/get-client
73
func (ps *ClientsService) Get(ctx context.Context, id string, opts *GetLinkedClientOptions) (
74
	res *Response,
75
	pc *LinkedClient,
76
	err error,
77
) {
78
	res, err = ps.client.get(ctx, fmt.Sprintf("v2/clients/%s", id), opts)
79
	if err != nil {
80
		return
81
	}
82
83
	if err = json.Unmarshal(res.content, &pc); err != nil {
84
		return
85
	}
86
87
	return
88
}
89