apihelper_pkg

package
v0.0.0-...-bfb5fe6 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendUrlWithQueryParameters

func AppendUrlWithQueryParameters(queryBuilder string, parameters map[string]interface{}) (string, error)

*

  • Appends the given set of parameters to the given query string
  • @param string queryBuilder The query url string to append the parameters
  • @param map parameters The parameters to append
  • @return void

func AppendUrlWithTemplateParameters

func AppendUrlWithTemplateParameters(queryBuilder string, parameters map[string]interface{}) (string, error)

func CleanUrl

func CleanUrl(url string) (string, error)

*

  • Validates and processes the given Url
  • @param url The given Url to process
  • @return Pre-processed Url as string

func ToString

func ToString(data interface{}, dvl string) string

*

  • Replaces template parameters in the given url
  • @param queryBuilder The query string builder to replace the template parameters
  • @param parameters The parameters to replace in the url
  • @return Returns url replaced with template values

Types

type APIError

type APIError struct {
	ResponseCode int    //The HTTP response code from the API request
	Reason       string //The reason for throwing exception
	Response     []byte
}

APIError structure for custom error handling in API invocation

func NewAPIError

func NewAPIError(reason string, code int, res []byte) *APIError

NewAPIError implements initialization constructor @param string reason The reason for throwing exception @param int code The HTTP response code from the API request @return new APIException object

func (*APIError) Error

func (e *APIError) Error() string

Error method implements error interface

Jump to

Keyboard shortcuts

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