-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathdomains_connection.go
More file actions
38 lines (33 loc) · 1.28 KB
/
domains_connection.go
File metadata and controls
38 lines (33 loc) · 1.28 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
package mailgun
import (
"context"
"github.com/mailgun/mailgun-go/v5/mtypes"
)
// GetDomainConnection returns delivery connection settings for the defined domain
//
// Deprecated: use GetDomain instead
//
// TODO(v6): remove
func (mg *Client) GetDomainConnection(ctx context.Context, domain string) (mtypes.DomainConnection, error) {
r := newHTTPRequest(generateApiUrl(mg, 3, domainsEndpoint) + "/" + domain + "/connection")
r.setClient(mg.HTTPClient())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var resp mtypes.DomainConnectionResponse
err := getResponseFromJSON(ctx, r, &resp)
return resp.Connection, err
}
// UpdateDomainConnection updates the specified delivery connection settings for the defined domain
//
// Deprecated: use UpdateDomain instead
//
// TODO(v6): remove
func (mg *Client) UpdateDomainConnection(ctx context.Context, domain string, settings mtypes.DomainConnection) error {
r := newHTTPRequest(generateApiUrl(mg, 3, domainsEndpoint) + "/" + domain + "/connection")
r.setClient(mg.HTTPClient())
r.setBasicAuth(basicAuthUser, mg.APIKey())
payload := newUrlEncodedPayload()
payload.addValue("require_tls", boolToString(settings.RequireTLS))
payload.addValue("skip_verification", boolToString(settings.SkipVerification))
_, err := makePutRequest(ctx, r, payload)
return err
}