Skip to content

Commit 09a38ce

Browse files
committed
replace any type with UserContactShort in preferences
1 parent b04e049 commit 09a38ce

File tree

8 files changed

+25
-21
lines changed

8 files changed

+25
-21
lines changed

examples/user_alert_preference/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func main() {
2525
}
2626
contact = contactResult.UserPhoneNumberContact
2727

28-
preference := &ilert.UserAlertPreference{Method: ilert.UserPreferenceMethod.Voice, Contact: contact, DelayMin: 0, Type: ilert.UserAlertPreferenceType.HighPriority}
28+
preference := &ilert.UserAlertPreference{Method: ilert.UserPreferenceMethod.Voice, Contact: &ilert.UserContactShort{ID: contact.ID}, DelayMin: 0, Type: ilert.UserAlertPreferenceType.HighPriority}
2929
preferenceInput := ilert.CreateUserAlertPreferenceInput{UserID: &user.ID, UserAlertPreference: preference}
3030
preferenceResult, err := client.CreateUserAlertPreference(&preferenceInput)
3131
if err != nil {

examples/user_duty_preference/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func main() {
2525
}
2626
contact = contactResult.UserPhoneNumberContact
2727

28-
preference := &ilert.UserDutyPreference{Method: ilert.UserPreferenceMethod.Voice, Contact: contact, BeforeMin: 0, Type: ilert.UserDutyPreferenceType.OnCall}
28+
preference := &ilert.UserDutyPreference{Method: ilert.UserPreferenceMethod.Voice, Contact: &ilert.UserContactShort{ID: contact.ID}, BeforeMin: 0, Type: ilert.UserDutyPreferenceType.OnCall}
2929
preferenceInput := ilert.CreateUserDutyPreferenceInput{UserID: &user.ID, UserDutyPreference: preference}
3030
preferenceResult, err := client.CreateUserDutyPreference(&preferenceInput)
3131
if err != nil {

examples/user_subscription_preference/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func main() {
2525
}
2626
contact = contactResult.UserPhoneNumberContact
2727

28-
preference := &ilert.UserSubscriptionPreference{Method: ilert.UserPreferenceMethod.Voice, Contact: contact}
28+
preference := &ilert.UserSubscriptionPreference{Method: ilert.UserPreferenceMethod.Voice, Contact: &ilert.UserContactShort{ID: contact.ID}}
2929
preferenceInput := ilert.CreateUserSubscriptionPreferenceInput{UserID: &user.ID, UserSubscriptionPreference: preference}
3030
preferenceResult, err := client.CreateUserSubscriptionPreference(&preferenceInput)
3131
if err != nil {

examples/user_update_preference/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func main() {
2525
}
2626
contact = contactResult.UserPhoneNumberContact
2727

28-
preference := &ilert.UserUpdatePreference{Method: ilert.UserPreferenceMethod.Voice, Contact: contact, Type: ilert.UserUpdatePreferenceType.AlertAccepted}
28+
preference := &ilert.UserUpdatePreference{Method: ilert.UserPreferenceMethod.Voice, Contact: &ilert.UserContactShort{ID: contact.ID}, Type: ilert.UserUpdatePreferenceType.AlertAccepted}
2929
preferenceInput := ilert.CreateUserUpdatePreferenceInput{UserID: &user.ID, UserUpdatePreference: preference}
3030
preferenceResult, err := client.CreateUserUpdatePreference(&preferenceInput)
3131
if err != nil {

user_alert_preference.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ import (
88

99
// UserNotificationPreference definition https://api.ilert.com/api-docs/#tag/Notification-Preferences
1010
type UserAlertPreference struct {
11-
ID int64 `json:"id,omitempty"`
12-
Method string `json:"method"`
13-
Contact interface{} `json:"contact"` // is either UserEmailContact or UserPhoneNumberContact
14-
DelayMin int64 `json:"delayMin"`
15-
Type string `json:"type"`
11+
ID int64 `json:"id,omitempty"`
12+
Method string `json:"method"`
13+
Contact *UserContactShort `json:"contact"` // is either UserEmailContact or UserPhoneNumberContact
14+
DelayMin int64 `json:"delayMin"`
15+
Type string `json:"type"`
16+
}
17+
18+
type UserContactShort struct {
19+
ID int64 `json:"id"`
1620
}
1721

1822
// UserPreferenceMethod defines user notification preference method

user_duty_preference.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import (
88

99
// UserNotificationPreference definition https://api.ilert.com/api-docs/#tag/Notification-Preferences
1010
type UserDutyPreference struct {
11-
ID int64 `json:"id,omitempty"`
12-
Method string `json:"method"`
13-
Contact interface{} `json:"contact"` // is either UserEmailContact or UserPhoneNumberContact
14-
BeforeMin int64 `json:"beforeMin"`
15-
Type string `json:"type"`
11+
ID int64 `json:"id,omitempty"`
12+
Method string `json:"method"`
13+
Contact *UserContactShort `json:"contact"` // is either UserEmailContact or UserPhoneNumberContact
14+
BeforeMin int64 `json:"beforeMin"`
15+
Type string `json:"type"`
1616
}
1717

1818
// UserDutyPreferenceMethodAll defines user duty notification preference method list

user_subscription_preference.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88

99
// UserNotificationPreference definition https://api.ilert.com/api-docs/#tag/Notification-Preferences
1010
type UserSubscriptionPreference struct {
11-
ID int64 `json:"id,omitempty"`
12-
Method string `json:"method"`
13-
Contact interface{} `json:"contact"` // is either UserEmailContact or UserPhoneNumberContact
11+
ID int64 `json:"id,omitempty"`
12+
Method string `json:"method"`
13+
Contact *UserContactShort `json:"contact"` // is either UserEmailContact or UserPhoneNumberContact
1414
}
1515

1616
// UserSubscriptionPreferenceMethodAll defines user subscription notification preference method list

user_update_preference.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import (
88

99
// UserNotificationPreference definition https://api.ilert.com/api-docs/#tag/Notification-Preferences
1010
type UserUpdatePreference struct {
11-
ID int64 `json:"id,omitempty"`
12-
Method string `json:"method"`
13-
Contact interface{} `json:"contact"` // is either UserEmailContact or UserPhoneNumberContact
14-
Type string `json:"type"`
11+
ID int64 `json:"id,omitempty"`
12+
Method string `json:"method"`
13+
Contact *UserContactShort `json:"contact"` // is either UserEmailContact or UserPhoneNumberContact
14+
Type string `json:"type"`
1515
}
1616

1717
// UserUpdatePreferenceMethodAll defines user update notification preference method list

0 commit comments

Comments
 (0)