github.com/stripe/stripe-go/v76@v76.25.0/testhelpers/treasury/receivedcredit/client.go (about) 1 // 2 // 3 // File generated from our OpenAPI spec 4 // 5 // 6 7 // Package receivedcredit provides the /treasury/received_credits APIs 8 package receivedcredit 9 10 import ( 11 "net/http" 12 13 stripe "github.com/stripe/stripe-go/v76" 14 ) 15 16 // Client is used to invoke /treasury/received_credits APIs. 17 type Client struct { 18 B stripe.Backend 19 Key string 20 } 21 22 // New creates a new treasury received credit. 23 func New(params *stripe.TestHelpersTreasuryReceivedCreditParams) (*stripe.TreasuryReceivedCredit, error) { 24 return getC().New(params) 25 } 26 27 // New creates a new treasury received credit. 28 func (c Client) New(params *stripe.TestHelpersTreasuryReceivedCreditParams) (*stripe.TreasuryReceivedCredit, error) { 29 receivedcredit := &stripe.TreasuryReceivedCredit{} 30 err := c.B.Call( 31 http.MethodPost, 32 "/v1/test_helpers/treasury/received_credits", 33 c.Key, 34 params, 35 receivedcredit, 36 ) 37 return receivedcredit, err 38 } 39 40 func getC() Client { 41 return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key} 42 }