Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌿 Fern Regeneration -- December 30, 2024 #47

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
SDK regeneration
fern-api[bot] committed Dec 30, 2024
commit 5d9893d5490a97589ded1b689b753ba88fbb76a4
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
@@ -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,
Loading

Unchanged files with check annotations Beta

http "net/http"
reflect "reflect"
gomock "github.com/golang/mock/gomock"

Check failure on line 11 in mocks/http_mock.go

GitHub Actions / compile

no required module provides package github.com/golang/mock/gomock; to add it:

Check failure on line 11 in mocks/http_mock.go

GitHub Actions / test

no required module provides package github.com/golang/mock/gomock; to add it:
)
// MockHTTPClient is a mock of HTTPClient interface.