-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
184 lines (157 loc) · 5.57 KB
/
Copy pathtest.py
File metadata and controls
184 lines (157 loc) · 5.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
import datetime
from ghasedak_sms.dto import *
from ghasedak_sms.enums.message_id_type import MessageIdType
from ghasedak_sms.ghasedak import Ghasedak
# Replace 'your_api_key' with your actual API key
api_key = 'your_api_key'
line = '123xxxxxxx'
recipient_phone_number1 = '09xxxxxxxxx'
recipient_phone_number2 = '09xxxxxxxxx'
ghasedak = Ghasedak(api_key)
def print_separator():
print("_____________________________________")
def test_check_sms_status():
print_separator()
query = CheckSmsStatusInput(ids=['2366799', '2366805'], type0=MessageIdType.MESSAGE_ID)
print("Input for Check SMS Status:", query.__dict__)
response = ghasedak.check_sms_status(query)
print("Output for Check SMS Status:", response)
def test_get_account_information():
print_separator()
print("Input for Get Account Information: None")
response = ghasedak.get_account_information()
print("Output for Get Account Information:", response)
def test_get_received_smses():
print_separator()
query = GetReceivedSmsInput(line_number=line, is_read=False)
print("Input for Get Received SMSes:", query.__dict__)
response = ghasedak.get_received_smses(query)
print("Output for Get Received SMSes:", response)
def test_get_received_smses_paging():
print_separator()
query = GetReceivedSmsPagingInput(
line_number=line,
is_read=False,
start_date=datetime.datetime.now() - datetime.timedelta(days=90),
end_date=datetime.datetime.now(),
page_index=0,
page_size=10
)
print("Input for Get Received SMSes Paging:", query.__dict__)
response = ghasedak.get_received_smses_paging(query)
print("Output for Get Received SMSes Paging:", response)
def test_get_otp_parameters():
print_separator()
query = GetOtpParametersInput(template_name='newOTP')
print("Input for Get OTP Parameters:", query.__dict__)
response = ghasedak.get_otp_parameters(query)
print("Output for Get OTP Parameters:", response)
def test_send_single_sms():
print_separator()
command = SendSingleSmsInput(
send_date=None,
line_number=line,
receptor=recipient_phone_number1,
message='Your message',
client_reference_id='client_ref_id',
udh=False
)
print("Input for Send Single SMS:", command.__dict__)
response = ghasedak.send_single_sms(command)
print("Output for Send Single SMS:", response)
def test_send_bulk_sms():
print_separator()
command = SendBulkInput(
send_date=None,
line_number=line,
receptors=[recipient_phone_number1, recipient_phone_number2],
message='Your bulk message',
client_reference_id='client_ref_id',
is_voice=False,
udh=False
)
print("Input for Send Bulk SMS:", command.__dict__)
response = ghasedak.send_bulk_sms(command)
print("Output for Send Bulk SMS:", response)
def test_send_pair_to_pair_sms():
print_separator()
command = SendPairToPairInput(
items=[
# SendPairToPairInput.SendPairToPairSmsWebServiceDto(
# line_number=line,
# receptor=recipient_phone_number1,
# message='Message 1',
# # client_reference_id='client_ref_id',
# send_date=datetime.datetime.now()
# ),
SendPairToPairInput.SendPairToPairSmsWebServiceDto(
line_number=line,
receptor=recipient_phone_number2,
message='Message 2',
# client_reference_id='client_ref_id',
send_date=datetime.datetime.now()
)
],
udh=False
)
print("Input for Send Pair to Pair SMS:", command.__dict__)
response = ghasedak.send_pair_to_pair_sms(command)
print("Output for Send Pair to Pair SMS:", response)
def test_send_otp_sms_old():
print_separator()
command = SendOldOtpInput(
send_date=datetime.datetime.now(),
receptors=[
SendOtpReceptorDto(
mobile=recipient_phone_number1,
# client_reference_id='client_ref_id'
)
],
template_name='oldOTP',
param1='param1_value',
param2='param2_value',
param3='param3_value',
param4='param4_value',
param5='param5_value',
param6='param6_value',
param7='param7_value',
param8='param8_value',
param9='param9_value',
param10='param10_value',
is_voice=False,
udh=False
)
print("Input for Send OTP SMS Old:", command.__dict__)
response = ghasedak.send_otp_sms_old(command)
print("Output for Send OTP SMS Old:", response)
def test_send_otp_sms():
print_separator()
command = SendOtpInput(
send_date=None,
receptors=[
SendOtpReceptorDto(
mobile=recipient_phone_number1,
# client_reference_id='client_ref_id'
)
],
template_name='newOTP',
inputs=[
SendOtpInput.OtpInput(param='Code', value='code'),
SendOtpInput.OtpInput(param='Name', value='name')
],
udh=False
)
print("Input for Send OTP SMS:", command.__dict__)
response = ghasedak.send_otp_sms(command)
print("Output for Send OTP SMS:", response)
if __name__ == "__main__":
test_check_sms_status()
test_get_account_information()
test_get_received_smses()
test_get_received_smses_paging()
test_get_otp_parameters()
test_send_single_sms()
test_send_bulk_sms()
test_send_pair_to_pair_sms()
test_send_otp_sms_old()
test_send_otp_sms()