Skip to content

Commit 1684385

Browse files
committed
feat!: rename params types from <Action><Resource>Params to <Resource><Action>Params
reason: better sorting in go documentation
1 parent 865bfe6 commit 1684385

10 files changed

Lines changed: 49 additions & 49 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func main() {
4747
payrexClient := payrex.NewClient(os.Getenv("PAYREX_API_KEY"))
4848

4949
// Create a PaymentIntent
50-
paymentIntent, err := payrexClient.PaymentIntents.Create(&payrex.CreatePaymentIntentParams{
50+
paymentIntent, err := payrexClient.PaymentIntents.Create(&payrex.PaymentIntentCreateParams{
5151
Amount: 100_00, // represents ₱100.00
5252
Currency: payrex.CurrencyPHP,
5353
Description: payrex.NotNil("Dino Treat"),

billing_statement_line_item.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func (s *ServiceBillingStatementLineItems) setup() {
3030
// Endpoint: POST /billing_statement_line_items
3131
//
3232
// API reference: https://docs.payrexhq.com/docs/api/billing_statement_line_items/create
33-
func (s *ServiceBillingStatementLineItems) Create(params *CreateBillingStatementLineItemParams) (*BillingStatementLineItem, error) {
33+
func (s *ServiceBillingStatementLineItems) Create(params *BillingStatementLineItemCreateParams) (*BillingStatementLineItem, error) {
3434
return s.create(params)
3535
}
3636

@@ -39,7 +39,7 @@ func (s *ServiceBillingStatementLineItems) Create(params *CreateBillingStatement
3939
// Endpoint: PUT /billing_statement_line_items/:id
4040
//
4141
// API reference: https://docs.payrexhq.com/docs/api/billing_statement_line_items/update
42-
func (s *ServiceBillingStatementLineItems) Update(id string, params *UpdateBillingStatementLineItemParams) (*BillingStatementLineItem, error) {
42+
func (s *ServiceBillingStatementLineItems) Update(id string, params *BillingStatementLineItemUpdateParams) (*BillingStatementLineItem, error) {
4343
return s.update(id, params)
4444
}
4545

@@ -52,20 +52,20 @@ func (s *ServiceBillingStatementLineItems) Delete(id string) (*DeletedResource,
5252
return s.delete(id)
5353
}
5454

55-
// CreateBillingStatementLineItemParams represents the available [ServiceBillingStatementLineItems.Create] parameters.
55+
// BillingStatementLineItemCreateParams represents the available [ServiceBillingStatementLineItems.Create] parameters.
5656
//
5757
// API reference: https://docs.payrexhq.com/docs/api/billing_statement_line_items/create
58-
type CreateBillingStatementLineItemParams struct {
58+
type BillingStatementLineItemCreateParams struct {
5959
BillingStatementID string `form:"billing_statement_id"`
6060
Description string `form:"description"`
6161
UnitPrice int `form:"unit_price"`
6262
Quantity int `form:"quantity"`
6363
}
6464

65-
// UpdateBillingStatementLineItemParams represents the available [ServiceBillingStatementLineItems.Update] parameters.
65+
// BillingStatementLineItemUpdateParams represents the available [ServiceBillingStatementLineItems.Update] parameters.
6666
//
6767
// API reference: https://docs.payrexhq.com/docs/api/billing_statement_line_items/update
68-
type UpdateBillingStatementLineItemParams struct {
68+
type BillingStatementLineItemUpdateParams struct {
6969
Description *string `form:"description"`
7070
UnitPrice *int `form:"unit_price"`
7171
Quantity *int `form:"quantity"`

checkout_session.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (s *ServiceCheckoutSessions) setup() {
5555
// Endpoint: POST /checkout_sessions
5656
//
5757
// API reference: https://docs.payrexhq.com/docs/api/checkout_sessions/create
58-
func (s *ServiceCheckoutSessions) Create(params *CreateCheckoutSessionParams) (*CheckoutSession, error) {
58+
func (s *ServiceCheckoutSessions) Create(params *CheckoutSessionCreateParams) (*CheckoutSession, error) {
5959
return s.create(params)
6060
}
6161

@@ -88,10 +88,10 @@ func (s *ServiceCheckoutSessions) Expire(id string) (*CheckoutSession, error) {
8888
return s.postID(id, "expire", nil)
8989
}
9090

91-
// CreateCheckoutSessionParams represents the available [ServiceCheckoutSessions.Create] parameters.
91+
// CheckoutSessionCreateParams represents the available [ServiceCheckoutSessions.Create] parameters.
9292
//
9393
// API reference: https://docs.payrexhq.com/docs/api/checkout_sessions/create
94-
type CreateCheckoutSessionParams struct {
94+
type CheckoutSessionCreateParams struct {
9595
CustomerReferenceID *string `form:"customer_reference_id"`
9696
Currency Currency `form:"currency"`
9797
LineItems []CheckoutSessionLineItemParams `form:"line_items"`

customer.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (s *ServiceCustomers) setup() {
3232
// Endpoint: POST /customers
3333
//
3434
// API reference: https://docs.payrexhq.com/docs/api/customers/create
35-
func (s *ServiceCustomers) Create(params *CreateCustomerParams) (*Customer, error) {
35+
func (s *ServiceCustomers) Create(params *CustomerCreateParams) (*Customer, error) {
3636
return s.create(params)
3737
}
3838

@@ -50,7 +50,7 @@ func (s *ServiceCustomers) Retrieve(id string) (*Customer, error) {
5050
// Endpoint: GET /customers
5151
//
5252
// API reference: https://docs.payrexhq.com/docs/api/customers/list
53-
func (s *ServiceCustomers) List(params *ListCustomersParams) (*Listing[Customer], error) {
53+
func (s *ServiceCustomers) List(params *CustomerListParams) (*Listing[Customer], error) {
5454
return s.list(params)
5555
}
5656

@@ -59,7 +59,7 @@ func (s *ServiceCustomers) List(params *ListCustomersParams) (*Listing[Customer]
5959
// Endpoint: PUT /customers/:id
6060
//
6161
// API reference: https://docs.payrexhq.com/docs/api/customers/update
62-
func (s *ServiceCustomers) Update(id string, params *UpdateCustomerParams) (*Customer, error) {
62+
func (s *ServiceCustomers) Update(id string, params *CustomerUpdateParams) (*Customer, error) {
6363
return s.update(id, params)
6464
}
6565

@@ -74,10 +74,10 @@ func (s *ServiceCustomers) Delete(id string) (*DeletedResource, error) {
7474
return s.delete(id)
7575
}
7676

77-
// CreateCustomerParams represents the available [ServiceCustomers.Create] parameters.
77+
// CustomerCreateParams represents the available [ServiceCustomers.Create] parameters.
7878
//
7979
// API reference: https://docs.payrexhq.com/docs/api/customers/create
80-
type CreateCustomerParams struct {
80+
type CustomerCreateParams struct {
8181
Currency Currency `form:"currency"`
8282
Name string `form:"name"`
8383
Email string `form:"email"`
@@ -86,10 +86,10 @@ type CreateCustomerParams struct {
8686
Metadata *map[string]string `form:"metadata"`
8787
}
8888

89-
// ListCustomersParams represents the available [ServiceCustomers.List] parameters.
89+
// CustomerListParams represents the available [ServiceCustomers.List] parameters.
9090
//
9191
// API reference: https://docs.payrexhq.com/docs/api/customers/list
92-
type ListCustomersParams struct {
92+
type CustomerListParams struct {
9393
Limit *int `form:"int"`
9494
Before *string `form:"before"`
9595
After *string `form:"after"`
@@ -98,10 +98,10 @@ type ListCustomersParams struct {
9898
Metadata *map[string]string `form:"metadata"`
9999
}
100100

101-
// UpdateCustomerParams represents the available [ServiceCustomers.Update] parameters.
101+
// CustomerUpdateParams represents the available [ServiceCustomers.Update] parameters.
102102
//
103103
// API reference: https://docs.payrexhq.com/docs/api/customers/update
104-
type UpdateCustomerParams struct {
104+
type CustomerUpdateParams struct {
105105
Currency *Currency `form:"currency"`
106106
Name *string `form:"name"`
107107
Email *string `form:"email"`

customer_session.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (s *ServiceCustomerSessions) setup() {
3939
// Endpoint: POST /customer_sessions
4040
//
4141
// API reference: https://docs.payrexhq.com/docs/api/customer_sessions/create
42-
func (s *ServiceCustomerSessions) Create(params *CreateCustomerSessionParams) (*CustomerSession, error) {
42+
func (s *ServiceCustomerSessions) Create(params *CustomerSessionCreateParams) (*CustomerSession, error) {
4343
return s.create(params)
4444
}
4545

@@ -52,9 +52,9 @@ func (s *ServiceCustomerSessions) Retrieve(id string) (*CustomerSession, error)
5252
return s.retrieve(id)
5353
}
5454

55-
// CreateCustomerSessionParams represents the available [ServiceCustomerSessions.Create] parameters.
55+
// CustomerSessionCreateParams represents the available [ServiceCustomerSessions.Create] parameters.
5656
//
5757
// API reference: https://docs.payrexhq.com/docs/api/customer_sessions/create
58-
type CreateCustomerSessionParams struct {
58+
type CustomerSessionCreateParams struct {
5959
CustomerID string `form:"customer_id"`
6060
}

payment.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ func (s *ServicePayments) Retrieve(id string) (*Payment, error) {
7474
// Endpoint: PUT /payments/:id
7575
//
7676
// API reference: https://docs.payrexhq.com/docs/api/payments/update
77-
func (s *ServicePayments) Update(id string, params *UpdatePaymentParams) (*Payment, error) {
77+
func (s *ServicePayments) Update(id string, params *PaymentUpdateParams) (*Payment, error) {
7878
return s.update(id, params)
7979
}
8080

81-
// UpdatePaymentParams represents the available [ServicePayments.Update] parameters.
81+
// PaymentUpdateParams represents the available [ServicePayments.Update] parameters.
8282
//
8383
// API reference: https://docs.payrexhq.com/docs/api/payments/update
84-
type UpdatePaymentParams struct {
84+
type PaymentUpdateParams struct {
8585
Description *string `form:"description"`
8686
Metadata *map[string]string `form:"metadata"`
8787
}

payment_intent.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (s *ServicePaymentIntents) Cancel(id string) (*PaymentIntent, error) {
6868
// Endpoint: POST /payment_intents/:id/capture
6969
//
7070
// API reference: https://docs.payrexhq.com/docs/api/payment_intents/capture
71-
func (s *ServicePaymentIntents) Capture(id string, params *CapturePaymentIntentParams) (*PaymentIntent, error) {
71+
func (s *ServicePaymentIntents) Capture(id string, params *PaymentIntentCaptureParams) (*PaymentIntent, error) {
7272
if params == nil {
7373
return nil, ErrNilParams
7474
}
@@ -81,7 +81,7 @@ func (s *ServicePaymentIntents) Capture(id string, params *CapturePaymentIntentP
8181
// Endpoint: POST /payment_intents
8282
//
8383
// API reference: https://docs.payrexhq.com/docs/api/payment_intents/create
84-
func (s *ServicePaymentIntents) Create(params *CreatePaymentIntentParams) (*PaymentIntent, error) {
84+
func (s *ServicePaymentIntents) Create(params *PaymentIntentCreateParams) (*PaymentIntent, error) {
8585
return s.create(params)
8686
}
8787

@@ -94,17 +94,17 @@ func (s *ServicePaymentIntents) Retrieve(id string) (*PaymentIntent, error) {
9494
return s.retrieve(id)
9595
}
9696

97-
// CapturePaymentIntentParams represents the available [ServicePaymentIntents.Capture] parameters.
97+
// PaymentIntentCaptureParams represents the available [ServicePaymentIntents.Capture] parameters.
9898
//
9999
// API reference: https://docs.payrexhq.com/docs/api/payment_intents/capture
100-
type CapturePaymentIntentParams struct {
100+
type PaymentIntentCaptureParams struct {
101101
Amount int `form:"amount"`
102102
}
103103

104-
// CreatePaymentIntentParams represents the available [ServicePaymentIntents.Create] parameters.
104+
// PaymentIntentCreateParams represents the available [ServicePaymentIntents.Create] parameters.
105105
//
106106
// API reference: https://docs.payrexhq.com/docs/api/payment_intents/create
107-
type CreatePaymentIntentParams struct {
107+
type PaymentIntentCreateParams struct {
108108
Amount int `form:"amount"`
109109
PaymentMethods []PaymentMethod `form:"payment_methods"`
110110
Currency Currency `form:"currency"`

payout.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ func (s *ServicePayouts) setup() {
7373
// Endpoint: GET /payouts/:id/transactions
7474
//
7575
// API reference: https://docs.payrexhq.com/docs/api/payout_transactions/list
76-
func (s *ServicePayouts) ListTransactions(id string, params *ListPayoutTransactionsParams) (*Listing[PayoutTransaction], error) {
76+
func (s *ServicePayouts) ListTransactions(id string, params *PayoutTransactionListParams) (*Listing[PayoutTransaction], error) {
7777
return request[Listing[PayoutTransaction]](s.client,
7878
http.MethodGet,
7979
s.path.make(id, "transactions"),
8080
params,
8181
)
8282
}
8383

84-
// ListPayoutTransactionsParams represents the available [ServicePayouts.ListTransactions] parameters.
84+
// PayoutTransactionListParams represents the available [ServicePayouts.ListTransactions] parameters.
8585
//
8686
// API reference: https://docs.payrexhq.com/docs/api/payout_transactions/list
87-
type ListPayoutTransactionsParams struct {
87+
type PayoutTransactionListParams struct {
8888
Limit *int `form:"limit"`
8989
Before *string `form:"before"`
9090
After *string `form:"after"`

refund.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (s *ServiceRefunds) setup() {
5353
// Endpoint: POST /refunds
5454
//
5555
// API reference: https://docs.payrexhq.com/docs/api/refunds/create
56-
func (s *ServiceRefunds) Create(params *CreateRefundParams) (*Refund, error) {
56+
func (s *ServiceRefunds) Create(params *RefundCreateParams) (*Refund, error) {
5757
return s.create(params)
5858
}
5959

@@ -62,14 +62,14 @@ func (s *ServiceRefunds) Create(params *CreateRefundParams) (*Refund, error) {
6262
// Endpoint: PUT /refunds/:id
6363
//
6464
// API reference: https://docs.payrexhq.com/docs/api/refunds/update
65-
func (s *ServiceRefunds) Update(id string, params *UpdateRefundParams) (*Refund, error) {
65+
func (s *ServiceRefunds) Update(id string, params *RefundUpdateParams) (*Refund, error) {
6666
return s.update(id, params)
6767
}
6868

69-
// CreateRefundParams represents the available [ServiceRefunds.Create] parameters.
69+
// RefundCreateParams represents the available [ServiceRefunds.Create] parameters.
7070
//
7171
// API reference: https://docs.payrexhq.com/docs/api/refunds/create
72-
type CreateRefundParams struct {
72+
type RefundCreateParams struct {
7373
Amount int `form:"amount"`
7474
Currency Currency `form:"currency"`
7575
Description *string `form:"description"`
@@ -79,9 +79,9 @@ type CreateRefundParams struct {
7979
Metadata *map[string]string `form:"metadata"`
8080
}
8181

82-
// UpdateRefundParams represents the available [ServiceRefunds.Update] parameters.
82+
// RefundUpdateParams represents the available [ServiceRefunds.Update] parameters.
8383
//
8484
// API reference: https://docs.payrexhq.com/docs/api/refunds/update
85-
type UpdateRefundParams struct {
85+
type RefundUpdateParams struct {
8686
Metadata *map[string]string `form:"metadata"`
8787
}

webhook.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (s *ServiceWebhooks) setup() {
3535
// Endpoint: POST /webhooks
3636
//
3737
// API reference: https://docs.payrexhq.com/docs/api/webhooks/create
38-
func (s *ServiceWebhooks) Create(params *CreateWebhookParams) (*Webhook, error) {
38+
func (s *ServiceWebhooks) Create(params *WebhookCreateParams) (*Webhook, error) {
3939
return s.create(params)
4040
}
4141

@@ -53,7 +53,7 @@ func (s *ServiceWebhooks) Retrieve(id string) (*Webhook, error) {
5353
// Endpoint: GET /webhooks
5454
//
5555
// API reference: https://docs.payrexhq.com/docs/api/webhooks/list
56-
func (s *ServiceWebhooks) List(params *ListWebhooksParams) (*Listing[Webhook], error) {
56+
func (s *ServiceWebhooks) List(params *WebhookListParams) (*Listing[Webhook], error) {
5757
return s.list(params)
5858
}
5959

@@ -62,7 +62,7 @@ func (s *ServiceWebhooks) List(params *ListWebhooksParams) (*Listing[Webhook], e
6262
// Endpoint: PUT /webhooks/:id
6363
//
6464
// API reference: https://docs.payrexhq.com/docs/api/webhooks/update
65-
func (s *ServiceWebhooks) Update(id string, params *UpdateWebhookParams) (*Webhook, error) {
65+
func (s *ServiceWebhooks) Update(id string, params *WebhookUpdateParams) (*Webhook, error) {
6666
return s.update(id, params)
6767
}
6868

@@ -93,28 +93,28 @@ func (s *ServiceWebhooks) Delete(id string) (*DeletedResource, error) {
9393
return s.delete(id)
9494
}
9595

96-
// CreateWebhookParams represents the available [ServiceWebhooks.Create] parameters.
96+
// WebhookCreateParams represents the available [ServiceWebhooks.Create] parameters.
9797
//
9898
// API reference: https://docs.payrexhq.com/docs/api/webhooks/create
99-
type CreateWebhookParams struct {
99+
type WebhookCreateParams struct {
100100
URL string `form:"url"`
101101
Description *string `form:"description"`
102102
Events []EventType `form:"events"`
103103
}
104104

105-
// UpdateWebhookParams represents the available [ServiceWebhooks.Update] parameters.
105+
// WebhookUpdateParams represents the available [ServiceWebhooks.Update] parameters.
106106
//
107107
// API reference: https://docs.payrexhq.com/docs/api/webhooks/update
108-
type UpdateWebhookParams struct {
108+
type WebhookUpdateParams struct {
109109
URL *string `form:"url"`
110110
Description *string `form:"description"`
111111
Events *[]EventType `form:"events"`
112112
}
113113

114-
// ListWebhooksParams represents the available [ServiceWebhooks.List] parameters.
114+
// WebhookListParams represents the available [ServiceWebhooks.List] parameters.
115115
//
116116
// API reference: https://docs.payrexhq.com/docs/api/webhooks/list
117-
type ListWebhooksParams struct {
117+
type WebhookListParams struct {
118118
Limit *int `form:"int"`
119119
Before *string `form:"before"`
120120
After *string `form:"after"`

0 commit comments

Comments
 (0)