github.com/stripe/stripe-go/v76@v76.25.0/mandate/client.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  // Package mandate provides the /mandates APIs
     8  package mandate
     9  
    10  import (
    11  	"net/http"
    12  
    13  	stripe "github.com/stripe/stripe-go/v76"
    14  )
    15  
    16  // Client is used to invoke /mandates APIs.
    17  type Client struct {
    18  	B   stripe.Backend
    19  	Key string
    20  }
    21  
    22  // Get returns the details of a mandate.
    23  func Get(id string, params *stripe.MandateParams) (*stripe.Mandate, error) {
    24  	return getC().Get(id, params)
    25  }
    26  
    27  // Get returns the details of a mandate.
    28  func (c Client) Get(id string, params *stripe.MandateParams) (*stripe.Mandate, error) {
    29  	path := stripe.FormatURLPath("/v1/mandates/%s", id)
    30  	mandate := &stripe.Mandate{}
    31  	err := c.B.Call(http.MethodGet, path, c.Key, params, mandate)
    32  	return mandate, err
    33  }
    34  
    35  func getC() Client {
    36  	return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
    37  }