Documentation ¶
Index ¶
- Constants
- Variables
- func HasTokens(filename, section string) bool
- func LoadRole(filename string, section string) (string, error)
- func SaveRole(directory, filename, section string, roleUUID string) error
- func SaveTokens(directory, filename, section string, tokens Ktokens) error
- type Client
- func (k *Client) ClearClient()
- func (k *Client) Delete(targetURL string)
- func (k *Client) End(callback ...func(response Response, body string, errs []error)) (Response, string, []error)
- func (k *Client) EndBytes(callback ...func(response Response, body []byte, errs []error)) (Response, []byte, []error)
- func (k *Client) Get(targetURL string)
- func (k *Client) Head(targetURL string)
- func (k *Client) NewRequest() (*http.Request, error)
- func (k *Client) Param(key string, value string)
- func (k *Client) Patch(targetURL string)
- func (k *Client) Post(targetURL string)
- func (k *Client) ProxyRequest(r *http.Request)
- func (k *Client) Put(targetURL string)
- func (k *Client) Query(content interface{})
- func (k *Client) Send(content interface{}) *Client
- func (k *Client) SendSlice(content []interface{}) *Client
- func (k *Client) SendString(content string) *Client
- func (k *Client) SendStruct(content interface{}) *Client
- func (k *Client) SetBasicAuth(username string, password string)
- func (k *Client) SetDebug(enable bool)
- func (k *Client) SetHeader(param string, value string)
- func (k *Client) SetLogger(logger *log.Logger)
- func (k *Client) SignRequest(enable bool)
- func (k *Client) TLSClientConfig(config *tls.Config)
- type Endpoints
- type Ktokens
- type Request
- type Response
Constants ¶
const ( POST = "POST" GET = "GET" HEAD = "HEAD" PUT = "PUT" DELETE = "DELETE" PATCH = "PATCH" )
Constant Methods
Variables ¶
var ( Version string BuildTime string )
Functions ¶
func SaveTokens ¶
SaveTokens writes tokens to a file
Types ¶
type Client ¶
type Client struct { BasicAuth struct{ UserName, Password string } BounceToRawString bool Client *http.Client Data map[string]interface{} Debug bool EndPoint *Endpoints Errors []error FormData url.Values Header map[string]string Logger *log.Logger Method string ProxyRequestData *http.Request QueryData url.Values RawString string RoleUUID string Sign bool SliceData []interface{} TargetType string Tokens *Ktokens Transport *http.Transport URL string }
Client declartation
func (*Client) ClearClient ¶
func (k *Client) ClearClient()
ClearClient clears data for a new request
func (*Client) End ¶
func (k *Client) End(callback ...func(response Response, body string, errs []error)) (Response, string, []error)
End or EndBytes() must be called to execute the call otherwise it won't do a thing.
func (*Client) EndBytes ¶
func (k *Client) EndBytes(callback ...func(response Response, body []byte, errs []error)) (Response, []byte, []error)
EndBytes should be used when you want the body as bytes.
func (*Client) NewRequest ¶
NewRequest sets the appropriate header and appropriate request content
func (*Client) ProxyRequest ¶
ProxyRequest set ProxyRequest Headers
func (*Client) Query ¶
func (k *Client) Query(content interface{})
Query fucntion forms a query-string in the url of GET method or body of POST method. Usage Example:
kumoru.New(). Get("/applications/"). Query(`{ query: 'myapp' }`). Query(`{ limit: '5' }`). End()
kumoru.New(). Get("/applications/"). Query("query=myapp&limit=5"). End()
kumoru.New(). Get("/applications/"). Query("query=myapp&limit=5"). Query(`{ sort: 'asc' }`). End()
func (*Client) SendString ¶
SendString sends the information as a raw string
func (*Client) SendStruct ¶
SendStruct converts a struct to parameters
func (*Client) SetBasicAuth ¶
SetBasicAuth user name and password
func (*Client) SetHeader ¶
SetHeader headers kumoru.New(). POST("/application/B8658129-701E-432C-BD80-5D0F464EC932"). SetHeader("Accept", "application/x-www-form-urlencoded")
func (*Client) SignRequest ¶
SignRequest enables kumoru's authentication
func (*Client) TLSClientConfig ¶
TLSClientConfig set TLS configuration
type Endpoints ¶
Endpoints struct for all api services
func LoadEndpoints ¶
LoadEndpoints returns and Endpoints struct by reading them from a file or from defaults