api

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildURL

func BuildURL(subDomain, path string) (url string)

BuildURL builds URL of Qiita API v2.

Types

type Client

type Client struct {
	BuildURL func(string, string) string
	// contains filtered or unexported fields
}

Client is HTTP client accessing to the Qiita API v2.

func NewClient

func NewClient(buildURL func(string, string) string, info info.Info) (c Client)

NewClient makes a Client. Client will access to URL made by buildURL.

func (*Client) DebugMode

func (c *Client) DebugMode(debugMode bool)

DebugMode sets debugMode to Client. When debugMode is true, qiitactl outputs the logs (e.g., HTTP request and response).

func (Client) Delete

func (c Client) Delete(subDomain string, path string, data interface{}) (body []byte, header http.Header, err error)

Delete send DELETE request with data body to the URL built with subDomain and path.

func (Client) Get

func (c Client) Get(subDomain string, path string, v *url.Values) (body []byte, header http.Header, err error)

Get send GET request to the URL built with subDomain and path.

func (Client) Options

func (c Client) Options(subDomain string, path string, data interface{}) (body []byte, header http.Header, err error)

Options send OPTIONS request with data body to the URL built with subDomain and path.

func (Client) Patch

func (c Client) Patch(subDomain string, path string, data interface{}) (body []byte, header http.Header, err error)

Patch send PATCH request with data body to the URL built with subDomain and path.

func (Client) Post

func (c Client) Post(subDomain string, path string, data interface{}) (body []byte, header http.Header, err error)

Post send POST request with data body to the URL built with subDomain and path.

type EmptyTokenError

type EmptyTokenError struct{}

EmptyTokenError occurs when request is sent without token.

func (EmptyTokenError) Error

func (err EmptyTokenError) Error() (msg string)

type ResponseError

type ResponseError struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

ResponseError occurs when the response status is failed and the body is JSON.

func (ResponseError) Error

func (err ResponseError) Error() (msg string)

type StatusError

type StatusError struct {
	Code    int
	Message string
}

StatusError occurs when the response status is failed and the body isn't JSON.

func (StatusError) Error

func (err StatusError) Error() (msg string)

type WrongTokenError

type WrongTokenError struct{}

WrongTokenError occurs when the sent token is invalid.

func (WrongTokenError) Error

func (err WrongTokenError) Error() (msg string)

Jump to

Keyboard shortcuts

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