Documentation ¶
Index ¶
- Variables
- type Config
- type Context
- type Mojoauth
- func (mojo Mojoauth) AddApiCredentialsToReqHeader(req *httprutils.Request)
- func (mojo Mojoauth) NewDeleteReq(path string, body ...interface{}) *httprutils.Request
- func (mojo Mojoauth) NewDeleteReqWithToken(path string, body interface{}, queries ...map[string]string) (*httprutils.Request, error)
- func (mojo Mojoauth) NewGetReq(path string, queries ...map[string]string) *httprutils.Request
- func (mojo Mojoauth) NewGetReqWithToken(path string, queries ...map[string]string) (*httprutils.Request, error)
- func (mojo Mojoauth) NewPostReq(path string, body interface{}, queries ...map[string]string) (*httprutils.Request, error)
- func (mojo Mojoauth) NewPostReqWithToken(path string, body interface{}, queries ...map[string]string) (*httprutils.Request, error)
- func (mojo Mojoauth) NewPutReq(path string, body interface{}, queries ...map[string]string) (*httprutils.Request, error)
- func (mojo Mojoauth) NewPutReqWithToken(path string, body interface{}, queries ...map[string]string) (*httprutils.Request, error)
- func (mojo Mojoauth) NormalizeApiKey(req *httprutils.Request)
Constants ¶
This section is empty.
Variables ¶
var JSONHeader = map[string]string{"content-Type": "application/json"}
var URLEncodedHeader = map[string]string{"content-Type": "application/x-www-form-urlencoded"}
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ApiKey string
}
Config struct contains MojoAuth credentials and is used when initalizing the MojoAuth API client struct
type Mojoauth ¶
MojoAuth struct holds context for intializing the MojoAuth client and the domain for API calls Domain can be changed after intialization
func NewMojoAuth ¶
NewMojoAuth initializes a new MojoAuth struct with a Config struct Config struct must contain the ApiKey and ApiSecret of your MojoAuth site Example:
cfg := lr.Config{ ApiKey: os.Getenv("APIKEY"), ApiSecret: os.Getenv("APISECRET"), } lrclient, _ := lr.NewMojoAuth(&cfg)
It also takes optional variadic arguments Some APIs require for an access token to be passed with Authorization Bearer header Initialize MojoAuth struct with a token passed in the variadic argument like so:
lrclient, _ := lr.NewMojoAuth(&cfg, map[string]string{"token": "9c3208ae-2848-4ac5-baef-41dd4103e263"})
func (Mojoauth) AddApiCredentialsToReqHeader ¶
func (mojo Mojoauth) AddApiCredentialsToReqHeader(req *httprutils.Request)
AddApiCredentialsToReqHeader removes the X-API-Key query parameter from a constructed request and add MojoAuth app credentials in the request headers
func (Mojoauth) NewDeleteReq ¶
func (mojo Mojoauth) NewDeleteReq(path string, body ...interface{}) *httprutils.Request
NewDeleteReq takes a uri, body, and optional queries to construct a DELETE request for a MojoAuth POST API endpoint
func (Mojoauth) NewDeleteReqWithToken ¶
func (mojo Mojoauth) NewDeleteReqWithToken(path string, body interface{}, queries ...map[string]string) (*httprutils.Request, error)
NewDeleteReqWithToken takes a uri and query parameters, then constructs a PUT request for MojoAuth API endpoints requiring access tokens being passed in Authorization Bearer header
func (Mojoauth) NewGetReq ¶
NewGetRequest takes a uri and query parameters, then constructs a GET request for a MojoAuth API endpoint
func (Mojoauth) NewGetReqWithToken ¶
func (mojo Mojoauth) NewGetReqWithToken(path string, queries ...map[string]string) (*httprutils.Request, error)
NewGetRequest takes a uri and query parameters, then constructs a GET request for MojoAuth API endpoints requiring access tokens being passed in Authorization Bearer header
func (Mojoauth) NewPostReq ¶
func (mojo Mojoauth) NewPostReq(path string, body interface{}, queries ...map[string]string) (*httprutils.Request, error)
NewPostReq takes a uri, body, and optional queries to construct a POST request for a MojoAuth POST API endpoint
func (Mojoauth) NewPostReqWithToken ¶
func (mojo Mojoauth) NewPostReqWithToken(path string, body interface{}, queries ...map[string]string) (*httprutils.Request, error)
NewPostReqWithToken takes a uri, body, and query parameters, then constructs the request for MojoAuth PUT API end points requiring access tokens being passed in Authorization Bearer header
func (Mojoauth) NewPutReq ¶
func (mojo Mojoauth) NewPutReq(path string, body interface{}, queries ...map[string]string) (*httprutils.Request, error)
NewPutReq takes a uri, body, and optional queries to construct a PUT request for a MojoAuth API endpoint
func (Mojoauth) NewPutReqWithToken ¶
func (mojo Mojoauth) NewPutReqWithToken(path string, body interface{}, queries ...map[string]string) (*httprutils.Request, error)
NewPutReqWithToken takes a uri and query parameters, then constructs a PUT request for MojoAuth API endpoints requiring access tokens being passed in Authorization Bearer header
func (Mojoauth) NormalizeApiKey ¶
func (mojo Mojoauth) NormalizeApiKey(req *httprutils.Request)
NormalizeApiKey normalizes the apikey parameter in queries for requests to be sent to MojoAuth endpoints that only accept "apikey"
Directories ¶
Path | Synopsis |
---|---|
The mojobody package holds the structs to be encoded as the body in POST and PUT calls These structs are meant to serve as convenient measures assisting API calls provided by the MojoAuth Go SDK All functions in this SDK takes interface{} as the body, but initiating your data in the appropriate struct and passing in place of the body when calling the SDK functions will ensure the parameters submitted are correctly formatted and named for the MojoAuth APIs The usage of the structs in this package is optional and provided for convenience only Majority of methods take map[string]string as body parameter as well.
|
The mojobody package holds the structs to be encoded as the body in POST and PUT calls These structs are meant to serve as convenient measures assisting API calls provided by the MojoAuth Go SDK All functions in this SDK takes interface{} as the body, but initiating your data in the appropriate struct and passing in place of the body when calling the SDK functions will ensure the parameters submitted are correctly formatted and named for the MojoAuth APIs The usage of the structs in this package is optional and provided for convenience only Majority of methods take map[string]string as body parameter as well. |