Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

marcsantiago/OX3-Go-API-Client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

42 Commits

Repository files navigation

openx

import "github.com/marcsantiago/OX3-Go-API-Client/openx"

  • Overview
  • Index
  • 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

openx.go

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 (*Client) Delete

func (c *Client) Delete(url string, data io.Reader) (*http.Response, error)

Delete creates a delete request

func (*Client) Get

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 (*Client) LogOff

func (c *Client) LogOff() (res *http.Response, err error)

LogOff sets the created session to an empty http.client

func (*Client) Options

func (c *Client) Options() (*http.Response, error)

Options is a wrapper for a GET request that has the /options endpoint already passed in

func (*Client) Post

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 (*Client) PostForm

func (c *Client) PostForm(url string, data url.Values) (*http.Response, error)

PostForm is a wrapper for the basic Go *http.client.PostForm

func (*Client) Put

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

About

Go wrapper for Openx3 API

Topics

Resources

Readme

License

MIT license

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages