-
Notifications
You must be signed in to change notification settings - Fork 59
/
api.go
62 lines (51 loc) · 1.62 KB
/
api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) 2012-2013 Jason McVetta. This is Free Software, released
// under the terms of the GPL v3. See http://www.gnu.org/copyleft/gpl.html for
// details. Resist intellectual serfdom - the ownership of ideas is akin to
// slavery.
package napping
/*
This module implements the Napping API.
*/
import (
"net/url"
)
// Send composes and sends and HTTP request.
func Send(r *Request) (*Response, error) {
s := Session{}
return s.Send(r)
}
// Get sends a GET request.
func Get(url string, p *url.Values, result, errMsg interface{}) (*Response, error) {
s := Session{}
return s.Get(url, p, result, errMsg)
}
// Options sends an OPTIONS request.
func Options(url string, result, errMsg interface{}) (*Response, error) {
s := Session{}
return s.Options(url, result, errMsg)
}
// Head sends a HEAD request.
func Head(url string, result, errMsg interface{}) (*Response, error) {
s := Session{}
return s.Head(url, result, errMsg)
}
// Post sends a POST request.
func Post(url string, payload, result, errMsg interface{}) (*Response, error) {
s := Session{}
return s.Post(url, payload, result, errMsg)
}
// Put sends a PUT request.
func Put(url string, payload, result, errMsg interface{}) (*Response, error) {
s := Session{}
return s.Put(url, payload, result, errMsg)
}
// Patch sends a PATCH request.
func Patch(url string, payload, result, errMsg interface{}) (*Response, error) {
s := Session{}
return s.Patch(url, payload, result, errMsg)
}
// Delete sends a DELETE request.
func Delete(url string, p *url.Values, result, errMsg interface{}) (*Response, error) {
s := Session{}
return s.Delete(url, p, result, errMsg)
}