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
Pull Request — master (#31)
by Victor Hugo
01:28
created

examples/auth/static_keys.go   A

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 16
dl 0
loc 47
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A main.main 0 34 4
1
package main
2
3
import (
4
	"fmt"
5
6
	"github.com/VictorAvelar/mollie-api-go/mollie"
7
)
8
9
const (
10
	APIKey string = "your api key here"
11
	OrgKey string = "your org key here"
12
)
13
14
func main() {
15
	/*
16
		To build our config, we need to tell our client if its
17
		purpose is to be used for testing or live requests, and
18
		then if using static tokens we will pass our key as
19
		second parameter, this will attach our token to every
20
		outgoing requests as a Bearer token.
21
	*/
22
	config := mollie.NewConfig(true, APIKey)
23
24
	/*
25
		Then we build our Mollie API client, in this case we will
26
		pass nil as we are not using a prebuilt http client and our
27
		recently created configuration.
28
29
		Now after checking for errors we are ready to make a test call
30
		to Mollie's API.
31
	*/
32
	m, err := mollie.NewClient(nil, config)
33
	if err != nil {
34
		return
35
	}
36
37
	output, err := m.Methods.List(nil)
38
	if err != nil {
39
		return
40
	}
41
42
	/*
43
		Now you should see a list of the enabled payment methods for your
44
		account.
45
	*/
46
	for _, o := range output.Embedded.Methods {
47
		fmt.Printf("Id: %s | Name: %s", o.ID, o.Description)
48
	}
49
}
50