Categorygithub.com/sugerio/suger-sdk-go
repositorypackage
3.127.466+incompatible
Repository: https://github.com/sugerio/suger-sdk-go.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Go API client for openapi

CRUD operations on a set of resources, including organizations, products, offers, entitlements, usage record groups for meterting, etc.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0
  • Package version: 1.0.0
  • Generator version: 7.10.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://www.suger.io/support

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import openapi "github.com/sugerio/suger-sdk-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value openapi.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value openapi.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using openapi.ContextOperationServerIndices and openapi.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})

Documentation for API Endpoints

All URIs are relative to https://api.suger.cloud

ClassMethodHTTP requestDescription
APIAPIGetApiClientGet /org/{orgId}/apiClient/{apiClientId}get api client
APIAPIGetApiClientAccessTokenPost /public/apiClient/accessTokenget api access token
APIAPIListApiClientsGet /org/{orgId}/apiClientlist api clients
BillingAPICreateAddonPost /org/{orgId}/addoncreate addon
BillingAPICreateRefundPost /org/{orgId}/buyer/{buyerId}/paymentTransaction/{paymentTransactionId}/refundcreate refund.
BillingAPIDeleteAddonDelete /org/{orgId}/addon/{addonId}delete addon
BillingAPIGetAddonGet /org/{orgId}/addon/{addonId}get addon
BillingAPIGetInvoiceGet /org/{orgId}/entitlement/{entitlementId}/invoice/{invoiceId}get invoice
BillingAPIIssueInvoicePatch /org/{orgId}/entitlement/{entitlementId}/invoice/{invoiceId}/issueissue invoice
BillingAPIListAddonsGet /org/{orgId}/addonlist addons
BillingAPIListInvoicesGet /org/{orgId}/invoicelist invoices
BillingAPIListPaymentTransactionsGet /org/{orgId}/paymentTransactionlist payment transactions
BillingAPIListRefundOfPaymentTransactionGet /org/{orgId}/buyer/{buyerId}/paymentTransaction/{paymentTransactionId}/refundlist refunds.
BillingAPIPayInvoicePatch /org/{orgId}/entitlement/{entitlementId}/invoice/{invoiceId}/paypay invoice
BillingAPIUpdateAddonPatch /org/{orgId}/addon/{addonId}update addon
BillingAPIVoidInvoicePatch /org/{orgId}/entitlement/{entitlementId}/invoice/{invoiceId}/voidvoid invoice
BuyerAPICloseCreditWalletPatch /org/{orgId}/buyer/{buyerId}/wallet/{walletId}/closeclose credit wallet
BuyerAPICreateBuyerPost /org/{orgId}/buyercreate buyer
BuyerAPICreateCreditWalletPost /org/{orgId}/buyer/{buyerId}/walletcreate credit wallet
BuyerAPIDeleteBuyerWalletDelete /org/{orgId}/buyer/{buyerId}/wallet/{walletId}delete buyer wallet
BuyerAPIGetBuyerGet /org/{orgId}/buyer/{buyerId}get buyer
BuyerAPIListBuyerWalletsGet /org/{orgId}/buyer/{buyerId}/walletlist buyer's wallets
BuyerAPIListBuyersGet /org/{orgId}/buyerlist buyers
BuyerAPISetBuyerDefaultWalletPatch /org/{orgId}/buyer/{buyerId}/wallet/{walletId}/defaultset buyer default wallet
BuyerAPIUpdateBuyerPatch /org/{orgId}/buyer/{buyerId}update buyer
BuyerAPIUpdateCreditWalletPatch /org/{orgId}/buyer/{buyerId}/wallet/{walletId}update credit wallet
ContactAPIAddContactToBuyerPost /org/{orgId}/contact/{contactId}/buyer/{buyerId}add contact to buyer
ContactAPIAddContactToOfferPost /org/{orgId}/contact/{contactId}/offer/{offerId}add contact to offer
ContactAPIBatchCreateContactsPost /org/{orgId}/contact/batchbatch create contacts
ContactAPICreateContactPost /org/{orgId}/contactcreate contact
ContactAPIGetContactGet /org/{orgId}/contact/{contactId}get contact
ContactAPIListContactsByOrganizationGet /org/{orgId}/contactlist contacts by organization
ContactAPIRemoveContactFromBuyerDelete /org/{orgId}/contact/{contactId}/buyer/{buyerId}remove contact from buyer
ContactAPIRemoveContactFromOfferDelete /org/{orgId}/contact/{contactId}/offer/{offerId}remove contact from offer
ContactAPIUpdateContactPatch /org/{orgId}/contact/{contactId}update contact
EntitlementAPIAddEntitlementCreditPost /org/{orgId}/entitlement/{entitlementId}/addCreditadd entitlement credit
EntitlementAPIApplyAddonToEntitlementPost /org/{orgId}/entitlement/{entitlementId}/addonapply addon to entitlement
EntitlementAPIApproveEntitlementPost /org/{orgId}/entitlement/{entitlementId}/approveapprove entitlement
EntitlementAPICancelEntitlementPost /org/{orgId}/entitlement/{entitlementId}/cancelcancel entitlement
EntitlementAPICreateEntitlementPost /org/{orgId}/entitlementcreate entitlement
EntitlementAPIDeleteEntitlementTermDelete /org/{orgId}/entitlement/{entitlementId}/entitlementTerm/{entitlementTermId}delete entitlement term
EntitlementAPIDivideEntitlementCommitPost /org/{orgId}/entitlement/{entitlementId}/divideCommitdivide entitlement commit
EntitlementAPIGetEntitlementGet /org/{orgId}/entitlement/{entitlementId}get entitlement
EntitlementAPIGetEntitlementTermGet /org/{orgId}/entitlement/{entitlementId}/entitlementTerm/{entitlementTermId}get entitlement term
EntitlementAPIListEntitlementTermsGet /org/{orgId}/entitlement/{entitlementId}/entitlementTermlist entitlement terms
EntitlementAPIListEntitlementsGet /org/{orgId}/entitlementlist entitlements
EntitlementAPIScheduleEntitlementCancellationPost /org/{orgId}/entitlement/{entitlementId}/scheduleCancellationschedule entitlement cancellation
EntitlementAPIUnscheduleEntitlementCancellationPost /org/{orgId}/entitlement/{entitlementId}/unscheduleCancellationunschedule entitlement cancellation
EntitlementAPIUpdateEntitlementMetaInfoPatch /org/{orgId}/entitlement/{entitlementId}/metaInfoupdate entitlement meta info
EntitlementAPIUpdateEntitlementNamePatch /org/{orgId}/entitlement/{entitlementId}/entitlementNameupdate entitlement name
EntitlementAPIUpdateEntitlementSeatPatch /org/{orgId}/entitlement/{entitlementId}/seatupdate seat for the active AZURE subscription
MeteringAPIBatchReportUsageRecordGroupsPost /org/{orgId}/batchCreateUsageRecordGroupsbatch report usageRecordGroups
MeteringAPIBatchValidateUsageRecordGroupsPost /org/{orgId}/batchValidateUsageRecordGroupsbatch validate usageRecordGroups
MeteringAPICreateBillableMetricPost /org/{orgId}/billableMetriccreate billable metric
MeteringAPIDeleteUsageRecordGroupDelete /org/{orgId}/usageRecordGroup/{usageRecordGroupId}delete usageRecordGroup
MeteringAPIGetBillableMetricGet /org/{orgId}/billableMetric/{billableMetricId}get billable metric
MeteringAPIGetUsageMeteringConfigInfoGet /org/{orgId}/usageMeteringConfigInfoget usage metering config info
MeteringAPIListBillableMetricsGet /org/{orgId}/billableMetriclist billable metrics
MeteringAPIListUsageRecordGroupsGet /org/{orgId}/usageRecordGrouplist usageRecordGroups
MeteringAPIListUsageRecordReportsGet /org/{orgId}/usageRecordReportlist usageRecordReports
MeteringAPIReportUsageRecordGroupPost /org/{orgId}/entitlement/{entitlementId}/usageRecordGroupreport usageRecordGroup
MeteringAPIRetryUsageRecordGroupPost /org/{orgId}/usageRecordGroup/{usageRecordGroupId}/retryretry usageRecordGroup
MeteringAPIUpdateBillableMetricPatch /org/{orgId}/billableMetric/{billableMetricId}update billable metric
MeteringAPIUpdateUsageMeteringConfigInfoPatch /org/{orgId}/usageMeteringConfigInfoupdate usage metering config info
NotificationAPIGetNotificationMessageGet /org/{orgId}/notificationMessage/{notificationMessageId}get notification message
NotificationAPIListNotificationEventsGet /org/{orgId}/notificationEventlist notification events
NotificationAPIListNotificationEventsByEntityGet /org/{orgId}/notificationEvent/{entityType}/{entityId}list notification events by entity
NotificationAPIListNotificationMessagesGet /org/{orgId}/notificationMessagelist notification messages
OfferAPICancelOfferPost /org/{orgId}/offer/{offerId}/cancelcancel offer
OfferAPICreateOfferPost /org/{orgId}/offercreate offer
OfferAPICreateOrUpdateDraftOfferPost /org/{orgId}/draftOffercreate or update draft offer
OfferAPIDeleteOfferDelete /org/{orgId}/offer/{offerId}delete offer
OfferAPIExtendPrivateOfferExpiryDatePost /org/{orgId}/offer/{offerId}/extendExpiryDateextend offer expiry date
OfferAPIGetOfferGet /org/{orgId}/offer/{offerId}get offer
OfferAPIGetOfferByExternalIdGet /org/{orgId}/offerExternalId/{offerExternalId}get offer by external ID
OfferAPIGetOfferEulaGet /org/{orgId}/offer/{offerId}/eulaget offer EULA
OfferAPIGetOfferResellerEulaGet /org/{orgId}/offer/{offerId}/resellerEulaget offer reseller EULA
OfferAPIListOffersGet /org/{orgId}/offerlist offers
OfferAPISendOfferNotificationsPost /org/{orgId}/offer/{offerId}/notifyContactsnotify offer contacts
OfferAPIUpdateOfferMetaInfoPatch /org/{orgId}/offer/{offerId}/metaInfoupdate offer meta info
ProductAPICreateOrUpdateDraftProductPost /org/{orgId}/draftProductcreate or update draft product
ProductAPICreateProductPost /org/{orgId}/productcreate product
ProductAPIDeleteProductDelete /org/{orgId}/product/{productId}delete product
ProductAPIGetProductGet /org/{orgId}/product/{productId}get product
ProductAPIListProductMeteringDimensionsGet /org/{orgId}/product/{productId}/dimensionlist metering dimensions of product
ProductAPIListProductsByOrganizationGet /org/{orgId}/productlist products by organization
ProductAPIListProductsByPartnerGet /org/{orgId}/partner/{partner}/productlist products by partner
ProductAPIPublishProductPatch /org/{orgId}/product/{productId}/publishpublish product
ProductAPIUpdateProductPatch /org/{orgId}/product/{productId}update product
ProductAPIUpdateProductFulfillmentUrlPatch /org/{orgId}/product/{productId}/fulfillmentUrlupdate product fulfillment url
ProductAPIUpdateProductMetaInfoPatch /org/{orgId}/product/{productId}/metaInfoupdate product meta info
ReportAPIGetRevenueReportPost /org/{orgId}/revenueReportget revenue report
ReportAPIListDailyRevenueRecordsGet /org/{orgId}/dailyRevenueRecordlist daily revenue records
ReportAPIListRevenueRecordDetailsGet /org/{orgId}/partner/{partner}/revenueRecordDetaillist revenue record details
ReportAPIListRevenueRecordsGet /org/{orgId}/partner/{partner}/revenueRecordlist revenue records
ReportAPIListUsageMeteringDailyRecordsGet /org/{orgId}/partner/{partner}/usageMeteringDailyRecordlist usage metering daily records
SupportAPICloseSupportTicketPatch /org/{orgId}/support/ticket/{ticketId}/closeclose support ticket
SupportAPICreateSupportTicketPost /org/{orgId}/support/ticketcreate support ticket
SupportAPICreateSupportTicketAttachmentPost /org/{orgId}/support/ticket/{ticketId}/attachmentcreate support ticket attachment
SupportAPICreateSupportTicketCommentPost /org/{orgId}/support/ticket/{ticketId}/commentcreate support ticket comment
SupportAPIGetSupportTicketGet /org/{orgId}/support/ticket/{ticketId}get support ticket
SupportAPIListSupportTicketsGet /org/{orgId}/support/ticketlist support tickets
SupportAPIReopenSupportTicketPatch /org/{orgId}/support/ticket/{ticketId}/reopenreopen support ticket
SupportAPIUpdateSupportTicketPatch /org/{orgId}/support/ticket/{ticketId}update support ticket

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

