Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) Infographic(id string) (*Infographic, error)
- func (c *Client) Infographics() ([]Infographic, error)
- func (c *Client) SignRequest(req *http.Request) error
- func (c *Client) Themes() ([]Theme, error)
- func (c *Client) UserInfographics(id string) ([]Infographic, error)
- type Infographic
- func (i *Infographic) HTMLReader(client *Client) (io.Reader, error)
- func (i *Infographic) MarshalJSON() ([]byte, error)
- func (i *Infographic) PDFReader(client *Client) (io.Reader, error)
- func (i *Infographic) PNGReader(client *Client) (io.Reader, error)
- func (i *Infographic) UnmarshalJSON(bytes []byte) error
- type Theme
Constants ¶
const (
// DefaultEndpoint is the default API endpoint for Infogram
DefaultEndpoint = "https://infogr.am/service/v1"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { HTTPClient *http.Client Endpoint string APIKey string APISecret string // contains filtered or unexported fields }
Client is used to interact with the Infogram API
func (*Client) Do ¶
Do performs the *http.Request and decodes the http.Response.Body into v and return the *http.Response. If v is an io.Writer it will copy the body to the writer.
func (*Client) Infographic ¶
func (c *Client) Infographic(id string) (*Infographic, error)
Infographics fetches a single infographic by identification number
func (*Client) Infographics ¶
func (c *Client) Infographics() ([]Infographic, error)
Infographics fetches the list of infographics
func (*Client) SignRequest ¶
SignRequest adds the `api_key` and `api_sig` query parameter in accordance with https://developers.infogr.am/rest/request-signing.html
func (*Client) UserInfographics ¶
func (c *Client) UserInfographics(id string) ([]Infographic, error)
UserInfographics fetches the list of infographics for the user's identification number
type Infographic ¶
type Infographic struct { Id string Title string Thumbnail *url.URL ThemeId int Published bool Modified time.Time URL *url.URL }
Infographic defines the type returned by the Infogram API
func (*Infographic) HTMLReader ¶
func (i *Infographic) HTMLReader(client *Client) (io.Reader, error)
HTMLReader returns an io.Reader of the Infographic in HTML format
func (*Infographic) MarshalJSON ¶
func (i *Infographic) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler
func (*Infographic) PDFReader ¶
func (i *Infographic) PDFReader(client *Client) (io.Reader, error)
PDFReader returns an io.Reader of the Infographic in PDF format
func (*Infographic) PNGReader ¶
func (i *Infographic) PNGReader(client *Client) (io.Reader, error)
PNGReader returns an io.Reader of the Infographic in PNG format
func (*Infographic) UnmarshalJSON ¶
func (i *Infographic) UnmarshalJSON(bytes []byte) error
UnmarshalJSON implements json.Unarshaler
type Theme ¶
Theme defines the type returned by the Infogram API
func (*Theme) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (*Theme) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler