@@ -5,36 +5,36 @@ import "strings"
5
5
// ListData issues a GET to list the specified data resource
6
6
// and stores the result in the value pointed to by res.
7
7
// Filters can be add via functional options.
8
- func (mj * Client ) ListData (resource string , resp interface {}, options ... RequestOptions ) (count , total int , err error ) {
9
- url := buildDataURL (mj .apiBase , & DataRequest {SourceType : resource })
8
+ func (c * Client ) ListData (resource string , resp interface {}, options ... RequestOptions ) (count , total int , err error ) {
9
+ url := buildDataURL (c .apiBase , & DataRequest {SourceType : resource })
10
10
req , err := createRequest ("GET" , url , nil , nil , options ... )
11
11
if err != nil {
12
12
return count , total , err
13
13
}
14
14
15
- return mj .httpClient .Send (req ).Read (resp ).Call ()
15
+ return c .httpClient .Send (req ).Read (resp ).Call ()
16
16
}
17
17
18
18
// GetData issues a GET to view a resource specifying an id
19
19
// and stores the result in the value pointed to by res.
20
20
// Filters can be add via functional options.
21
21
// Without an specified SourceTypeID in MailjetDataRequest, it is the same as ListData.
22
- func (mj * Client ) GetData (mdr * DataRequest , res interface {}, options ... RequestOptions ) (err error ) {
23
- url := buildDataURL (mj .apiBase , mdr )
22
+ func (c * Client ) GetData (mdr * DataRequest , res interface {}, options ... RequestOptions ) (err error ) {
23
+ url := buildDataURL (c .apiBase , mdr )
24
24
req , err := createRequest ("GET" , url , nil , nil , options ... )
25
25
if err != nil {
26
26
return err
27
27
}
28
28
29
- _ , _ , err = mj .httpClient .Send (req ).Read (res ).Call ()
29
+ _ , _ , err = c .httpClient .Send (req ).Read (res ).Call ()
30
30
return err
31
31
}
32
32
33
33
// PostData issues a POST to create a new data resource
34
34
// and stores the result in the value pointed to by res.
35
35
// Filters can be add via functional options.
36
- func (mj * Client ) PostData (fmdr * FullDataRequest , res interface {}, options ... RequestOptions ) (err error ) {
37
- url := buildDataURL (mj .apiBase , fmdr .Info )
36
+ func (c * Client ) PostData (fmdr * FullDataRequest , res interface {}, options ... RequestOptions ) (err error ) {
37
+ url := buildDataURL (c .apiBase , fmdr .Info )
38
38
req , err := createRequest ("POST" , url , fmdr .Payload , nil , options ... )
39
39
if err != nil {
40
40
return err
@@ -46,36 +46,36 @@ func (mj *Client) PostData(fmdr *FullDataRequest, res interface{}, options ...Re
46
46
headers = map [string ]string {"Content-Type" : contentType }
47
47
}
48
48
49
- _ , _ , err = mj .httpClient .Send (req ).With (headers ).Read (res ).Call ()
49
+ _ , _ , err = c .httpClient .Send (req ).With (headers ).Read (res ).Call ()
50
50
return err
51
51
}
52
52
53
53
// PutData is used to update a data resource.
54
54
// Fields to be updated must be specified by the string array onlyFields.
55
55
// If onlyFields is nil, all fields except these with the tag read_only, are updated.
56
56
// Filters can be add via functional options.
57
- func (mj * Client ) PutData (fmr * FullDataRequest , onlyFields []string , options ... RequestOptions ) (err error ) {
58
- url := buildDataURL (mj .apiBase , fmr .Info )
57
+ func (c * Client ) PutData (fmr * FullDataRequest , onlyFields []string , options ... RequestOptions ) (err error ) {
58
+ url := buildDataURL (c .apiBase , fmr .Info )
59
59
req , err := createRequest ("PUT" , url , fmr .Payload , onlyFields , options ... )
60
60
if err != nil {
61
61
return err
62
62
}
63
63
64
64
headers := map [string ]string {"Content-Type" : "application/json" }
65
- _ , _ , err = mj .httpClient .Send (req ).With (headers ).Call ()
65
+ _ , _ , err = c .httpClient .Send (req ).With (headers ).Call ()
66
66
67
67
return err
68
68
}
69
69
70
70
// DeleteData is used to delete a data resource.
71
- func (mj * Client ) DeleteData (mdr * DataRequest , options ... RequestOptions ) (err error ) {
72
- url := buildDataURL (mj .apiBase , mdr )
71
+ func (c * Client ) DeleteData (mdr * DataRequest , options ... RequestOptions ) (err error ) {
72
+ url := buildDataURL (c .apiBase , mdr )
73
73
req , err := createRequest ("DELETE" , url , nil , nil , options ... )
74
74
if err != nil {
75
75
return err
76
76
}
77
77
78
- _ , _ , err = mj .httpClient .Send (req ).Call ()
78
+ _ , _ , err = c .httpClient .Send (req ).Call ()
79
79
80
80
return err
81
81
}
0 commit comments