Skip to content

Commit

Permalink
improve get_sms
Browse files Browse the repository at this point in the history
  • Loading branch information
terry authored and h4n1virus committed May 31, 2020
1 parent d8a70ed commit 721f911
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions smspva_wrapper/methods/api/get_sms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

from ..raw_api import RawGetSMS
from smspva_wrapper.types import Services, Countries
from smspva_wrapper.ext.containers import SMSContainer
from smspva_wrapper.ext.containers import SMSContainer, NumberContainer


class GetSMS(RawGetSMS):
def get_sms(
self,
service: Union[Services, str],
country: Union[Countries, str],
_id: str,
sms: bool = False
service: Union[Services, str] = None,
country: Union[Countries, str] = None,
_id: str = None,
sms: bool = False,
*, number: NumberContainer = None
) -> SMSContainer:
"""Function for receiving a SMS for a certain service
In this method id parameter is indicated from the response to request for phone number get_number
Expand All @@ -28,6 +29,7 @@ def get_sms(
country (Countries or str): KAZAKHSTAN or "KZ"
_id (str): "25623"
sms (bool): False
*number: (NumberContainer)
Returns:
SMSContainer
Expand All @@ -46,11 +48,21 @@ def get_sms(
GetSMSError
"""

return SMSContainer(
self.raw_get_sms(
service=str(service),
country=str(country),
_id=_id,
sms=sms
if NumberContainer:
return SMSContainer(
self.raw_get_sms(
service=number.service,
country=number.country,
_id=number.id,
sms=sms
)
)
else:
return SMSContainer(
self.raw_get_sms(
service=str(service),
country=str(country),
_id=_id,
sms=sms
)
)
)

0 comments on commit 721f911

Please sign in to comment.