forked from stripe/stripe-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
30 lines (24 loc) · 901 Bytes
/
client.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
// Package connectiontoken provides API functions related to terminal connection tokens
package connectiontoken
import (
"net/http"
stripe "github.com/stripe/stripe-go"
)
// Client is used to invoke /terminal/connection_tokens APIs.
type Client struct {
B stripe.Backend
Key string
}
// New creates a new terminal connection token.
func New(params *stripe.TerminalConnectionTokenParams) (*stripe.TerminalConnectionToken, error) {
return getC().New(params)
}
// New creates a new terminal connection token.
func (c Client) New(params *stripe.TerminalConnectionTokenParams) (*stripe.TerminalConnectionToken, error) {
connectiontoken := &stripe.TerminalConnectionToken{}
err := c.B.Call(http.MethodPost, "/v1/terminal/connection_tokens", c.Key, params, connectiontoken)
return connectiontoken, err
}
func getC() Client {
return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
}