This repository was archived by the owner on Oct 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.go
More file actions
51 lines (45 loc) · 1.79 KB
/
client.go
File metadata and controls
51 lines (45 loc) · 1.79 KB
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
package http
// Client is a simplified HTTP interface that ensures that a struct is transported to a remote endpoint
// properly encoded, and the response is decoded into the response struct.
type Client interface {
Request(
Method string,
path string,
requestBody interface{},
responseBody interface{},
) (statusCode int, err error)
// Get queries the configured endpoint with the path providing the response in the responseBody structure. It
// returns the HTTP status code and any potential errors.
Get(
path string,
responseBody interface{},
) (statusCode int, err error)
// Post queries the configured endpoint with the path, sending the requestBody and providing the
// response in the responseBody structure. It returns the HTTP status code and any potential errors.
Post(
path string,
requestBody interface{},
responseBody interface{},
) (statusCode int, err error)
// Put queries the configured endpoint with the path, sending the requestBody and providing the
// response in the responseBody structure. It returns the HTTP status code and any potential errors.
Put(
path string,
requestBody interface{},
responseBody interface{},
) (statusCode int, err error)
// Patch queries the configured endpoint with the path, sending the requestBody and providing the
// response in the responseBody structure. It returns the HTTP status code and any potential errors.
Patch(
path string,
requestBody interface{},
responseBody interface{},
) (statusCode int, err error)
// Delete queries the configured endpoint with the path, sending the requestBody and providing the
// response in the responseBody structure. It returns the HTTP status code and any potential errors.
Delete(
path string,
requestBody interface{},
responseBody interface{},
) (statusCode int, err error)
}