1 package repository
2 3 import (
4 "github.com/transip/gotransip/v6/rest"
5 )
6 7 // Client interface, this is the client interface as far as other packages should care about
8 type Client interface {
9 // Executes a GET rest request and returns the response into the destination struct
10 Get(request rest.Request, dest interface{}) error
11 // Executes a PUT request, not expecting any response from the api server
12 Put(request rest.Request) error
13 // Executes a PUT request, not expecting any response from the api server
14 PutWithResponse(request rest.Request) (rest.Response, error)
15 // Executes a POST request, not expecting any response from the api server
16 Post(request rest.Request) error
17 // Executes a POST request, expecting response from the api server
18 PostWithResponse(request rest.Request) (rest.Response, error)
19 // Executes a DELETE request, not expecting any response from the api server
20 Delete(request rest.Request) error
21 // Executes a PATCH request, not expecting any response from the api server
22 Patch(restRequest rest.Request) error
23 // Executes a PATCH request, expecting response from the api server
24 PatchWithResponse(request rest.Request) (rest.Response, error)
25 }
26 27 // RestRepository is the struct which is going to be used by all other repositories in the gotransip package
28 type RestRepository struct {
29 // we have a client that follows the Client interface
30 Client Client
31 }
32