-
Notifications
You must be signed in to change notification settings - Fork 61
/
servers.go
70 lines (64 loc) · 2.31 KB
/
servers.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
package postmark
import (
"fmt"
)
// Server represents a server registered in your Postmark account
type Server struct {
// ID of server
ID int64
// Name of server
Name string
// ApiTokens associated with server.
ApiTokens []string
// ServerLink to your server overview page in Postmark.
ServerLink string
// Color of the server in the rack screen. Purple Blue Turquoise Green Red Yellow Grey
Color string
// SmtpApiActivated specifies whether or not SMTP is enabled on this server.
SmtpApiActivated bool
// RawEmailEnabled allows raw email to be sent with inbound.
RawEmailEnabled bool
// InboundAddress is the inbound email address
InboundAddress string
// InboundHookUrl to POST to every time an inbound event occurs.
InboundHookUrl string
// BounceHookUrl to POST to every time a bounce event occurs.
BounceHookUrl string
// OpenHookUrl to POST to every time an open event occurs.
OpenHookUrl string
// PostFirstOpenOnly - If set to true, only the first open by a particular recipient will initiate the open webhook. Any
// subsequent opens of the same email by the same recipient will not initiate the webhook.
PostFirstOpenOnly bool
// TrackOpens indicates if all emails being sent through this server have open tracking enabled.
TrackOpens bool
// InboundDomain is the inbound domain for MX setup
InboundDomain string
// InboundHash is the inbound hash of your inbound email address.
InboundHash string
// InboundSpamThreshold is the maximum spam score for an inbound message before it's blocked.
InboundSpamThreshold int64
}
///////////////////////////////////////
///////////////////////////////////////
// GetServer fetches a specific server via serverID
func (client *Client) GetServer(serverID string) (Server, error) {
res := Server{}
err := client.doRequest(parameters{
Method: "GET",
Path: fmt.Sprintf("servers/%s", serverID),
TokenType: account_token,
}, &res)
return res, err
}
///////////////////////////////////////
///////////////////////////////////////
// EditServer updates details for a specific server with serverID
func (client *Client) EditServer(serverID string, server Server) (Server, error) {
res := Server{}
err := client.doRequest(parameters{
Method: "PUT",
Path: fmt.Sprintf("servers/%s", serverID),
TokenType: account_token,
}, &res)
return res, err
}