util

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CredentialsViper *viper.Viper = viper.New()

CredentialsViper instance of viper

Functions

func GetCredetialsViper

func GetCredetialsViper() *viper.Viper

GetCredetialsViper instance

func GetEnv

func GetEnv(name string, defVal string) string

GetEnv loads value from env if exists with fallback to a provided default value

func GetURL

func GetURL() (*url.URL, error)

GetURL return api url

func InitCredentialsViper

func InitCredentialsViper()

InitCredentialsViper returns viper instance

func OpenURL added in v0.0.2

func OpenURL(url string) error

OpenURL opens a given url

func ValidateEmail

func ValidateEmail(email string) bool

ValidateEmail user input

func ValidateEmailFunc added in v0.0.2

func ValidateEmailFunc(input string) error

ValidateEmailFunc validates users input

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client serves as a wrapper for out client

func GetClient

func GetClient() *Client

GetClient provides a generic instance of http client

func (*Client) Delete

func (c *Client) Delete(path string, headers http.Header) (*http.Response, error)

Delete makes a HTTP DELETE request with provided URL

func (*Client) Get

func (c *Client) Get(path string, headers http.Header) (*http.Response, error)

Get makes a HTTP GET request to provided URL

func (*Client) Patch

func (c *Client) Patch(path string, body io.Reader, headers http.Header) (*http.Response, error)

Patch makes a HTTP PATCH request to provided URL and requestBody

func (*Client) Post

func (c *Client) Post(path string, body io.Reader) (*http.Response, error)

Post makes a HTTP POST request to provided URL and requestBody

func (*Client) Put

func (c *Client) Put(path string, body io.Reader, headers http.Header) (*http.Response, error)

Put makes a HTTP PUT request to provided URL and requestBody

Jump to

Keyboard shortcuts

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