Documentation ¶
Index ¶
- type HttpClient
- func (h HttpClient) Delete(endpoint string) ServiceResponse
- func (h HttpClient) DeleteWith(endpoint string, params interface{}) ServiceResponse
- func (h HttpClient) Get(endpoint string) ServiceResponse
- func (h HttpClient) GetWith(endpoint string, params interface{}) ServiceResponse
- func (h HttpClient) Post(endpoint string) ServiceResponse
- func (h HttpClient) PostWith(endpoint string, params interface{}) ServiceResponse
- func (h HttpClient) Put(endpoint string) ServiceResponse
- func (h HttpClient) PutWith(endpoint string, params interface{}) ServiceResponse
- type ResponseType
- type ServiceResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpClient ¶
type HttpClient struct {
BaseUrl string
}
HttpClient is a struct who has BaseUrl property
func (HttpClient) Delete ¶
func (h HttpClient) Delete(endpoint string) ServiceResponse
Delete func returns a response with your data
func (HttpClient) DeleteWith ¶
func (h HttpClient) DeleteWith(endpoint string, params interface{}) ServiceResponse
DeleteWith func returns a response with your data
func (HttpClient) Get ¶
func (h HttpClient) Get(endpoint string) ServiceResponse
Get func returns a response with your data
func (HttpClient) GetWith ¶
func (h HttpClient) GetWith(endpoint string, params interface{}) ServiceResponse
GetWith func returns a response with your data
func (HttpClient) Post ¶
func (h HttpClient) Post(endpoint string) ServiceResponse
Post func returns a response with your data
func (HttpClient) PostWith ¶
func (h HttpClient) PostWith(endpoint string, params interface{}) ServiceResponse
PostWith func returns a response with your data
func (HttpClient) Put ¶
func (h HttpClient) Put(endpoint string) ServiceResponse
Put func returns a response with your data
func (HttpClient) PutWith ¶
func (h HttpClient) PutWith(endpoint string, params interface{}) ServiceResponse
PutWith func returns a response with your data
type ResponseType ¶
type ResponseType int
ResponseType is a enum who has Success, InternalError and ServerError properties
const ( // Success says the request is completed successfully Success ResponseType = 0 // InternalError says the request is completed with internal errors InternalError ResponseType = 1 // ServerError says the request is completed with server errors ServerError ResponseType = 2 )
func (ResponseType) Text ¶
func (r ResponseType) Text() string
Text func returns a string of ResponseType
type ServiceResponse ¶
type ServiceResponse struct { IsSuccess bool StatusCode ResponseType StatusText string Message string Data interface{} }
ServiceResponse is a struct who has IsSuccess, StatusCode and their text, Message and Data properties