APIKeyAuth

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: APIKeyAuth and passed in as the auth context for each request.

Example

auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"APIKeyAuth": {Key: "Key " + API_KEY_STRING},
},
)
r, err := client.Service.Operation(auth, args)
		configuration := openapiclient.NewConfiguration()
		apiClient := openapiclient.NewAPIClient(configuration)
		var orgId = "***"
		var offerId = "***"
		auth := context.WithValue(
			context.Background(),
			openapiclient.ContextAPIKeys,
			map[string]openapiclient.APIKey{
				"APIKeyAuth": {Key: "Key API_KEY_STRING"},
			},
		)

		resp, httpRes, err := apiClient.OfferAPI.GetOffer(auth, orgId, offerId).Execute()

BearerTokenAuth

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: BearerTokenAuth and passed in as the auth context for each request.

Example

auth := context.WithValue(
context.Background(),
openapi.ContextAPIKeys,
map[string]openapi.APIKey{
"APIKeyAuth": {Key: "Key " + API_KEY_STRING},
},
)
r, err := client.Service.Operation(auth, args)
		configuration := openapiclient.NewConfiguration()
		apiClient := openapiclient.NewAPIClient(configuration)
		var orgId = "***"
		var offerId = "***"
		auth := context.WithValue(
			context.Background(),
			openapiclient.ContextAPIKeys,
			map[string]openapiclient.APIKey{
				"APIKeyAuth": {Key: "Key API_KEY_STRING"},
			},
		)

		resp, httpRes, err := apiClient.OfferAPI.GetOffer(auth, orgId, offerId).Execute()

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]