Documentation ¶
Index ¶
Constants ¶
View Source
const ( ErrorCantFind = "CANT_FIND_SERVICE" ErrorRequestCreation = "CANT_CREATE_REQUEST" ErrorRequestError = "ERROR_MAKING_REQUEST" ErrorDecodingError = "ERROR_DECODING_ERROR" ErrorDecodingResponse = "ERROR_DECODING_RESPONSE" ErrorMarshallingObject = "ERROR_MARSHALLING_OBJECT" ErrorURL = "ERROR_URL" )
Error codes
Variables ¶
This section is empty.
Functions ¶
func ObjectToJSONReader ¶
ObjectToJSONReader will v to a io.Reader of the JSON representation of v
func PrefixRoute ¶
func PrefixRoute(serviceName string, pathPrefix string, appendServiceNameToRoute bool, route string) string
PrefixRoute is a simple helper function to build the route for service to service communicationfunc PrefixRoute(pathPrefix string, appendServiceNameToRoute bool, route string) string {
Types ¶
type BaseClient ¶
type BaseClient interface { // Do does the request and parses the body into the response provider if in the 2xx range, otherwise parses it into a glitch.DataError Do(ctx context.Context, method string, slug string, query url.Values, headers http.Header, body io.Reader, response interface{}) glitch.DataError // MakeRequest does the request and returns the status, body, and any error // This should be used only if the api doesn't return glitch.DataErrors MakeRequest(ctx context.Context, method string, slug string, query url.Values, headers http.Header, body io.Reader) (int, []byte, glitch.DataError) }
BaseClient can do requests
func NewBaseClient ¶
func NewBaseClient(finder ServiceFinder, serviceName string, useTLS bool, timeout time.Duration, tlsConfig *tls.Config) BaseClient
NewBaseClient creates a new BaseClient
type ServiceFinder ¶
ServiceFinder can find a service's base URL
Directories ¶
Path | Synopsis |
---|---|
Package clientmock is a generated GoMock package.
|
Package clientmock is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.