kennycyb

package module
v3.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 26 Imported by: 0

README

Xendit PHP SDK

Xendit Go SDK

The official Xendit Go SDK provides a simple and convenient way to call Xendit's REST API in applications written in Go.

  • Package version: 3.0.0-beta.2

Getting Started

Installation

Install xendit-go with:

go get github.com/kennycyb/xendit-go/v3

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

import kennycyb "github.com/kennycyb/xendit-go/v3"

To use a proxy, set the environment variable HTTP_PROXY:

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

Authorization

The SDK needs to be instantiated using your secret API key obtained from the Xendit Dashboard. You can sign up for a free Dashboard account here.

xnd := xendit.NewClient("API-KEY")

Documentation

Find detailed API infomration and examples for each of our product's by clicking the links below,

All URIs are relative to https://api.xendit.co. For more information about our API, please refer to https://developers.xendit.co/.

Further Reading

Documentation

Overview

Code generated by Xendit OpenAPI Generator; DO NOT EDIT.

Code generated by OpenAPI Generator; DO NOT EDIT.

Code generated by OpenAPI Generator; DO NOT EDIT.

Package xendit provides the binding for Xendit APIs.

Index

Constants

This section is empty.

Variables

View Source
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

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {

	// API Services
	BalanceAndTransactionApi balanceandtransaction.BalanceAndTransactionApi
	InvoiceApi               invoice.InvoiceApi
	PaymentMethodApi         paymentmethod.PaymentMethodApi
	PaymentRequestApi        paymentrequest.PaymentRequestApi
	PayoutApi                payout.PayoutApi
	RefundApi                refund.RefundApi
	// contains filtered or unexported fields
}

APIClient manages communication with XENDIT API In most cases there should be only one, shared, APIClient.

func NewClient

func NewClient(apiKey string) *APIClient

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) CallAPI

func (c *APIClient) CallAPI(request *http.Request) (*http.Response, error)

callAPI do the request.

func (*APIClient) Decode

func (c *APIClient) Decode(v interface{}, b []byte, contentType string) (err error)

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

type APIKey struct {
	Key    string
	Prefix string
}

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) ServerURL

func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error)

ServerURL returns URL based on server settings

func (*Configuration) ServerURLWithContext

func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error)

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

func (ServerConfigurations) URL

func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error)

URL formats template on a index using given variables

type ServerVariable

type ServerVariable struct {
	Description  string
	DefaultValue string
	EnumValues   []string
}

ServerVariable stores the information about a server variable

Directories

Path Synopsis
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.
Code generated by OpenAPI Generator; DO NOT EDIT.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL