Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Dec 30, 2024
1 parent 98f4117 commit 5d9893d
Show file tree
Hide file tree
Showing 13 changed files with 2,069 additions and 417 deletions.
418 changes: 310 additions & 108 deletions billing.go

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions billing/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,67 @@ func NewClient(opts ...option.RequestOption) *Client {
}
}

func (c *Client) UpsertBillingCoupon(
ctx context.Context,
request *schematicgo.CreateCouponRequestBody,
opts ...option.RequestOption,
) (*schematicgo.UpsertBillingCouponResponse, error) {
options := core.NewRequestOptions(opts...)
baseURL := internal.ResolveBaseURL(
options.BaseURL,
c.baseURL,
"https://api.schematichq.com",
)
endpointURL := baseURL + "/billing/coupons"
headers := internal.MergeHeaders(
c.header.Clone(),
options.ToHeader(),
)
headers.Set("Content-Type", "application/json")
errorCodes := internal.ErrorCodes{
400: func(apiError *core.APIError) error {
return &schematicgo.BadRequestError{
APIError: apiError,
}
},
401: func(apiError *core.APIError) error {
return &schematicgo.UnauthorizedError{
APIError: apiError,
}
},
403: func(apiError *core.APIError) error {
return &schematicgo.ForbiddenError{
APIError: apiError,
}
},
500: func(apiError *core.APIError) error {
return &schematicgo.InternalServerError{
APIError: apiError,
}
},
}

var response *schematicgo.UpsertBillingCouponResponse
if err := c.caller.Call(
ctx,
&internal.CallParams{
URL: endpointURL,
Method: http.MethodPost,
Headers: headers,
MaxAttempts: options.MaxAttempts,
BodyProperties: options.BodyProperties,
QueryParameters: options.QueryParameters,
Client: options.HTTPClient,
Request: request,
Response: &response,
ErrorDecoder: internal.NewErrorDecoder(errorCodes),
},
); err != nil {
return nil, err
}
return response, nil
}

func (c *Client) UpsertBillingCustomer(
ctx context.Context,
request *schematicgo.CreateBillingCustomerRequestBody,
Expand Down
Loading

0 comments on commit 5d9893d

Please sign in to comment.