package mail import ( "encoding/json" "github.com/ultisuite/ulti-backend/internal/automation" ) func marshalWebhookEventTypes(types []string) ([]byte, error) { if types == nil { types = []string{} } return json.Marshal(types) } func marshalWebhookMailScope(scope *webhookMailScope) ([]byte, error) { out := automation.MailScope{AllAccounts: true} if scope != nil { out.AllAccounts = scope.AllAccounts out.AccountIDs = scope.AccountIDs if out.AccountIDs == nil { out.AccountIDs = []string{} } } return json.Marshal(out) } func marshalWebhookDriveScope(scope *webhookDriveScope) ([]byte, error) { out := automation.DriveScope{AllFolders: true} if scope != nil { out.AllFolders = scope.AllFolders out.FolderPaths = scope.FolderPaths if out.FolderPaths == nil { out.FolderPaths = []string{} } } return json.Marshal(out) } func marshalWebhookContactsScope(scope *webhookContactsScope) ([]byte, error) { out := automation.ContactsScope{AllBooks: true} if scope != nil { out.AllBooks = scope.AllBooks out.BookIDs = scope.BookIDs if out.BookIDs == nil { out.BookIDs = []string{} } } return json.Marshal(out) } func marshalWebhookAgendaScope(scope *webhookAgendaScope) ([]byte, error) { out := automation.AgendaScope{AllCalendars: true} if scope != nil { out.AllCalendars = scope.AllCalendars out.CalendarIDs = scope.CalendarIDs if out.CalendarIDs == nil { out.CalendarIDs = []string{} } } return json.Marshal(out) }