Ë
    ÇVhl  ã                   ón   — d dl mZmZmZ eZdZdZdZd dl	Z	d dl
mZ d dlmZ d„ Zd	„ Zed
k(  r e«        yy)é    )Úabsolute_importÚdivisionÚprint_functiona­  
module: catapult
short_description: Send a sms / mms using the catapult bandwidth API
description:
  - Allows notifications to be sent using SMS / MMS using the catapult bandwidth API.
extends_documentation_fragment:
  - community.general.attributes
attributes:
  check_mode:
    support: none
  diff_mode:
    support: none
options:
  src:
    type: str
    description:
      - One of your catapult telephone numbers the message should come from (must be in E.164 format, like V(+19195551212)).
    required: true
  dest:
    type: list
    elements: str
    description:
      - The phone number or numbers the message should be sent to (must be in E.164 format, like V(+19195551212)).
    required: true
  msg:
    type: str
    description:
      - The contents of the text message (must be 2048 characters or less).
    required: true
  media:
    type: str
    description:
      - For MMS messages, a media URL to the location of the media to be sent with the message.
  user_id:
    type: str
    description:
      - User ID from API account page.
    required: true
  api_token:
    type: str
    description:
      - API Token from API account page.
    required: true
  api_secret:
    type: str
    description:
      - API Secret from API account page.
    required: true

author: "Jonathan Mainguy (@Jmainguy)"
notes:
  - Will return changed even if the media URL is wrong.
  - Will return changed if the destination number is invalid.
a7  
- name: Send a mms to multiple users
  community.general.catapult:
    src: "+15035555555"
    dest:
      - "+12525089000"
      - "+12018994225"
    media: "http://example.com/foobar.jpg"
    msg: "Task is complete"
    user_id: "{{ user_id }}"
    api_token: "{{ api_token }}"
    api_secret: "{{ api_secret }}"

- name: Send a sms to a single user
  community.general.catapult:
    src: "+15035555555"
    dest: "+12018994225"
    msg: "Consider yourself notified"
    user_id: "{{ user_id }}"
    api_token: "{{ api_token }}"
    api_secret: "{{ api_secret }}"
zn
changed:
  description: Whether the API accepted the message.
  returned: always
  type: bool
  sample: true
N)ÚAnsibleModule)Ú	fetch_urlc                 óö   — d}d|z  }	|||dœ}
|r||
d<   |ddœ}|j                  dd«      | j                  d	<   |j                  dd«      | j                  d
<   t        | |	t        j                  |
«      |d¬«      S )z
    Send the message
    ÚAnsiblez6https://api.catapult.inetwork.com/v1/users/%s/messages)ÚfromÚtoÚtextÚmediazapplication/json)z
User-AgentzContent-typeú
Ú Úurl_usernameÚurl_passwordÚpost)ÚdataÚheadersÚmethod)ÚreplaceÚparamsr   ÚjsonÚdumps)ÚmoduleÚsrcÚdestÚmsgr   Úuser_idÚ	api_tokenÚ
api_secretÚAGENTÚURIr   r   s               ún/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/catapult.pyÚsendr$   k   s‹   € ð €EØ
BÀWÑ
L€CØ˜t¨SÑ1€DÙØˆˆW‰à"Ð4FÑG€Gð %.×$5Ñ$5°d¸BÓ$?€F‡MM.Ñ!Ø$.×$6Ñ$6°t¸RÓ$@€F‡MM.Ñ!äV˜S¤t§z¡z°$Ó'7ÀÐQWÔXÐXó    c                  ót  — t        t        t        d¬«      t        ddd¬«      t        d¬«      t        d¬«      t        dd¬«      t        dd¬«      t        d d¬«      ¬	«      ¬
«      } | j                  d   }| j                  d   }| j                  d   }| j                  d   }| j                  d   }| j                  d   }| j                  d   }|D ]O  }t        | |||||||«      \  }	}
|
d   dk7  sŒ!t	        j
                  |
d   «      }|d   }| j                  |¬«       ŒQ d}| j                  |¬«       y )NT)ÚrequiredÚlistÚstr)r'   ÚtypeÚelements)r'   Úno_logF)Údefaultr'   )r   r   r   r   r   r    r   )Úargument_specr   r   r   r   r   r   r    ÚstatuséÉ   ÚbodyÚmessage)r   )Úchanged)r   Údictr   r$   r   ÚloadsÚ	fail_jsonÚ	exit_json)r   r   r   r   r   r   r   r    ÚnumberÚrcÚinfor1   Úfail_msgr3   s                 r#   Úmainr<   ~   s5  € ÜÜÜ˜dÔ#Ü˜t¨&¸5ÔAÜ˜dÔ#Ü $Ô'Ü D°Ô6Ü T°$Ô7Ü˜t¨eÔ4ô
ô
€Fð -‰-˜Ñ
€CØ=‰=˜Ñ €DØ
-‰-˜Ñ
€CØM‰M˜'Ñ"€EØm‰m˜IÑ&€GØ—‘˜kÑ*€IØ—‘˜|Ñ,€Jàò +ˆÜ˜  V¨S°%¸À)ÈZÓX‰ˆˆDØ‰>˜SÓ Ü—:‘:˜d 6™lÓ+ˆDØ˜I‘ˆHØ×Ñ ÐÕ*ð+ð €GØ
×Ñ˜WÐÕ%r%   Ú__main__)Ú
__future__r   r   r   r*   Ú__metaclass__ÚDOCUMENTATIONÚEXAMPLESÚRETURNr   Úansible.module_utils.basicr   Úansible.module_utils.urlsr   r$   r<   Ú__name__© r%   r#   ú<module>rG      sT   ð÷ AÑ @Ø€ð5€ðn€ð.
€ó å 4Ý /òYò&&ð@ ˆzÒÙ…Fð r%   