Skip to content

Commit

Permalink
Release 0.6.0 (#40)
Browse files Browse the repository at this point in the history
* Added scheduleSubscriptionCancellationEnabled property to the Site model
* Added string representations for models
  • Loading branch information
lucassus authored Jan 21, 2025
1 parent 1f6bab2 commit 93ff584
Show file tree
Hide file tree
Showing 621 changed files with 5,424 additions and 1,344 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ License:
The MIT License (MIT)
http://opensource.org/licenses/MIT

Copyright (c) 2014 - 2024 APIMATIC Limited
Copyright (c) 2014 - 2025 APIMATIC Limited

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ The following section explains how to use the advancedbilling library in a new p
To use the package in your application, you can install the package from [pkg.go.dev](https://pkg.go.dev/) using the following command:

```bash
$ go get github.com/maxio-com/ab-golang-sdk@v0.5.0
$ go get github.com/maxio-com/ab-golang-sdk@v0.6.0
```

You can also view the package at: https://pkg.go.dev/github.com/maxio-com/ab-golang-sdk@v0.5.0
You can also view the package at: https://pkg.go.dev/github.com/maxio-com/ab-golang-sdk@v0.6.0

## Initialize the API Client

Expand Down
14 changes: 6 additions & 8 deletions advance_invoice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package advancedbilling

import (
"context"
"fmt"
"github.com/apimatic/go-core-runtime/https"
"github.com/apimatic/go-core-runtime/utilities"
"github.com/maxio-com/ab-golang-sdk/errors"
Expand Down Expand Up @@ -42,8 +41,9 @@ func (a *AdvanceInvoiceController) IssueAdvanceInvoice(
req := a.prepareRequest(
ctx,
"POST",
fmt.Sprintf("/subscriptions/%v/advance_invoice/issue.json", subscriptionId),
"/subscriptions/%v/advance_invoice/issue.json",
)
req.AppendTemplateParams(subscriptionId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
Expand Down Expand Up @@ -73,11 +73,8 @@ func (a *AdvanceInvoiceController) ReadAdvanceInvoice(
subscriptionId int) (
models.ApiResponse[models.Invoice],
error) {
req := a.prepareRequest(
ctx,
"GET",
fmt.Sprintf("/subscriptions/%v/advance_invoice.json", subscriptionId),
)
req := a.prepareRequest(ctx, "GET", "/subscriptions/%v/advance_invoice.json")
req.AppendTemplateParams(subscriptionId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
Expand Down Expand Up @@ -107,8 +104,9 @@ func (a *AdvanceInvoiceController) VoidAdvanceInvoice(
req := a.prepareRequest(
ctx,
"POST",
fmt.Sprintf("/subscriptions/%v/advance_invoice/void.json", subscriptionId),
"/subscriptions/%v/advance_invoice/void.json",
)
req.AppendTemplateParams(subscriptionId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
Expand Down
42 changes: 15 additions & 27 deletions api_exports_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package advancedbilling

import (
"context"
"fmt"
"github.com/apimatic/go-core-runtime/https"
"github.com/apimatic/go-core-runtime/utilities"
"github.com/maxio-com/ab-golang-sdk/errors"
Expand Down Expand Up @@ -52,8 +51,9 @@ func (a *APIExportsController) ListExportedProformaInvoices(
req := a.prepareRequest(
ctx,
"GET",
fmt.Sprintf("/api_exports/proforma_invoices/%v/rows.json", input.BatchId),
"/api_exports/proforma_invoices/%v/rows.json",
)
req.AppendTemplateParams(input.BatchId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
Expand Down Expand Up @@ -98,11 +98,8 @@ func (a *APIExportsController) ListExportedInvoices(
input ListExportedInvoicesInput) (
models.ApiResponse[[]models.Invoice],
error) {
req := a.prepareRequest(
ctx,
"GET",
fmt.Sprintf("/api_exports/invoices/%v/rows.json", input.BatchId),
)
req := a.prepareRequest(ctx, "GET", "/api_exports/invoices/%v/rows.json")
req.AppendTemplateParams(input.BatchId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
Expand Down Expand Up @@ -147,11 +144,8 @@ func (a *APIExportsController) ListExportedSubscriptions(
input ListExportedSubscriptionsInput) (
models.ApiResponse[[]models.Subscription],
error) {
req := a.prepareRequest(
ctx,
"GET",
fmt.Sprintf("/api_exports/subscriptions/%v/rows.json", input.BatchId),
)
req := a.prepareRequest(ctx, "GET", "/api_exports/subscriptions/%v/rows.json")
req.AppendTemplateParams(input.BatchId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
Expand Down Expand Up @@ -182,6 +176,7 @@ func (a *APIExportsController) ExportProformaInvoices(ctx context.Context) (
models.ApiResponse[models.BatchJobResponse],
error) {
req := a.prepareRequest(ctx, "POST", "/api_exports/proforma_invoices.json")

req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
Expand All @@ -205,6 +200,7 @@ func (a *APIExportsController) ExportInvoices(ctx context.Context) (
models.ApiResponse[models.BatchJobResponse],
error) {
req := a.prepareRequest(ctx, "POST", "/api_exports/invoices.json")

req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
Expand All @@ -228,6 +224,7 @@ func (a *APIExportsController) ExportSubscriptions(ctx context.Context) (
models.ApiResponse[models.BatchJobResponse],
error) {
req := a.prepareRequest(ctx, "POST", "/api_exports/subscriptions.json")

req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"409": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewSingleErrorResponse},
Expand All @@ -251,11 +248,8 @@ func (a *APIExportsController) ReadProformaInvoicesExport(
batchId string) (
models.ApiResponse[models.BatchJobResponse],
error) {
req := a.prepareRequest(
ctx,
"GET",
fmt.Sprintf("/api_exports/proforma_invoices/%v.json", batchId),
)
req := a.prepareRequest(ctx, "GET", "/api_exports/proforma_invoices/%v.json")
req.AppendTemplateParams(batchId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
Expand All @@ -280,11 +274,8 @@ func (a *APIExportsController) ReadInvoicesExport(
batchId string) (
models.ApiResponse[models.BatchJobResponse],
error) {
req := a.prepareRequest(
ctx,
"GET",
fmt.Sprintf("/api_exports/invoices/%v.json", batchId),
)
req := a.prepareRequest(ctx, "GET", "/api_exports/invoices/%v.json")
req.AppendTemplateParams(batchId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
Expand All @@ -309,11 +300,8 @@ func (a *APIExportsController) ReadSubscriptionsExport(
batchId string) (
models.ApiResponse[models.BatchJobResponse],
error) {
req := a.prepareRequest(
ctx,
"GET",
fmt.Sprintf("/api_exports/subscriptions/%v.json", batchId),
)
req := a.prepareRequest(ctx, "GET", "/api_exports/subscriptions/%v.json")
req.AppendTemplateParams(batchId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
Expand Down
21 changes: 8 additions & 13 deletions billing_portal_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package advancedbilling

import (
"context"
"fmt"
"github.com/apimatic/go-core-runtime/https"
"github.com/apimatic/go-core-runtime/utilities"
"github.com/maxio-com/ab-golang-sdk/errors"
Expand Down Expand Up @@ -43,11 +42,8 @@ func (b *BillingPortalController) EnableBillingPortalForCustomer(
autoInvite *models.AutoInvite) (
models.ApiResponse[models.CustomerResponse],
error) {
req := b.prepareRequest(
ctx,
"POST",
fmt.Sprintf("/portal/customers/%v/enable.json", customerId),
)
req := b.prepareRequest(ctx, "POST", "/portal/customers/%v/enable.json")
req.AppendTemplateParams(customerId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
Expand Down Expand Up @@ -81,11 +77,8 @@ func (b *BillingPortalController) ReadBillingPortalLink(
customerId int) (
models.ApiResponse[models.PortalManagementLink],
error) {
req := b.prepareRequest(
ctx,
"GET",
fmt.Sprintf("/portal/customers/%v/management_link.json", customerId),
)
req := b.prepareRequest(ctx, "GET", "/portal/customers/%v/management_link.json")
req.AppendTemplateParams(customerId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
Expand Down Expand Up @@ -120,8 +113,9 @@ func (b *BillingPortalController) ResendBillingPortalInvitation(
req := b.prepareRequest(
ctx,
"POST",
fmt.Sprintf("/portal/customers/%v/invitations/invite.json", customerId),
"/portal/customers/%v/invitations/invite.json",
)
req.AppendTemplateParams(customerId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
Expand Down Expand Up @@ -153,8 +147,9 @@ func (b *BillingPortalController) RevokeBillingPortalAccess(
req := b.prepareRequest(
ctx,
"DELETE",
fmt.Sprintf("/portal/customers/%v/invitations/revoke.json", customerId),
"/portal/customers/%v/invitations/revoke.json",
)
req.AppendTemplateParams(customerId)
req.Authenticate(NewAuth("BasicAuth"))

var result models.RevokedInvitation
Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func NewClient(configuration Configuration) ClientInterface {
configuration: configuration,
}

client.userAgent = utilities.UpdateUserAgent("AB SDK Go:0.5.0 on OS {os-info}")
client.userAgent = utilities.UpdateUserAgent("AB SDK Go:0.6.0 on OS {os-info}")
client.callBuilderFactory = callBuilderHandler(
func(server string) string {
if server == "" {
Expand Down
64 changes: 21 additions & 43 deletions component_price_points_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package advancedbilling

import (
"context"
"fmt"
"github.com/apimatic/go-core-runtime/https"
"github.com/apimatic/go-core-runtime/utilities"
"github.com/maxio-com/ab-golang-sdk/errors"
Expand Down Expand Up @@ -41,8 +40,9 @@ func (c *ComponentPricePointsController) PromoteComponentPricePointToDefault(
req := c.prepareRequest(
ctx,
"PUT",
fmt.Sprintf("/components/%v/price_points/%v/default.json", componentId, pricePointId),
"/components/%v/price_points/%v/default.json",
)
req.AppendTemplateParams(componentId, pricePointId)
req.Authenticate(NewAuth("BasicAuth"))

var result models.ComponentResponse
Expand All @@ -65,11 +65,8 @@ func (c *ComponentPricePointsController) CreateComponentPricePoint(
body *models.CreateComponentPricePointRequest) (
models.ApiResponse[models.ComponentPricePointResponse],
error) {
req := c.prepareRequest(
ctx,
"POST",
fmt.Sprintf("/components/%v/price_points.json", componentId),
)
req := c.prepareRequest(ctx, "POST", "/components/%v/price_points.json")
req.AppendTemplateParams(componentId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorArrayMapResponse},
Expand Down Expand Up @@ -117,11 +114,8 @@ func (c *ComponentPricePointsController) ListComponentPricePoints(
input ListComponentPricePointsInput) (
models.ApiResponse[models.ComponentPricePointsResponse],
error) {
req := c.prepareRequest(
ctx,
"GET",
fmt.Sprintf("/components/%v/price_points.json", input.ComponentId),
)
req := c.prepareRequest(ctx, "GET", "/components/%v/price_points.json")
req.AppendTemplateParams(input.ComponentId)
req.Authenticate(NewAuth("BasicAuth"))
if input.CurrencyPrices != nil {
req.QueryParam("currency_prices", *input.CurrencyPrices)
Expand Down Expand Up @@ -156,11 +150,8 @@ func (c *ComponentPricePointsController) BulkCreateComponentPricePoints(
body *models.CreateComponentPricePointsRequest) (
models.ApiResponse[models.ComponentPricePointsResponse],
error) {
req := c.prepareRequest(
ctx,
"POST",
fmt.Sprintf("/components/%v/price_points/bulk.json", componentId),
)
req := c.prepareRequest(ctx, "POST", "/components/%v/price_points/bulk.json")
req.AppendTemplateParams(componentId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
Expand Down Expand Up @@ -194,11 +185,8 @@ func (c *ComponentPricePointsController) UpdateComponentPricePoint(
body *models.UpdateComponentPricePointRequest) (
models.ApiResponse[models.ComponentPricePointResponse],
error) {
req := c.prepareRequest(
ctx,
"PUT",
fmt.Sprintf("/components/%v/price_points/%v.json", componentId, pricePointId),
)
req := c.prepareRequest(ctx, "PUT", "/components/%v/price_points/%v.json")
req.AppendTemplateParams(componentId, pricePointId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorArrayMapResponse},
Expand Down Expand Up @@ -229,11 +217,8 @@ func (c *ComponentPricePointsController) ReadComponentPricePoint(
currencyPrices *bool) (
models.ApiResponse[models.ComponentPricePointResponse],
error) {
req := c.prepareRequest(
ctx,
"GET",
fmt.Sprintf("/components/%v/price_points/%v.json", componentId, pricePointId),
)
req := c.prepareRequest(ctx, "GET", "/components/%v/price_points/%v.json")
req.AppendTemplateParams(componentId, pricePointId)
req.Authenticate(NewAuth("BasicAuth"))
if currencyPrices != nil {
req.QueryParam("currency_prices", *currencyPrices)
Expand All @@ -259,11 +244,8 @@ func (c *ComponentPricePointsController) ArchiveComponentPricePoint(
pricePointId models.ArchiveComponentPricePointPricePointId) (
models.ApiResponse[models.ComponentPricePointResponse],
error) {
req := c.prepareRequest(
ctx,
"DELETE",
fmt.Sprintf("/components/%v/price_points/%v.json", componentId, pricePointId),
)
req := c.prepareRequest(ctx, "DELETE", "/components/%v/price_points/%v.json")
req.AppendTemplateParams(componentId, pricePointId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
Expand Down Expand Up @@ -292,8 +274,9 @@ func (c *ComponentPricePointsController) UnarchiveComponentPricePoint(
req := c.prepareRequest(
ctx,
"PUT",
fmt.Sprintf("/components/%v/price_points/%v/unarchive.json", componentId, pricePointId),
"/components/%v/price_points/%v/unarchive.json",
)
req.AppendTemplateParams(componentId, pricePointId)
req.Authenticate(NewAuth("BasicAuth"))

var result models.ComponentPricePointResponse
Expand All @@ -318,11 +301,8 @@ func (c *ComponentPricePointsController) CreateCurrencyPrices(
body *models.CreateCurrencyPricesRequest) (
models.ApiResponse[models.ComponentCurrencyPricesResponse],
error) {
req := c.prepareRequest(
ctx,
"POST",
fmt.Sprintf("/price_points/%v/currency_prices.json", pricePointId),
)
req := c.prepareRequest(ctx, "POST", "/price_points/%v/currency_prices.json")
req.AppendTemplateParams(pricePointId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorArrayMapResponse},
Expand Down Expand Up @@ -353,11 +333,8 @@ func (c *ComponentPricePointsController) UpdateCurrencyPrices(
body *models.UpdateCurrencyPricesRequest) (
models.ApiResponse[models.ComponentCurrencyPricesResponse],
error) {
req := c.prepareRequest(
ctx,
"PUT",
fmt.Sprintf("/price_points/%v/currency_prices.json", pricePointId),
)
req := c.prepareRequest(ctx, "PUT", "/price_points/%v/currency_prices.json")
req.AppendTemplateParams(pricePointId)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorArrayMapResponse},
Expand Down Expand Up @@ -404,6 +381,7 @@ func (c *ComponentPricePointsController) ListAllComponentPricePoints(
models.ApiResponse[models.ListComponentsPricePointsResponse],
error) {
req := c.prepareRequest(ctx, "GET", "/components_price_points.json")

req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
Expand Down
Loading

0 comments on commit 93ff584

Please sign in to comment.