Documentation ¶
Overview ¶
Package xendit provides the binding for Xendit APIs.
Index ¶
- Variables
- func CacheExpires(r *http.Response) time.Time
- type APIClient
- func (c *APIClient) CallAPI(request *http.Request) (*http.Response, error)
- func (c *APIClient) Decode(v interface{}, b []byte, contentType string) (err error)
- func (c *APIClient) GetConfig() common.IConfiguration
- func (c *APIClient) PrepareRequest(ctx context.Context, path string, method string, postBody interface{}, ...) (localVarRequest *http.Request, err error)
- type APIKey
- type APIResponse
- type BasicAuth
- type Configuration
- type ServerConfiguration
- type ServerConfigurations
- type ServerVariable
Constants ¶
This section is empty.
Variables ¶
var ( // ContextServerIndex uses a server configuration from the index. ContextServerIndex = contextKey("serverIndex") // ContextOperationServerIndices uses a server configuration from the index mapping. ContextOperationServerIndices = contextKey("serverOperationIndices") // ContextServerVariables overrides a server configuration variables. ContextServerVariables = contextKey("serverVariables") // ContextOperationServerVariables overrides a server configuration variables using operation specific values. ContextOperationServerVariables = contextKey("serverOperationVariables") )
Functions ¶
Types ¶
type APIClient ¶
type APIClient struct { // API Services InvoiceApi invoice.InvoiceApi PaymentRequestApi paymentrequest.PaymentRequestApi PaymentMethodApi paymentmethod.PaymentMethodApi RefundApi refund.RefundApi BalanceApi balance.BalanceApi TransactionApi transaction.TransactionApi CustomerApi customer.CustomerApi PayoutApi payout.PayoutApi // contains filtered or unexported fields }
APIClient manages communication with XENDIT API In most cases there should be only one, shared, APIClient.
func NewClient ¶
NewClient creates a new Xendit SDK Client. The SDK needs to be instantiated using your secret API key obtained from the https://dashboard.xendit.co/settings/developers#api-keys. You can sign up for a free Dashboard account from https://dashboard.xendit.co/register.
func (*APIClient) GetConfig ¶
func (c *APIClient) GetConfig() common.IConfiguration
Allow modification of underlying config for alternate implementations and testing Caution: modifying the configuration while live can cause data races and potentially unwanted behavior
func (*APIClient) PrepareRequest ¶
func (c *APIClient) PrepareRequest( ctx context.Context, path string, method string, postBody interface{}, headerParams map[string]string, queryParams url.Values, formParams url.Values, formFiles []common.FormFile) (localVarRequest *http.Request, err error)
PrepareRequest build the request
type APIKey ¶
APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIResponse ¶
type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` // Operation is the name of the OpenAPI operation. Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. Payload []byte `json:"-"` }
APIResponse stores the API response returned by the server.
func NewAPIResponse ¶
func NewAPIResponse(r *http.Response) *APIResponse
NewAPIResponse returns a new APIResponse object.
func NewAPIResponseWithError ¶
func NewAPIResponseWithError(errorMessage string) *APIResponse
NewAPIResponseWithError returns a new APIResponse object with the provided error message.
type BasicAuth ¶
type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` }
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
type Configuration ¶
type Configuration struct { Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` Debug bool `json:"debug,omitempty"` Servers ServerConfigurations OperationServers map[string]ServerConfigurations HTTPClient *http.Client }
Configuration stores the configuration of the API client
var Default Configuration = *NewConfiguration()
func NewConfiguration ¶
func NewConfiguration() *Configuration
NewConfiguration returns a new Configuration object
func (*Configuration) AddDefaultHeader ¶
func (c *Configuration) AddDefaultHeader(key string, value string)
AddDefaultHeader adds a new HTTP header to the default header in the request
func (*Configuration) ServerURLWithContext ¶
ServerURLWithContext returns a new server URL given an endpoint
type ServerConfiguration ¶
type ServerConfiguration struct { URL string Description string Variables map[string]ServerVariable }
ServerConfiguration stores the information about a server
type ServerConfigurations ¶
type ServerConfigurations []ServerConfiguration
ServerConfigurations stores multiple ServerConfiguration items
type ServerVariable ¶
ServerVariable stores the information about a server variable