add.rb 882 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations
  3. class Channel::Email::Add < Channel::Email::BaseConfiguration
  4. description 'Create a new email channel. This does not perform email validation.'
  5. argument :input, Gql::Types::Input::Channel::Email::AddInputType, 'Fields for the new channel'
  6. field :channel, Gql::Types::ChannelType, description: 'The new channel object'
  7. def resolve(input:)
  8. channel = ::Service::Channel::Email::Create.new.execute(
  9. inbound_configuration: map_type_to_config(input.inbound_configuration),
  10. outbound_configuration: map_type_to_config(input.outbound_configuration),
  11. group: input.group,
  12. email_address: input.email_address,
  13. email_realname: input.email_realname,
  14. )
  15. { channel: }
  16. end
  17. end
  18. end