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 WithHTTPClient(c *http.Client)
- type CBResponse
- type Environment
- type Error
- type ErrorType
- type RequestObj
- func (request RequestObj) AddParams(key string, value interface{}) RequestObj
- func (request RequestObj) Contexts(ctx context.Context) RequestObj
- func (request RequestObj) Headers(key string, value string) RequestObj
- func (request RequestObj) ListRequest() (*ResultList, error)
- func (request RequestObj) ListRequestWithEnv(env Environment) (*ResultList, error)
- func (request RequestObj) Request() (*Result, error)
- func (request RequestObj) RequestWithEnv(env Environment) (*Result, error)
- func (request RequestObj) SetIdempotencyKey(idempotencyKey string) RequestObj
- type ResponseMeta
- type Result
- type ResultList
Constants ¶
const ( APIVersion = "v2" Charset = "UTF-8" )
const ( IdempotencyHeader = "chargebee-idempotency-key" IdempotencyReplayHeader = "Chargebee-Idempotency-Replayed" )
const Version string = "2.27.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 WithHTTPClient ¶
Types ¶
type CBResponse ¶
type CBResponse struct { Body []byte ResponseMeta }
type Environment ¶
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:"_"` }
Error is the Response returned when a call is unsuccessful
type RequestObj ¶
type RequestObj struct { Params *url.Values Method string Path string Header map[string]string Context context.Context `form:"-"` }
RequestObj is the structure that contains the properties of any request data.
func Send ¶
func Send(method string, path string, params interface{}) RequestObj
Send prepares a RequestObj for Request operation.
func SendList ¶
func SendList(method string, path string, params interface{}) RequestObj
SendList prepares a RequestObj for ListRequest operation.
func (RequestObj) AddParams ¶
func (request RequestObj) AddParams(key string, value interface{}) RequestObj
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 (RequestObj) Contexts ¶
func (request RequestObj) Contexts(ctx context.Context) RequestObj
Context used for request. It may carry deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
func (RequestObj) Headers ¶
func (request RequestObj) Headers(key string, value string) RequestObj
Headers add a new key-value pair to the RequestObj.Header . This is used to add custom headers .
func (RequestObj) ListRequest ¶
func (request RequestObj) ListRequest() (*ResultList, error)
func (RequestObj) ListRequestWithEnv ¶
func (request RequestObj) ListRequestWithEnv(env Environment) (*ResultList, error)
func (RequestObj) Request ¶
func (request RequestObj) Request() (*Result, error)
func (RequestObj) RequestWithEnv ¶
func (request RequestObj) RequestWithEnv(env Environment) (*Result, error)
func (RequestObj) SetIdempotencyKey ¶
func (request RequestObj) SetIdempotencyKey(idempotencyKey string) RequestObj
This is used to add idempotency key .
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"` 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"` 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"` 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"` ItemFamily *itemfamily.ItemFamily `json:"item_family,omitempty"` Item *item.Item `json:"item,omitempty"` ItemPrice *itemprice.ItemPrice `json:"item_price,omitempty"` AttachedItem *attacheditem.AttachedItem `json:"attached_item,omitempty"` DifferentialPrice *differentialprice.DifferentialPrice `json:"differential_price,omitempty"` Feature *feature.Feature `json:"feature,omitempty"` ImpactedSubscription *impactedsubscription.ImpactedSubscription `json:"impacted_subscription,omitempty"` ImpactedItem *impacteditem.ImpactedItem `json:"impacted_item,omitempty"` SubscriptionEntitlement *subscriptionentitlement.SubscriptionEntitlement `json:"subscription_entitlement,omitempty"` ItemEntitlement *itementitlement.ItemEntitlement `json:"item_entitlement,omitempty"` InAppSubscription *inappsubscription.InAppSubscription `json:"in_app_subscription,omitempty"` EntitlementOverride *entitlementoverride.EntitlementOverride `json:"entitlement_override,omitempty"` Purchase *purchase.Purchase `json:"purchase,omitempty"` PaymentVoucher *paymentvoucher.PaymentVoucher `json:"payment_voucher,omitempty"` UnbilledCharges []*unbilledcharge.UnbilledCharge `json:"unbilled_charges,omitempty"` CreditNotes []*creditnote.CreditNote `json:"credit_notes,omitempty"` AdvanceInvoiceSchedules []*advanceinvoiceschedule.AdvanceInvoiceSchedule `json:"advance_invoice_schedules,omitempty"` Hierarchies []*hierarchy.Hierarchy `json:"hierarchies,omitempty"` Downloads []*download.Download `json:"downloads,omitempty"` Invoices []*invoice.Invoice `json:"invoices,omitempty"` DifferentialPrices []*differentialprice.DifferentialPrice `json:"differential_prices,omitempty"` InAppSubscriptions []*inappsubscription.InAppSubscription `json:"in_app_subscriptions,omitempty"` // contains filtered or unexported fields }
func (*Result) GetResponseHeaders ¶
func (*Result) IsIdempotencyReplayed ¶
type ResultList ¶
type ResultList struct { List []*Result `json:"list"` NextOffset string `json:"next_offset"` // contains filtered or unexported fields }
func (*ResultList) GetResponseHeaders ¶
func (rl *ResultList) GetResponseHeaders() http.Header