github.com/stripe/stripe-go/v76@v76.25.0/testhelpers/issuing/authorization/client.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  // Package authorization provides the /issuing/authorizations APIs
     8  package authorization
     9  
    10  import (
    11  	"net/http"
    12  
    13  	stripe "github.com/stripe/stripe-go/v76"
    14  )
    15  
    16  // Client is used to invoke /issuing/authorizations APIs.
    17  type Client struct {
    18  	B   stripe.Backend
    19  	Key string
    20  }
    21  
    22  // New creates a new issuing authorization.
    23  func New(params *stripe.TestHelpersIssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {
    24  	return getC().New(params)
    25  }
    26  
    27  // New creates a new issuing authorization.
    28  func (c Client) New(params *stripe.TestHelpersIssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {
    29  	authorization := &stripe.IssuingAuthorization{}
    30  	err := c.B.Call(
    31  		http.MethodPost,
    32  		"/v1/test_helpers/issuing/authorizations",
    33  		c.Key,
    34  		params,
    35  		authorization,
    36  	)
    37  	return authorization, err
    38  }
    39  
    40  // Capture is the method for the `POST /v1/test_helpers/issuing/authorizations/{authorization}/capture` API.
    41  func Capture(id string, params *stripe.TestHelpersIssuingAuthorizationCaptureParams) (*stripe.IssuingAuthorization, error) {
    42  	return getC().Capture(id, params)
    43  }
    44  
    45  // Capture is the method for the `POST /v1/test_helpers/issuing/authorizations/{authorization}/capture` API.
    46  func (c Client) Capture(id string, params *stripe.TestHelpersIssuingAuthorizationCaptureParams) (*stripe.IssuingAuthorization, error) {
    47  	path := stripe.FormatURLPath(
    48  		"/v1/test_helpers/issuing/authorizations/%s/capture",
    49  		id,
    50  	)
    51  	authorization := &stripe.IssuingAuthorization{}
    52  	err := c.B.Call(http.MethodPost, path, c.Key, params, authorization)
    53  	return authorization, err
    54  }
    55  
    56  // Expire is the method for the `POST /v1/test_helpers/issuing/authorizations/{authorization}/expire` API.
    57  func Expire(id string, params *stripe.TestHelpersIssuingAuthorizationExpireParams) (*stripe.IssuingAuthorization, error) {
    58  	return getC().Expire(id, params)
    59  }
    60  
    61  // Expire is the method for the `POST /v1/test_helpers/issuing/authorizations/{authorization}/expire` API.
    62  func (c Client) Expire(id string, params *stripe.TestHelpersIssuingAuthorizationExpireParams) (*stripe.IssuingAuthorization, error) {
    63  	path := stripe.FormatURLPath(
    64  		"/v1/test_helpers/issuing/authorizations/%s/expire",
    65  		id,
    66  	)
    67  	authorization := &stripe.IssuingAuthorization{}
    68  	err := c.B.Call(http.MethodPost, path, c.Key, params, authorization)
    69  	return authorization, err
    70  }
    71  
    72  // Increment is the method for the `POST /v1/test_helpers/issuing/authorizations/{authorization}/increment` API.
    73  func Increment(id string, params *stripe.TestHelpersIssuingAuthorizationIncrementParams) (*stripe.IssuingAuthorization, error) {
    74  	return getC().Increment(id, params)
    75  }
    76  
    77  // Increment is the method for the `POST /v1/test_helpers/issuing/authorizations/{authorization}/increment` API.
    78  func (c Client) Increment(id string, params *stripe.TestHelpersIssuingAuthorizationIncrementParams) (*stripe.IssuingAuthorization, error) {
    79  	path := stripe.FormatURLPath(
    80  		"/v1/test_helpers/issuing/authorizations/%s/increment",
    81  		id,
    82  	)
    83  	authorization := &stripe.IssuingAuthorization{}
    84  	err := c.B.Call(http.MethodPost, path, c.Key, params, authorization)
    85  	return authorization, err
    86  }
    87  
    88  // Reverse is the method for the `POST /v1/test_helpers/issuing/authorizations/{authorization}/reverse` API.
    89  func Reverse(id string, params *stripe.TestHelpersIssuingAuthorizationReverseParams) (*stripe.IssuingAuthorization, error) {
    90  	return getC().Reverse(id, params)
    91  }
    92  
    93  // Reverse is the method for the `POST /v1/test_helpers/issuing/authorizations/{authorization}/reverse` API.
    94  func (c Client) Reverse(id string, params *stripe.TestHelpersIssuingAuthorizationReverseParams) (*stripe.IssuingAuthorization, error) {
    95  	path := stripe.FormatURLPath(
    96  		"/v1/test_helpers/issuing/authorizations/%s/reverse",
    97  		id,
    98  	)
    99  	authorization := &stripe.IssuingAuthorization{}
   100  	err := c.B.Call(http.MethodPost, path, c.Key, params, authorization)
   101  	return authorization, err
   102  }
   103  
   104  func getC() Client {
   105  	return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
   106  }