@@ -30,6 +30,71 @@ import Network.HTTP.Types
3030import Network.PagerDuty.TH
3131import Network.PagerDuty.Types
3232
33−users :: Path
34−users = "users"
33+contacts :: UserId -> Path
34+contacts u = "users" % u % "contact_methods"
3535
36+data Contact = Contact
37+ { _cId :: ContactId
38+ , _cUserId :: UserId
39+ , _cLabel :: Text
40+ , _cAddress :: Address
41+ , _cType :: ContactType
42+ , _cSendShortEmail :: Maybe Bool'
43+ , _cBlacklisted :: Maybe Bool'
44+ } deriving (Eq, Show)
45+
46+data ContactType
47+ = SMS
48+ | Phone
49+ | Email
50+ deriving (Eq, Show)
51+
52+deriveNullary ''ContactType
53+
54+Name Type Required Description
55+type String Yes The type of the contact method. One of SMS, email or phone.
56+address String Yes The id of the contact method. For SMS and phone it is the number, and for email it is the email address.
57+country_code Integer No The number code for your country. Not used for email. Defaults to 1.
58+label String No A human friendly label for the contact method. (ie: "Home Phone", "Work Email", etc.) Defaults to the type of the contact method and the address (with country code for phone numbers).
59+send_short_email Boolean No Send an abbreviated email message instead of the standard email output. Useful for email-to-SMS gateways and email based pagers. Only valid for email contact methods. Defaults to false.
60+
61+
62+-- | List existing contact methods for the specified user.
63+--
64+-- @GET \/users\/\:user_id\/contact_methods@
65+--
66+-- /See:/ <http://developer.pagerduty.com/documentation/rest/users/contact_methods/list>
67+listContacts
68+
69+-- | Get details for a contact method.
70+--
71+-- @GET \/users\/\:user_id\/contact_methods\/\:id@
72+--
73+-- /See:/ <http://developer.pagerduty.com/documentation/rest/users/contact_methods/show>
74+getContact
75+
76+-- | Create a new contact method for a given user. A contact method can be one
77+-- of the following types: SMS, email, and phone. push_notification contact
78+-- methods cannot be created using this API, they are added automatically during
79+-- device registration.
80+--
81+-- @POST \/users\/\:user_id\/contact_methods@
82+--
83+-- /Note:/ The contact info must be unique.
84+--
85+-- /See:/ <http://developer.pagerduty.com/documentation/rest/users/contact_methods/create>
86+createContact
87+
88+-- | Update an existing contact method of a given user. Note that you cannot change the type of an existing method.
89+--
90+-- @PUT \/users\/\:user_id\/contact_methods\/\:id@
91+--
92+-- /See:/ <http://developer.pagerduty.com/documentation/rest/users/contact_methods/update>
93+updateContact
94+
95+-- | Remove a contact method and any corresponding notification rules.
96+--
97+-- @DELETE \/users\/\:user_id\/contact_methods\/\:id@
98+--
99+-- /See:/ <http://developer.pagerduty.com/documentation/rest/users/contact_methods/delete>
100+deleteContact