Developer-friendly & type-safe Go SDK specifically catered to leverage gosdktemp API.
Important
This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your workspace. Delete this section before > publishing to a package manager.
FlexPrice API: FlexPrice API Service
To add the SDK as a dependency to your project:
go get github.com/flexprice/go-sdk-temppackage main
import (
"context"
gosdktemp "github.com/flexprice/go-sdk-temp"
"github.com/flexprice/go-sdk-temp/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := gosdktemp.New(
"https://api.example.com",
gosdktemp.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Addons.GetAddons(ctx, operations.GetAddonsRequest{})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}This SDK supports the following security scheme globally:
| Name | Type | Scheme |
|---|---|---|
APIKeyAuth |
apiKey | API key |
You can configure it using the WithSecurity option when initializing the SDK client instance. For example:
package main
import (
"context"
gosdktemp "github.com/flexprice/go-sdk-temp"
"github.com/flexprice/go-sdk-temp/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := gosdktemp.New(
"https://api.example.com",
gosdktemp.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Addons.GetAddons(ctx, operations.GetAddonsRequest{})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}Available methods
- GetAddons - List addons
- PostAddons - Create addon
- GetAddonsLookupLookupKey - Get addon by lookup key
- PostAddonsSearch - List addons by filter
- GetAddonsID - Get addon
- PutAddonsID - Update addon
- DeleteAddonsID - Delete addon
- PostAlertSearch - List alert logs by filter
- PostAuthLogin - Login
- PostAuthSignup - Sign up
- GetConnections - Get connections
- PostConnectionsSearch - List connections by filter
- GetConnectionsID - Get a connection
- PutConnectionsID - Update a connection
- DeleteConnectionsID - Delete a connection
- PostCosts - Create a new costsheet
- GetCostsActive - Get active costsheet for tenant
- PostCostsAnalytics - Get combined revenue and cost analytics
- PostCostsAnalyticsV2 - Get combined revenue and cost analytics
- PostCostsSearch - List costsheets by filter
- GetCostsID - Get a costsheet by ID
- PutCostsID - Update a costsheet
- DeleteCostsID - Delete a costsheet
- GetCoupons - List coupons with filtering
- PostCoupons - Create a new coupon
- GetCouponsID - Get a coupon by ID
- PutCouponsID - Update a coupon
- DeleteCouponsID - Delete a coupon
- GetCreditnotes - List credit notes with filtering
- PostCreditnotes - Create a new credit note
- GetCreditnotesID - Get a credit note by ID
- PostCreditnotesIDFinalize - Process a draft credit note
- PostCreditnotesIDVoid - Void a credit note
- GetCreditgrants - Get credit grants
- PostCreditgrants - Create a new credit grant
- GetCreditgrantsID - Get a credit grant by ID
- PutCreditgrantsID - Update a credit grant
- DeleteCreditgrantsID - Delete a credit grant
- GetPlansIDCreditgrants - Get plan credit grants
- GetPortalExternalID - Create a customer portal session
- GetCustomers - Get customers
- PutCustomers - Update a customer
- PostCustomers - Create a customer
- GetCustomersExternalExternalID - Get a customer by external id
- PostCustomersSearch - List customers by filter
- GetCustomersUsage - Get customer usage summary
- GetCustomersID - Get a customer
- DeleteCustomersID - Delete a customer
- GetCustomersIDEntitlements - Get customer entitlements
- GetCustomersIDGrantsUpcoming - Get upcoming credit grant applications
- GetAddonsIDEntitlements - Get addon entitlements
- GetEntitlements - Get entitlements
- PostEntitlements - Create a new entitlement
- PostEntitlementsBulk - Create multiple entitlements in bulk
- PostEntitlementsSearch - List entitlements by filter
- GetEntitlementsID - Get an entitlement by ID
- PutEntitlementsID - Update an entitlement
- DeleteEntitlementsID - Delete an entitlement
- GetPlansIDEntitlements - Get plan entitlements
- GetEntityIntegrationMappings - List entity integration mappings
- PostEntityIntegrationMappings - Create entity integration mapping
- GetEntityIntegrationMappingsID - Get entity integration mapping
- DeleteEntityIntegrationMappingsID - Delete entity integration mapping
- GetEnvironments - Get environments
- PostEnvironments - Create an environment
- GetEnvironmentsID - Get an environment
- PutEnvironmentsID - Update an environment
- PostEvents - Ingest event
- PostEventsAnalytics - Get usage analytics
- PostEventsBulk - Bulk Ingest events
- PostEventsHuggingfaceInference - Get hugging face inference data
- GetEventsMonitoring - Get monitoring data
- PostEventsQuery - List raw events
- PostEventsUsage - Get usage statistics
- PostEventsUsageMeter - Get usage by meter
- GetEventsID - Get event by ID
- GetFeatures - List features
- PostFeatures - Create a new feature
- PostFeaturesSearch - List features by filter
- GetFeaturesID - Get a feature by ID
- PutFeaturesID - Update a feature
- DeleteFeaturesID - Delete a feature
- PostGroups - Create a group
- PostGroupsSearch - Get groups
- GetGroupsID - Get a group
- DeleteGroupsID - Delete a group
- GetSecretsIntegrationsByProviderProvider - Get integration details
- PostSecretsIntegrationsCreateProvider - Create or update an integration
- GetSecretsIntegrationsLinked - List linked integrations
- DeleteSecretsIntegrationsID - Delete an integration
- GetCustomersIDInvoicesSummary - Get a customer invoice summary
- GetInvoices - List invoices
- PostInvoices - Create a new one off invoice
- PostInvoicesPreview - Get a preview invoice
- PostInvoicesSearch - List invoices by filter
- GetInvoicesID - Get an invoice by ID
- PutInvoicesID - Update an invoice
- PostInvoicesIDCommsTrigger - Trigger communication webhook for an invoice
- PostInvoicesIDFinalize - Finalize an invoice
- PutInvoicesIDPayment - Update invoice payment status
- PostInvoicesIDPaymentAttempt - Attempt payment for an invoice
- GetInvoicesIDPdf - Get PDF for an invoice
- PostInvoicesIDRecalculate - Recalculate invoice totals and line items
- PostInvoicesIDVoid - Void an invoice
- GetPayments - List payments
- PostPayments - Create a new payment
- GetPaymentsID - Get a payment by ID
- PutPaymentsID - Update a payment
- DeletePaymentsID - Delete a payment
- PostPaymentsIDProcess - Process a payment
- GetPlans - Get plans
- PostPlans - Create a new plan
- PostPlansSearch - List plans by filter
- GetPlansID - Get a plan
- PutPlansID - Update a plan
- DeletePlansID - Delete a plan
- PostPlansIDSyncSubscriptions - Synchronize plan prices
- GetPricesUnits - List price units
- PostPricesUnits - Create a new price unit
- GetPricesUnitsCodeCode - Get a price unit by code
- PostPricesUnitsSearch - List price units by filter
- GetPricesUnitsID - Get a price unit by ID
- PutPricesUnitsID - Update a price unit
- DeletePricesUnitsID - Delete a price unit
- GetPrices - Get prices
- PostPrices - Create a new price
- PostPricesBulk - Create multiple prices in bulk
- GetPricesLookupLookupKey - Get price by lookup key
- GetPricesID - Get a price by ID
- PutPricesID - Update a price
- DeletePricesID - Delete a price
- GetRbacRoles - List all RBAC roles
- GetRbacRolesID - Get a specific RBAC role
- GetTasksScheduled - List scheduled tasks
- PostTasksScheduled - Create a scheduled task
- PostTasksScheduledScheduleUpdateBillingPeriod - Schedule update billing period
- GetTasksScheduledID - Get a scheduled task
- PutTasksScheduledID - Update a scheduled task
- DeleteTasksScheduledID - Delete a scheduled task
- PostTasksScheduledIDRun - Trigger force run
- GetSecretsAPIKeys - List API keys
- PostSecretsAPIKeys - Create a new API key
- DeleteSecretsAPIKeysID - Delete an API key
- GetSubscriptions - List subscriptions
- PostSubscriptions - Create subscription
- PostSubscriptionsAddon - Add addon to subscription
- DeleteSubscriptionsAddon - Remove addon from subscription
- PutSubscriptionsLineitemsID - Update subscription line item
- DeleteSubscriptionsLineitemsID - Delete subscription line item
- PostSubscriptionsSearch - List subscriptions by filter
- PostSubscriptionsUsage - Get usage by subscription
- GetSubscriptionsID - Get subscription
- PostSubscriptionsIDActivate - Activate draft subscription
- GetSubscriptionsIDAddonsAssociations - Get active addon associations
- PostSubscriptionsIDCancel - Cancel subscription
- PostSubscriptionsIDChangeExecute - Execute subscription plan change
- PostSubscriptionsIDChangePreview - Preview subscription plan change
- GetSubscriptionsIDEntitlements - Get subscription entitlements
- GetSubscriptionsIDGrantsUpcoming - Get upcoming credit grant applications
- PostSubscriptionsIDPause - Pause a subscription
- GetSubscriptionsIDPauses - List all pauses for a subscription
- PostSubscriptionsIDResume - Resume a paused subscription
- GetSubscriptionsIDV2 - Get subscription V2
- GetV1SubscriptionSchedules - List all subscription schedules
- GetV1SubscriptionSchedulesID - Get subscription schedule
- PostV1SubscriptionsSchedulesScheduleIDCancel - Cancel subscription schedule
- GetV1SubscriptionsSubscriptionIDSchedules - List subscription schedules
- GetTasks - List tasks
- PostTasks - Create a new task
- GetTasksResult - Get task processing result
- GetTasksID - Get a task
- GetTasksIDDownload - Download task export file
- PutTasksIDStatus - Update task status
- GetTaxesAssociations - List tax associations
- PostTaxesAssociations - Create Tax Association
- GetTaxesAssociationsID - Get Tax Association
- PutTaxesAssociationsID - Update tax association
- DeleteTaxesAssociationsID - Delete tax association
- GetTaxesRates - Get tax rates
- PostTaxesRates - Create a tax rate
- GetTaxesRatesID - Get a tax rate
- PutTaxesRatesID - Update a tax rate
- DeleteTaxesRatesID - Delete a tax rate
- GetTenantBilling - Get billing usage for the current tenant
- PostTenants - Create a new tenant
- PutTenantsUpdate - Update a tenant
- GetTenantsID - Get tenant by ID
- PostUsers - Create service account
- GetUsersMe - Get user info
- PostUsersSearch - List users with filters
- GetCustomersWallets - Get Customer Wallets
- GetCustomersIDWallets - Get wallets by customer ID
- GetWallets - List wallets
- PostWallets - Create a new wallet
- PostWalletsSearch - List wallets by filter
- PostWalletsTransactionsSearch - List wallet transactions by filter
- GetWalletsID - Get wallet by ID
- PutWalletsID - Update a wallet
- GetWalletsIDBalanceRealTime - Get wallet balance
- PostWalletsIDTerminate - Terminate a wallet
- PostWalletsIDTopUp - Top up wallet
- GetWalletsIDTransactions - Get wallet transactions
- PostWebhooksChargebeeTenantIDEnvironmentID - Handle Chargebee webhook events
- PostWebhooksHubspotTenantIDEnvironmentID - Handle HubSpot webhook events
- PostWebhooksMoyasarTenantIDEnvironmentID - Handle Moyasar webhook events
- PostWebhooksNomodTenantIDEnvironmentID - Handle Nomod webhook events
- PostWebhooksQuickbooksTenantIDEnvironmentID - Handle QuickBooks webhook events
- PostWebhooksRazorpayTenantIDEnvironmentID - Handle Razorpay webhook events
- PostWebhooksStripeTenantIDEnvironmentID - Handle Stripe webhook events
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply provide a retry.Config object to the call by using the WithRetries option:
package main
import (
"context"
gosdktemp "github.com/flexprice/go-sdk-temp"
"github.com/flexprice/go-sdk-temp/models/operations"
"github.com/flexprice/go-sdk-temp/retry"
"log"
"models/operations"
)
func main() {
ctx := context.Background()
s := gosdktemp.New(
"https://api.example.com",
gosdktemp.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Addons.GetAddons(ctx, operations.GetAddonsRequest{}, operations.WithRetries(
retry.Config{
Strategy: "backoff",
Backoff: &retry.BackoffStrategy{
InitialInterval: 1,
MaxInterval: 50,
Exponent: 1.1,
MaxElapsedTime: 100,
},
RetryConnectionErrors: false,
}))
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}If you'd like to override the default retry strategy for all operations that support retries, you can use the WithRetryConfig option at SDK initialization:
package main
import (
"context"
gosdktemp "github.com/flexprice/go-sdk-temp"
"github.com/flexprice/go-sdk-temp/models/operations"
"github.com/flexprice/go-sdk-temp/retry"
"log"
)
func main() {
ctx := context.Background()
s := gosdktemp.New(
"https://api.example.com",
gosdktemp.WithRetryConfig(
retry.Config{
Strategy: "backoff",
Backoff: &retry.BackoffStrategy{
InitialInterval: 1,
MaxInterval: 50,
Exponent: 1.1,
MaxElapsedTime: 100,
},
RetryConnectionErrors: false,
}),
gosdktemp.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Addons.GetAddons(ctx, operations.GetAddonsRequest{})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}Handling errors in this SDK should largely match your expectations. All operations return a response object or an error, they will never return both.
By Default, an API error will return sdkerrors.APIError. When custom error responses are specified for an operation, the SDK may also return their associated error. You can refer to respective Errors tables in SDK docs for more details on possible error types for each operation.
For example, the GetAddons function may return the following errors:
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.ErrorsErrorResponse | 400 | application/json |
| sdkerrors.ErrorsErrorResponse | 500 | application/json |
| sdkerrors.APIError | 4XX, 5XX | */* |
package main
import (
"context"
"errors"
gosdktemp "github.com/flexprice/go-sdk-temp"
"github.com/flexprice/go-sdk-temp/models/operations"
"github.com/flexprice/go-sdk-temp/models/sdkerrors"
"log"
)
func main() {
ctx := context.Background()
s := gosdktemp.New(
"https://api.example.com",
gosdktemp.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Addons.GetAddons(ctx, operations.GetAddonsRequest{})
if err != nil {
var e *sdkerrors.ErrorsErrorResponse
if errors.As(err, &e) {
// handle error
log.Fatal(e.Error())
}
var e *sdkerrors.ErrorsErrorResponse
if errors.As(err, &e) {
// handle error
log.Fatal(e.Error())
}
var e *sdkerrors.APIError
if errors.As(err, &e) {
// handle error
log.Fatal(e.Error())
}
}
}The Go SDK makes API calls that wrap an internal HTTP client. The requirements for the HTTP client are very simple. It must match this interface:
type HTTPClient interface {
Do(req *http.Request) (*http.Response, error)
}The built-in net/http client satisfies this interface and a default client based on the built-in is provided by default. To replace this default with a client of your own, you can implement this interface yourself or provide your own client configured as desired. Here's a simple example, which adds a client with a 30 second timeout.
import (
"net/http"
"time"
"github.com/flexprice/go-sdk-temp"
)
var (
httpClient = &http.Client{Timeout: 30 * time.Second}
sdkClient = gosdktemp.New(gosdktemp.WithClient(httpClient))
)This can be a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration.
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.