internal

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL = "https://typetalk.com/api/"
	UserAgent      = "go-typetalk/" + version

	DefaultMediaType = "application/octet-stream"
)

Variables

This section is empty.

Functions

func AddQueries

func AddQueries(s string, opt interface{}) (string, error)

func CheckResponse

func CheckResponse(r *http.Response) error

func StructToValues

func StructToValues(data interface{}) (url.Values, error)

func TestFormValues

func TestFormValues(t *testing.T, r *http.Request, values Values)

func TestHeader

func TestHeader(t *testing.T, r *http.Request, header string, want string)

func TestMethod

func TestMethod(t *testing.T, r *http.Request, want string)

func TestQueryValues

func TestQueryValues(t *testing.T, r *http.Request, values Values)

Types

type ClientCore

type ClientCore struct {
	Client *http.Client

	BaseURL       *url.URL
	UserAgent     string
	TypetalkToken string
}

func (*ClientCore) Call

func (c *ClientCore) Call(ctx context.Context, method string, url string, body interface{}, v interface{}) (*shared.Response, error)

func (*ClientCore) Delete

func (c *ClientCore) Delete(ctx context.Context, url string, v interface{}) (*shared.Response, error)

func (*ClientCore) Do

func (c *ClientCore) Do(ctx context.Context, req *http.Request, v interface{}) (*shared.Response, error)

func (*ClientCore) Get

func (c *ClientCore) Get(ctx context.Context, url string, v interface{}) (*shared.Response, error)

func (*ClientCore) NewMultipartRequest

func (c *ClientCore) NewMultipartRequest(urlStr string, values map[string]io.Reader) (*http.Request, error)

func (*ClientCore) NewRequest

func (c *ClientCore) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

func (*ClientCore) NewUploadRequest

func (c *ClientCore) NewUploadRequest(urlStr string, reader io.Reader, size int64, mediaType string) (*http.Request, error)

func (*ClientCore) Post

func (c *ClientCore) Post(ctx context.Context, url string, body interface{}, v interface{}) (*shared.Response, error)

func (*ClientCore) Put

func (c *ClientCore) Put(ctx context.Context, url string, body interface{}, v interface{}) (*shared.Response, error)

type Values

type Values map[string]interface{}

Jump to

Keyboard shortcuts

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