apitool

package
v0.0.0-...-d933f62 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Week = time.Hour * 24 * 7

Week define the amount of time in a week (time.Hour * 24 * 7)

Variables

This section is empty.

Functions

func DefaultCORSConfig

func DefaultCORSConfig() cors.Config

DefaultCORSConfig Generate CORS config for router

func ExtractQueryParams

func ExtractQueryParams(queryParams map[string]interface{}) (query string, args []interface{})

ExtractQueryParams format arguments for gorm from a map[string]interface{}

func HttpRequestHandler

func HttpRequestHandler(requestHeader RequestHeader, requestBody interface{}, responseDTO interface{}) (*http.Response, apihelper.ApiErrors)

HttpRequestHandler is a handler for easy http requests

func HttpRequestHandlerForUnitTesting

func HttpRequestHandlerForUnitTesting(t *testing.T, requestHeader RequestHeader, requestBody interface{}, responseDTO interface{}) (*http.Response, apihelper.ApiErrors)

HttpRequestHandlerForUnitTesting is the same as HttpRequestHandler but add logging for tests

func WaitForServerToStart

func WaitForServerToStart(url string) bool

WaitForServerToStart return true only when API is ready

Types

type ChatfuelError

type ChatfuelError struct {
	SetAttributes apihelper.Error `json:"set_attributes"`
}

ChatfuelError define the response body to return in case of error for requests made from Chatfuel

func HttpRequestHandlerForChatfuelUnitTesting

func HttpRequestHandlerForChatfuelUnitTesting(t *testing.T, requestHeader RequestHeader, requestBody interface{}, responseDTO interface{}) (*http.Response, ChatfuelError)

HttpRequestHandlerForChatfuelUnitTesting is the same as HttpRequestHandler but add logging for tests

type RequestHeader

type RequestHeader struct {
	URL           string
	Method        string
	ContentType   string
	Authorization string
}

RequestHeader is the object to send to the HttpRequestHandlers

Jump to

Keyboard shortcuts

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