# README

go-utils Http

The go-utils Http package provides handy methods to use api end points using http protocol.

Installation

To use the log package you must import the package.

import "github.com/eliona-smart-building-assistant/go-utils/http"

Usage

After installation, you can read payload from http end points.

import "github.com/eliona-smart-building-assistant/go-utils/http"

For example, you can make a request and read current weather conditions from this endpoint.

payload, err := http.Read(http.NewRequest("https://weatherdbi.herokuapp.com/data/weather/winterthur"), 10, true)
var result map[string]interface{}
_ = json.Unmarshal(payload, &result)
fmt.Printf(result["currentConditions"].(map[string]interface{})["comment"].(string))

# Functions

Do return the payload returned from the request.
DoWithStatusCode return the body and the code.
ListenApiWithOs starts an API server and listen for API requests.
ListenWebSocket on a web socket connection and returns typed data.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewPostRequest creates a new request for the given url and the body as payload.
NewPostRequestWithApiKey creates a new request for the given url.
NewPostRequestWithBearer creates a new request for the given url.
No description provided by the author
NewPutRequest creates a new request for the given url and the body as payload.
NewPutRequestWithApiKey creates a new request for the given url.
NewPutRequestWithBearer creates a new request for the given url.
NewRequest creates a new request for the given url.
NewRequestWithApiKey creates a new request for the given url.
NewRequestWithBearer creates a new request for the given url.
No description provided by the author
NewWebSocketConnectionWithApiKey creates a connection to a web socket.
Read returns the response data converted to a corresponding structure.
ReadWebSocket reads one message from a web socket connection and returns typed data.
ReadWithStatusCode returns the response data converted to a corresponding structure.

# Structs

No description provided by the author