-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathUnirest.go
77 lines (64 loc) · 2.34 KB
/
Unirest.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
* APIMATICCalculatorLib
*
* This file was automatically generated by APIMATIC BETA v2.0 on 06/10/2015
*/
package unirest
func Get(url string, headers map[string]interface{}) *Request {
req := NewRequest(GET, url, headers, nil, "", "")
return req
}
func GetWithAuth(url string, headers map[string]interface{}, username string, password string) *Request {
req := NewRequest(GET, url, headers, nil, username, password)
return req
}
func Post(url string, headers map[string]interface{}, body interface{}) *Request {
req := NewRequest(POST, url, headers, body, "", "")
return req
}
func PostWithAuth(url string, headers map[string]interface{}, body interface{}, username string, password string) *Request {
req := NewRequest(POST, url, headers, body, username, password)
return req
}
func Put(url string, headers map[string]interface{}, body interface{}) *Request {
req := NewRequest(PUT, url, headers, body, "", "")
return req
}
func PutWithAuth(url string, headers map[string]interface{}, body interface{}, username string, password string) *Request {
req := NewRequest(PUT, url, headers, body, username, password)
return req
}
func Patch(url string, headers map[string]interface{}, body interface{}) *Request {
req := NewRequest(PATCH, url, headers, body, "", "")
return req
}
func PatchWithAuth(url string, headers map[string]interface{}, body interface{}, username string, password string) *Request {
req := NewRequest(PATCH, url, headers, body, username, password)
return req
}
func Delete(url string, headers map[string]interface{},body interface{}) *Request {
req := NewRequest(DELETE, url, headers,body, "", "")
return req
}
func DeleteWithAuth(url string, headers map[string]interface{},body interface{}, username string, password string) *Request {
req := NewRequest(DELETE, url, headers, body, username, password)
return req
}
func AsBinary(request *Request,skipVerify bool) (*Response, error) {
//perform the underlying http request
res, err := request.PerformRequest(skipVerify)
if err != nil {
return nil, err
}
//prepare the response object
return NewBinaryResponse(res)
}
func AsString(request *Request,skipVerify bool) (*Response, error) {
//perform the underlying http request
resp, err := request.PerformRequest(skipVerify)
if err != nil {
return nil, err
}
//prepare the response object
return NewStringResponse(resp)
}