{"modulePath":"github.com/devaccuracy/ledgerforge","version":"v1.0.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package request\n\n## Functions\n\n```go\nfunc BasicAuth(username, password string) string\n```\nBasicAuth generates a basic HTTP authentication string by encoding the provided username and password. The string is base64-encoded in the format \"username:password\".\n\nParameters: - username string: The username for basic authentication. - password string: The password for basic authentication.\n\nReturns: - string: A base64-encoded string in the format \"Basic \\\u003cbase64-encoded-credentials\u003e\".\n\n```go\nfunc Call(req *http.Request, response interface{}) (*http.Response, error)\n```\nCall makes an HTTP request using the provided request object and decodes the response into the specified structure. It automatically sets the request Content-Type to application/json and decodes the JSON response body into the provided response interface.\n\nParameters: - req \\*http.Request: The prepared HTTP request to send. - response interface{}: The target structure to hold the decoded JSON response.\n\nReturns: - \\*http.Response: The raw HTTP response object. - error: An error if the HTTP request or JSON decoding fails.\n\n```go\nfunc ToJsonReq(payload interface{}) (*bytes.Buffer, error)\n```\nToJsonReq converts a Go object to a JSON-encoded HTTP request payload. It serializes the provided payload to JSON format and wraps it in a buffer for sending in HTTP requests.\n\nParameters: - payload interface{}: The data structure to be serialized into JSON.\n\nReturns: - \\*bytes.Buffer: The JSON-encoded payload wrapped in a bytes buffer, ready to be sent in a request. - error: An error if the JSON marshalling process fails.\n\n","path":"github.com/devaccuracy/ledgerforge/internal/request","name":"request","synopsis":"","isRedistributable":true}
