Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
APIResponse repsent the API response to return from Pokemon endpoints. Its fields are intended for JSON marshalling and unmarshalling purpose.
func NewAPIResponse ¶
func NewAPIResponse(name, description string) *APIResponse
func (*APIResponse) SendResponseTO ¶ added in v0.0.2
func (ar *APIResponse) SendResponseTO(w http.ResponseWriter)
SendResponseTO sends the APIResponse contents as a HTTP response in the JSON form with the appropriate HTTP status code.
type ErrorResponse ¶ added in v0.0.2
ErrorResponse repsent the API error to return from Pokemon endpoints. Its fields are intended for JSON marshalling and unmarshalling purpose.
func (*ErrorResponse) WriteErrorTo ¶ added in v0.0.2
func (er *ErrorResponse) WriteErrorTo(w http.ResponseWriter)
ErrorResponse sends the ErrorResponse contents as a HTTP response in the JSON form with the appropriate HTTP status code.
type ServiceResponse ¶
ServiceResponse to represent the response from the different services integrations
func NewError ¶
func NewError(err error) *ServiceResponse
NewError creates the ServiceResponse with error value to represent only an error
func NewErrorCode ¶
func NewErrorCode(code int, err error) *ServiceResponse
NewErrorCode creates the ServiceResponse with error value and code to represent only an error message and the error code from service integration responses.
func NewSuccess ¶
func NewSuccess(content string) *ServiceResponse
NewSuccess creates the ServiceResponse to to represnet the response body from service integration response.
func (*ServiceResponse) ToErrorResponse ¶ added in v0.0.2
func (sr *ServiceResponse) ToErrorResponse() *ErrorResponse
ToErrorResponse create the ErrorResponse type to from the error fields of ServiceResponse. The ErrorResponse is used to represent the API error response.