Overview

Namespaces

  • SMSApi
    • Api
      • Action
        • Phonebook
        • Sender
        • Sms
        • User
      • Response
    • Exception
    • Proxy
      • Http

Classes

  • SMSApi\Proxy\Http\AbstractHttp
  • SMSApi\Proxy\Http\Curl
  • SMSApi\Proxy\Http\Native
  • Overview
  • Namespace
  • Class
  1: <?php
  2: 
  3: namespace SMSApi\Api\Action\User;
  4: 
  5: use SMSApi\Api\Action\AbstractAction;
  6: use SMSApi\Proxy\Uri;
  7: 
  8: /**
  9:  * Class Add
 10:  * @package SMSApi\Api\Action\User
 11:  */
 12: class Add extends AbstractAction {
 13: 
 14:     /**
 15:      * @param $data
 16:      * @return \SMSApi\Api\Response\UserResponse
 17:      */
 18:     protected function response( $data ) {
 19: 
 20:         return new \SMSApi\Api\Response\UserResponse( $data );
 21:     }
 22: 
 23:     /**
 24:      * @return Uri
 25:      */
 26:     public function uri() {
 27: 
 28:         $query = "";
 29: 
 30:         $query .= $this->paramsLoginToQuery();
 31: 
 32:         $query .= $this->paramsOther();
 33: 
 34:         return new Uri( $this->proxy->getProtocol(), $this->proxy->getHost(), $this->proxy->getPort(), "/api/user.do", $query );
 35:     }
 36: 
 37:     /**
 38:      * New account user name.
 39:      *
 40:      * @param string $username account name
 41:      * @return $this
 42:      */
 43:     public function setUsername( $username ) {
 44:         $this->params[ "add_user" ] = $username;
 45:         return $this;
 46:     }
 47: 
 48:     /**
 49:      * Set account password encoded md5 algorithm.
 50:      *
 51:      * @param string $password  password encoded md5
 52:      * @return $this
 53:      */
 54:     public function setPassword( $password ) {
 55:         $this->params[ "pass" ] = $password;
 56:         return $this;
 57:     }
 58: 
 59:     /**
 60:      * Set account api password hashed with md5.
 61:      *
 62:      * @param string $password password api encoded md5
 63:      * @return $this
 64:      */
 65:     public function setPasswordApi( $password ) {
 66:         $this->params[ "pass_api" ] = $password;
 67:         return $this;
 68:     }
 69: 
 70:     /**
 71:      * Set credit limit granted to account.
 72:      *
 73:      * @param number $limit limit
 74:      * @return $this
 75:      */
 76:     public function setLimit( $limit ) {
 77:         $this->params[ "limit" ] = $limit;
 78:         return $this;
 79:     }
 80: 
 81:     /**
 82:      * Set month credits, the amount that will be granted 1st day of every month.
 83:      *
 84:      * @param number $limit limit number
 85:      * @return $this
 86:      */
 87:     public function setMonthLimit( $limit ) {
 88:         $this->params[ "month_limit" ] = $limit;
 89:         return $this;
 90:     }
 91: 
 92:     /**
 93:      * Set access to main account sender names.
 94:      *
 95:      * @param bool $access if true access is granted
 96:      * @return $this
 97:      */
 98:     public function setFullAccessSenderNames( $access ) {
 99:         if ( $access == true ) {
100:             $this->params[ "senders" ] = "1";
101:         } else if ( $access == false ) {
102:             $this->params[ "senders" ] = "0";
103:         }
104: 
105:         return $this;
106:     }
107: 
108:     /**
109:      * @deprecated since v1.0.0 use SMSApi\Api\Action\User\Add::setFullAccessSenderNames
110:      */
111:     public function setSenders( $access ) {
112:         return $this->setFullAccessSenderNames($access);
113:     }
114: 
115:     /**
116:      * Set access to main account phonebook contacts.
117:      *
118:      * @param bool $access
119:      * @return $this
120:      */
121: 
122:     public function setFullAccessPhoneBook( $access ) {
123: 
124:         if ( $access == true ) {
125:             $this->params[ "phonebook" ] = "1";
126:         } else if ( $access == false ) {
127:             $this->params[ "phonebook" ] = "0";
128:         }
129: 
130:         return $this;
131:     }
132: 
133: 
134:     /**
135:      * @deprecated since v1.0.0 use SMSApi\Api\Action\User\Add::setFullAccessPhoneBook
136:      */
137:     public function setPhonebook( $access )
138:     {
139:         return $this->setFullAccessPhoneBook($access);
140:     }
141: 
142:     /**
143:      * Set account active status.
144:      *
145:      * @param bool $val if true set account enable otherwise disabled
146:      * @return $this
147:      */
148:     public function setActive( $val ) {
149: 
150:         if ( $val == true ) {
151:             $this->params[ "active" ] = "1";
152:         } else if ( $val == false ) {
153:             $this->params[ "active" ] = "0";
154:         }
155: 
156:         return $this;
157:     }
158: 
159:     /**
160:      * Set additional account description.
161:      *
162:      * @param string $info description
163:      * @return $this
164:      */
165:     public function setInfo( $info ) {
166:         $this->params[ "info" ] = $info;
167:         return $this;
168:     }
169: 
170: }
171: 
172: 
SMSAPI Api Client API documentation generated by ApiGen