3
@nð]Z  ã               @   s   d dl Z G dd„ deƒZdS )é    Nc               @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )ÚAPIc             C   s   dddddœ| _ d S )NZinfopetaniapptokenzapplication/jsonzno-cachez$4b0ec07f-7f67-4636-a0ef-eb07e77ad73b)ZAPPTOKENzContent-Typezcache-controlzPostman-Token)Úheaders)Úself© r   ú./home/codelabs/socketengine/api/api_request.pyÚ__init__   s    zAPI.__init__c       
      C   sN   d}d| d | d | d | d | d }| j }tjd|||d	�}	|	jS )
Nz6http://149.129.234.128/infopetani/gateway/public/chat2z{"author_id": "z","role": "z","room_id": "z","content": "z","type": "z"}ÚPOST)Údatar   )r   ÚrequestsÚrequestÚtext)
r   Ú	author_idÚroleÚroom_idÚcontentÚtype_mesÚurlÚpayloadr   Úresponser   r   r   Úpost_message   s
    ,zAPI.post_messagec             C   s6   d}d| d | d }| j }tjd|||d�}|jS )NzBhttp://149.129.234.128/infopetani/gateway/public/chat-update-read2z{"target_id": "z","room_id": "z"}r   )r	   r   )r   r
   r   r   )r   r   Ú	target_idr   r   r   r   r   r   r   Úupdate_read_message   s
    zAPI.update_read_messagec             C   s6   d}d| d | d }| j }tjd|||d�}|jS )NzJhttp://149.129.234.128/infopetani/gateway/public/chat-update-read-in-room2z{"author_id": "z","room_id": "z"}r   )r	   r   )r   r
   r   r   )r   r   r   r   r   r   r   r   r   r   Úupdate_read_message_in_room   s
    zAPI.update_read_message_in_roomc	             C   sf   d}	d| d | d | d | d | d | d | d	 | d
 }
| j }tjd|	|
|d�}|jS )Nz;http://149.129.234.128/infopetani/gateway/public/push-notifz{"member_id": "z","room_id": "z","author_name": "z","message": "z","type": "z","date": "z","time": "z","category": "z"}r   )r	   r   )r   r
   r   r   )r   Ú	member_idr   Úauthor_nameÚmessager   ÚdateÚtimeÚcategoryr   r   r   r   r   r   r   Ú
send_notif!   s
    DzAPI.send_notifN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r   r      s
   	r   )r
   Úobjectr   r   r   r   r   Ú<module>   s   