Documentation
¶
Index ¶
- Constants
- Variables
- func Bool(val bool) *bool
- func BoolValue(val *bool) bool
- func Configure(key string, siteName string)
- func ErrorHandling(resBody []byte) error
- func Float64(val float64) *float64
- func Float64Value(val *float64) float64
- func GetMap(rawMessage json.RawMessage) map[string]interface{}
- func Int32(val int32) *int32
- func Int32Value(val *int32) int32
- func Int64(val int64) *int64
- func Int64Value(val *int64) int64
- func NewDefaultHTTPClient() *http.Client
- func SerializeListParams(params interface{}) *url.Values
- func SerializeParams(params interface{}) *url.Values
- func UnmarshalJSON(response []byte, result interface{}) error
- func UpdateTotalHTTPTimeout(timeout time.Duration)
- func WithEnableDebugLogs(enabled bool)
- func WithEnvironment(ctx context.Context, env Environment) context.Context
- func WithHTTPClient(c *http.Client)
- func WithRetryConfig(c *RetryConfig)
- type CBResponse
- type Environment
- type Error
- type ErrorType
- type ListRequest
- func (request ListRequest) AddParams(key string, value interface{}) ListRequest
- func (request ListRequest) Contexts(ctx context.Context) ListRequest
- func (request ListRequest) Headers(key string, value string) ListRequest
- func (request ListRequest) ListRequest() (*ResultList, error)
- func (request ListRequest) ListRequestWithEnv(env Environment) (*ResultList, error)
- func (request ListRequest) SetIdempotency(idempotent bool) ListRequest
- func (request ListRequest) SetIdempotencyKey(idempotencyKey string) ListRequest
- func (request ListRequest) SetSubDomain(subDomain string) ListRequest
- type ListRequestObj
- type Request
- func (request Request) AddParams(key string, value interface{}) Request
- func (request Request) Contexts(ctx context.Context) Request
- func (request Request) Headers(key string, value string) Request
- func (request Request) Request() (*Result, error)
- func (request Request) RequestWithEnv(env Environment) (*Result, error)
- func (request Request) SetIdempotency(idempotent bool) Request
- func (request Request) SetIdempotencyKey(idempotencyKey string) Request
- func (request Request) SetSubDomain(subDomain string) Request
- type RequestObj
- type ResponseMeta
- type Result
- type ResultList
- type RetryConfig
Constants ¶
const ( APIVersion = "v2" Charset = "UTF-8" )
const ( IdempotencyHeader = "chargebee-idempotency-key" IdempotencyReplayHeader = "Chargebee-Idempotency-Replayed" )
const Version string = "3.45.0"
Variables ¶
var ( TotalHTTPTimeout = 80 * time.Second ExportWaitInSecs = 3 * time.Second TimeMachineWaitInSecs = 3 * time.Second DefaultEnv Environment )
Functions ¶
func BoolValue ¶
BoolValue returns the value of the bool pointer passed or false if the pointer is nil.
func ErrorHandling ¶
func Float64Value ¶
Float64Value returns the value of the float64 pointer passed or 0 if the pointer is nil.
func GetMap ¶
func GetMap(rawMessage json.RawMessage) map[string]interface{}
GetMap is used to unmarshal the json.RawMessage to map[string]interface{}.
func Int32Value ¶
Int32Value returns the value of the int32 pointer passed or 0 if the pointer is nil.
func Int64Value ¶
Int64Value returns the value of the int64 pointer passed or 0 if the pointer is nil.
func NewDefaultHTTPClient ¶
func SerializeListParams ¶
SerializeListParams is to used to serialize the inputParams of list request.
func SerializeParams ¶
SerializeParams is to used to serialize the inputParams request . Eg : Customer : { FirstName : "John" } is serialized as "customer[first_name]" : "John".
func UnmarshalJSON ¶
UnmarshalJSON is used to unmarshal the response to Result / ResultList struct.
func UpdateTotalHTTPTimeout ¶
func WithEnableDebugLogs ¶ added in v3.34.0
func WithEnableDebugLogs(enabled bool)
func WithEnvironment ¶ added in v3.38.1
func WithEnvironment(ctx context.Context, env Environment) context.Context
func WithHTTPClient ¶
func WithRetryConfig ¶ added in v3.34.0
func WithRetryConfig(c *RetryConfig)
Types ¶
type CBResponse ¶ added in v3.5.0
type CBResponse struct {
Body []byte
ResponseMeta
}
type Environment ¶
type Environment struct {
Key string
SiteName string
ChargebeeDomain string
Protocol string
RetryConfig *RetryConfig
EnableDebugLogs bool
}
func DefaultConfig ¶
func DefaultConfig() Environment
type Error ¶
type Error struct {
HTTPStatusCode int `json:"http_status_code"`
Msg string `json:"message"`
Param string `json:"param"`
APIErrorCode string `json:"api_error_code"`
Type ErrorType `json:"type"`
ErrorCode string `json:"error_code"`
Err error `json:"_"`
ErrorCauseID string `json:"error_cause_id,omitempty"`
BatchId string `json:"batch_id"`
FailedEvents []interface{} `json:"failed_events"`
}
Error is the Response returned when a call is unsuccessful
type ListRequest ¶ added in v3.37.0
type ListRequest = ListRequestObj
func SendList ¶
func SendList(method string, path string, params interface{}) ListRequest
SendList prepares a ListRequest for ListRequest operation.
func (ListRequest) AddParams ¶ added in v3.37.0
func (request ListRequest) AddParams(key string, value interface{}) ListRequest
AddParams add a new key-value pair to the ListRequest.Params. This is used to add extra/custom_field params in the request data.
func (ListRequest) Contexts ¶ added in v3.37.0
func (request ListRequest) Contexts(ctx context.Context) ListRequest
Context used for request. It may carry deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
func (ListRequest) Headers ¶ added in v3.37.0
func (request ListRequest) Headers(key string, value string) ListRequest
Headers add a new key-value pair to the ListRequest.Header. This is used to add custom headers.
func (ListRequest) ListRequest ¶ added in v3.37.0
func (request ListRequest) ListRequest() (*ResultList, error)
func (ListRequest) ListRequestWithEnv ¶ added in v3.37.0
func (request ListRequest) ListRequestWithEnv(env Environment) (*ResultList, error)
func (ListRequest) SetIdempotency ¶ added in v3.37.0
func (request ListRequest) SetIdempotency(idempotent bool) ListRequest
func (ListRequest) SetIdempotencyKey ¶ added in v3.37.0
func (request ListRequest) SetIdempotencyKey(idempotencyKey string) ListRequest
SetIdempotencyKey is used to add idempotency key.
func (ListRequest) SetSubDomain ¶ added in v3.37.0
func (request ListRequest) SetSubDomain(subDomain string) ListRequest
type ListRequestObj ¶ added in v3.37.0
type ListRequestObj struct {
Params *url.Values
Method string
Path string
Header map[string]string
Context context.Context `form:"-"`
JsonBody string
// contains filtered or unexported fields
}
ListRequestObj is the structure that contains the properties of list request data.
type Request ¶ added in v3.37.0
type Request = RequestObj
func SendJsonRequest ¶ added in v3.29.0
func (Request) AddParams ¶ added in v3.37.0
AddParams add a new key-value pair to the RequestObj.Params. This is used to add extra/custom_field params in the request data.
func (Request) Contexts ¶ added in v3.37.0
Context used for request. It may carry deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
func (Request) Headers ¶ added in v3.37.0
Headers add a new key-value pair to the RequestObj.Header . This is used to add custom headers .
func (Request) RequestWithEnv ¶ added in v3.37.0
func (request Request) RequestWithEnv(env Environment) (*Result, error)
func (Request) SetIdempotency ¶ added in v3.37.0
func (Request) SetIdempotencyKey ¶ added in v3.37.0
This is used to add idempotency key .
func (Request) SetSubDomain ¶ added in v3.37.0
type RequestObj ¶
type RequestObj struct {
Params *url.Values
Method string
Path string
Header map[string]string
Context context.Context `form:"-"`
JsonBody string
// contains filtered or unexported fields
}
RequestObj is the structure that contains the properties of regular request data.
type ResponseMeta ¶ added in v3.5.0
type Result ¶
type Result struct {
Subscription *subscription.Subscription `json:"subscription,omitempty"`
ContractTerm *contractterm.ContractTerm `json:"contract_term,omitempty"`
Discount *discount.Discount `json:"discount,omitempty"`
AdvanceInvoiceSchedule *advanceinvoiceschedule.AdvanceInvoiceSchedule `json:"advance_invoice_schedule,omitempty"`
Customer *customer.Customer `json:"customer,omitempty"`
Hierarchy *hierarchy.Hierarchy `json:"hierarchy,omitempty"`
Contact *contact.Contact `json:"contact,omitempty"`
BusinessEntityTransfer *businessentitytransfer.BusinessEntityTransfer `json:"business_entity_transfer,omitempty"`
Token *token.Token `json:"token,omitempty"`
PaymentSource *paymentsource.PaymentSource `json:"payment_source,omitempty"`
ThirdPartyPaymentMethod *thirdpartypaymentmethod.ThirdPartyPaymentMethod `json:"third_party_payment_method,omitempty"`
VirtualBankAccount *virtualbankaccount.VirtualBankAccount `json:"virtual_bank_account,omitempty"`
Card *card.Card `json:"card,omitempty"`
PromotionalCredit *promotionalcredit.PromotionalCredit `json:"promotional_credit,omitempty"`
Invoice *invoice.Invoice `json:"invoice,omitempty"`
PaymentReferenceNumber *paymentreferencenumber.PaymentReferenceNumber `json:"payment_reference_number,omitempty"`
PaymentSchedule *paymentschedule.PaymentSchedule `json:"payment_schedule,omitempty"`
Einvoice *einvoice.Einvoice `json:"einvoice,omitempty"`
TaxWithheld *taxwithheld.TaxWithheld `json:"tax_withheld,omitempty"`
CreditNote *creditnote.CreditNote `json:"credit_note,omitempty"`
UnbilledCharge *unbilledcharge.UnbilledCharge `json:"unbilled_charge,omitempty"`
Order *order.Order `json:"order,omitempty"`
Gift *gift.Gift `json:"gift,omitempty"`
Transaction *transaction.Transaction `json:"transaction,omitempty"`
HostedPage *hostedpage.HostedPage `json:"hosted_page,omitempty"`
Estimate *estimate.Estimate `json:"estimate,omitempty"`
Quote *quote.Quote `json:"quote,omitempty"`
QuotedSubscription *quotedsubscription.QuotedSubscription `json:"quoted_subscription,omitempty"`
QuotedCharge *quotedcharge.QuotedCharge `json:"quoted_charge,omitempty"`
QuotedRamp *quotedramp.QuotedRamp `json:"quoted_ramp,omitempty"`
QuotedDeltaRamp *quoteddeltaramp.QuotedDeltaRamp `json:"quoted_delta_ramp,omitempty"`
BillingConfiguration *billingconfiguration.BillingConfiguration `json:"billing_configuration,omitempty"`
QuoteLineGroup *quotelinegroup.QuoteLineGroup `json:"quote_line_group,omitempty"`
Plan *plan.Plan `json:"plan,omitempty"`
Addon *addon.Addon `json:"addon,omitempty"`
Coupon *coupon.Coupon `json:"coupon,omitempty"`
CouponSet *couponset.CouponSet `json:"coupon_set,omitempty"`
CouponCode *couponcode.CouponCode `json:"coupon_code,omitempty"`
Address *address.Address `json:"address,omitempty"`
Usage *usage.Usage `json:"usage,omitempty"`
Event *event.Event `json:"event,omitempty"`
Comment *comment.Comment `json:"comment,omitempty"`
Download *download.Download `json:"download,omitempty"`
PortalSession *portalsession.PortalSession `json:"portal_session,omitempty"`
SiteMigrationDetail *sitemigrationdetail.SiteMigrationDetail `json:"site_migration_detail,omitempty"`
ResourceMigration *resourcemigration.ResourceMigration `json:"resource_migration,omitempty"`
TimeMachine *timemachine.TimeMachine `json:"time_machine,omitempty"`
Export *export.Export `json:"export,omitempty"`
PaymentIntent *paymentintent.PaymentIntent `json:"payment_intent,omitempty"`
GatewayErrorDetail *gatewayerrordetail.GatewayErrorDetail `json:"gateway_error_detail,omitempty"`
ItemFamily *itemfamily.ItemFamily `json:"item_family,omitempty"`
Item *item.Item `json:"item,omitempty"`
PriceVariant *pricevariant.PriceVariant `json:"price_variant,omitempty"`
Attribute *attribute.Attribute `json:"attribute,omitempty"`
ItemPrice *itemprice.ItemPrice `json:"item_price,omitempty"`
AttachedItem *attacheditem.AttachedItem `json:"attached_item,omitempty"`
DifferentialPrice *differentialprice.DifferentialPrice `json:"differential_price,omitempty"`
Configuration *configuration.Configuration `json:"configuration,omitempty"`
Feature *feature.Feature `json:"feature,omitempty"`
ImpactedSubscription *impactedsubscription.ImpactedSubscription `json:"impacted_subscription,omitempty"`
ImpactedItem *impacteditem.ImpactedItem `json:"impacted_item,omitempty"`
ImpactedItemPrice *impacteditemprice.ImpactedItemPrice `json:"impacted_item_price,omitempty"`
Metadata *metadata.Metadata `json:"metadata,omitempty"`
SubscriptionEntitlement *subscriptionentitlement.SubscriptionEntitlement `json:"subscription_entitlement,omitempty"`
CustomerEntitlement *customerentitlement.CustomerEntitlement `json:"customer_entitlement,omitempty"`
ItemEntitlement *itementitlement.ItemEntitlement `json:"item_entitlement,omitempty"`
Entitlement *entitlement.Entitlement `json:"entitlement,omitempty"`
InAppSubscription *inappsubscription.InAppSubscription `json:"in_app_subscription,omitempty"`
EntitlementOverride *entitlementoverride.EntitlementOverride `json:"entitlement_override,omitempty"`
BusinessEntity *businessentity.BusinessEntity `json:"business_entity,omitempty"`
Purchase *purchase.Purchase `json:"purchase,omitempty"`
PaymentVoucher *paymentvoucher.PaymentVoucher `json:"payment_voucher,omitempty"`
Currency *currency.Currency `json:"currency,omitempty"`
Ramp *ramp.Ramp `json:"ramp,omitempty"`
PaymentScheduleScheme *paymentschedulescheme.PaymentScheduleScheme `json:"payment_schedule_scheme,omitempty"`
PricingPageSession *pricingpagesession.PricingPageSession `json:"pricing_page_session,omitempty"`
OmnichannelSubscription *omnichannelsubscription.OmnichannelSubscription `json:"omnichannel_subscription,omitempty"`
OmnichannelTransaction *omnichanneltransaction.OmnichannelTransaction `json:"omnichannel_transaction,omitempty"`
OmnichannelSubscriptionItem *omnichannelsubscriptionitem.OmnichannelSubscriptionItem `json:"omnichannel_subscription_item,omitempty"`
RecordedPurchase *recordedpurchase.RecordedPurchase `json:"recorded_purchase,omitempty"`
OmnichannelOneTimeOrder *omnichannelonetimeorder.OmnichannelOneTimeOrder `json:"omnichannel_one_time_order,omitempty"`
OmnichannelOneTimeOrderItem *omnichannelonetimeorderitem.OmnichannelOneTimeOrderItem `json:"omnichannel_one_time_order_item,omitempty"`
Rule *rule.Rule `json:"rule,omitempty"`
UsageEvent *usageevent.UsageEvent `json:"usage_event,omitempty"`
OmnichannelSubscriptionItemScheduledChange *omnichannelsubscriptionitemscheduledchange.OmnichannelSubscriptionItemScheduledChange `json:"omnichannel_subscription_item_scheduled_change,omitempty"`
UsageFile *usagefile.UsageFile `json:"usage_file,omitempty"`
PersonalizedOffer *personalizedoffer.PersonalizedOffer `json:"personalized_offer,omitempty"`
Brand *brand.Brand `json:"brand,omitempty"`
OfferFulfillment *offerfulfillment.OfferFulfillment `json:"offer_fulfillment,omitempty"`
OfferEvent *offerevent.OfferEvent `json:"offer_event,omitempty"`
WebhookEndpoint *webhookendpoint.WebhookEndpoint `json:"webhook_endpoint,omitempty"`
ImpactedCustomer *impactedcustomer.ImpactedCustomer `json:"impacted_customer,omitempty"`
SubscriptionEntitlementsUpdatedDetail *subscriptionentitlementsupdateddetail.SubscriptionEntitlementsUpdatedDetail `json:"subscription_entitlements_updated_detail,omitempty"`
SubscriptionEntitlementsCreatedDetail *subscriptionentitlementscreateddetail.SubscriptionEntitlementsCreatedDetail `json:"subscription_entitlements_created_detail,omitempty"`
AdvanceInvoiceSchedules []*advanceinvoiceschedule.AdvanceInvoiceSchedule `json:"advance_invoice_schedules,omitempty"`
Hierarchies []*hierarchy.Hierarchy `json:"hierarchies,omitempty"`
Invoices []*invoice.Invoice `json:"invoices,omitempty"`
PaymentSchedules []*paymentschedule.PaymentSchedule `json:"payment_schedules,omitempty"`
CreditNotes []*creditnote.CreditNote `json:"credit_notes,omitempty"`
UnbilledCharges []*unbilledcharge.UnbilledCharge `json:"unbilled_charges,omitempty"`
Downloads []*download.Download `json:"downloads,omitempty"`
Configurations []*configuration.Configuration `json:"configurations,omitempty"`
InAppSubscriptions []*inappsubscription.InAppSubscription `json:"in_app_subscriptions,omitempty"`
PersonalizedOffers []*personalizedoffer.PersonalizedOffer `json:"personalized_offers,omitempty"`
FailedEvents interface{} `json:"failed_events,omitempty"`
ExpiresAt interface{} `json:"expires_at,omitempty"`
BatchId interface{} `json:"batch_id,omitempty"`
Success interface{} `json:"success,omitempty"`
ScheduledAt interface{} `json:"scheduled_at,omitempty"`
List interface{} `json:"list,omitempty"`
// contains filtered or unexported fields
}
func (*Result) GetHttpStatusCode ¶ added in v3.29.0
func (*Result) GetResponseHeaders ¶ added in v3.5.0
func (*Result) IsIdempotencyReplayed ¶ added in v3.5.0
type ResultList ¶
type ResultList struct {
List []*Result `json:"list"`
NextOffset string `json:"next_offset"`
// contains filtered or unexported fields
}
func (*ResultList) GetHttpStatusCode ¶ added in v3.29.0
func (rl *ResultList) GetHttpStatusCode() int
func (*ResultList) GetResponseHeaders ¶ added in v3.5.0
func (rl *ResultList) GetResponseHeaders() http.Header