import "github.com/marcsantiago/OX3-Go-API-Client/openx"
- Variables
- func CreateConfigFileTemplate(fileCreationPath string) string
- type Client
- func NewClient(creds Credentials, debug bool) (*Client, error)
- func NewClientFromFile(filePath string, debug bool) (*Client, error)
- func (c *Client) Delete(url string, data io.Reader) (*http.Response, error)
- func (c *Client) Get(url string, urlParms map[string]interface{}) (*http.Response, error)
- func (c *Client) LogOff() (res *http.Response, err error)
- func (c *Client) Options() (*http.Response, error)
- func (c *Client) Post(url string, data io.Reader) (*http.Response, error)
- func (c *Client) PostForm(url string, data url.Values) (*http.Response, error)
- func (c *Client) Put(url string, data io.Reader) (*http.Response, error)
- type Credentials
var (
// ErrParameter definitions
ErrParameter = errors.New("The value entered must be of type string, int, float64, or bool")
)
func CreateConfigFileTemplate(fileCreationPath string) string
CreateConfigFileTemplate creates a templated json file used in NewClientFromFile. Otherwise the file format for NewClientFromFile is
{
"domain": "enter domain",
"realm": "enter realm",
"consumer_key": "enter key",
"consumer_secrect": "enter secrect key",
"email": "enter email",
"password": "enter password"
}
the fileCreationPath is returned incase a path is needed
type Client struct {
// contains filtered or unexported fields
}
Client holds all the auth data and wraps calls around Go's *http.Client Concurrency is left up to the user
func NewClient(creds Credentials, debug bool) (*Client, error)
NewClient creates the basic Openx3 *Client via oauth1
func NewClientFromFile(filePath string, debug bool) (*Client, error)
NewClientFromFile parses a JSON file to grab your Openx creds
func (c *Client) Delete(url string, data io.Reader) (*http.Response, error)
Delete creates a delete request
func (c *Client) Get(url string, urlParms map[string]interface{}) (*http.Response, error)
Get is simailiar to the normal Go *http.client.Get, except string parameters can be passed in the url or the as a map[string]interface{}
func (c *Client) LogOff() (res *http.Response, err error)
LogOff sets the created session to an empty http.client
func (c *Client) Options() (*http.Response, error)
Options is a wrapper for a GET request that has the /options endpoint already passed in
func (c *Client) Post(url string, data io.Reader) (*http.Response, error)
Post is a wrapper for the basic Go *http.client.Post, however content type is automatically set to application/json
func (c *Client) PostForm(url string, data url.Values) (*http.Response, error)
PostForm is a wrapper for the basic Go *http.client.PostForm
func (c *Client) Put(url string, data io.Reader) (*http.Response, error)
Put creates a put request
type Credentials struct {
Domain string `json:"domain"`
Realm string `json:"realm"`
ConsumerKey string `json:"consumer_key"`
ConsumerSecrect string `json:"consumer_secrect"`
Email string `json:"email"`
Password string `json:"password"`
}
Credentials are to filled in order to auth into openx
Generated by godoc2md