forked from loafle/openapi-generator-original
		
	
		
			
				
	
	
		
			457 lines
		
	
	
		
			13 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			457 lines
		
	
	
		
			13 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
/**
 | 
						|
 *  Copyright 2015 Reverb Technologies, Inc.
 | 
						|
 *
 | 
						|
 *  Licensed under the Apache License, Version 2.0 (the "License");
 | 
						|
 *  you may not use this file except in compliance with the License.
 | 
						|
 *  You may obtain a copy of the License at
 | 
						|
 *
 | 
						|
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
						|
 *
 | 
						|
 *  Unless required by applicable law or agreed to in writing, software
 | 
						|
 *  distributed under the License is distributed on an "AS IS" BASIS,
 | 
						|
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
						|
 *  See the License for the specific language governing permissions and
 | 
						|
 *  limitations under the License.
 | 
						|
 */
 | 
						|
 | 
						|
/**
 | 
						|
 *
 | 
						|
 * NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
 | 
						|
 */
 | 
						|
 | 
						|
namespace SwaggerClient;
 | 
						|
 | 
						|
class UserApi {
 | 
						|
 | 
						|
  function __construct($apiClient) {
 | 
						|
    $this->apiClient = $apiClient;
 | 
						|
  }
 | 
						|
 | 
						|
  
 | 
						|
  /**
 | 
						|
   * createUser
 | 
						|
   *
 | 
						|
   * Create user
 | 
						|
   *
 | 
						|
   * @param User $body Created user object (required)
 | 
						|
   * @return void
 | 
						|
   */
 | 
						|
   public function createUser($body) {
 | 
						|
 | 
						|
      // parse inputs
 | 
						|
      $resourcePath = "/user";
 | 
						|
      $resourcePath = str_replace("{format}", "json", $resourcePath);
 | 
						|
      $method = "POST";
 | 
						|
      $httpBody = '';
 | 
						|
      $queryParams = array();
 | 
						|
      $headerParams = array();
 | 
						|
      $formParams = array();
 | 
						|
      $_header_accept = 'application/json, application/xml';
 | 
						|
      if ($_header_accept !== '') {
 | 
						|
        $headerParams['Accept'] = $_header_accept;
 | 
						|
      }
 | 
						|
      $_header_content_type = array();
 | 
						|
      $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
 | 
						|
 | 
						|
      
 | 
						|
      
 | 
						|
      
 | 
						|
      
 | 
						|
      // body params
 | 
						|
      $_tempBody = null;
 | 
						|
      if (isset($body)) {
 | 
						|
        $_tempBody = $body;
 | 
						|
      }
 | 
						|
 | 
						|
      // for model (json/xml)
 | 
						|
      if (isset($_tempBody)) {
 | 
						|
        $httpBody = $_tempBody; // $_tempBody is the method argument, if present
 | 
						|
      } else if (count($formParams) > 0) {
 | 
						|
        // for HTTP post (form)
 | 
						|
        $httpBody = $formParams;
 | 
						|
      }
 | 
						|
 | 
						|
      // make the API Call
 | 
						|
      $response = $this->apiClient->callAPI($resourcePath, $method,
 | 
						|
                                            $queryParams, $httpBody,
 | 
						|
                                            $headerParams);
 | 
						|
 | 
						|
      
 | 
						|
  }
 | 
						|
  
 | 
						|
  /**
 | 
						|
   * createUsersWithArrayInput
 | 
						|
   *
 | 
						|
   * Creates list of users with given input array
 | 
						|
   *
 | 
						|
   * @param array[User] $body List of user object (required)
 | 
						|
   * @return void
 | 
						|
   */
 | 
						|
   public function createUsersWithArrayInput($body) {
 | 
						|
 | 
						|
      // parse inputs
 | 
						|
      $resourcePath = "/user/createWithArray";
 | 
						|
      $resourcePath = str_replace("{format}", "json", $resourcePath);
 | 
						|
      $method = "POST";
 | 
						|
      $httpBody = '';
 | 
						|
      $queryParams = array();
 | 
						|
      $headerParams = array();
 | 
						|
      $formParams = array();
 | 
						|
      $_header_accept = 'application/json, application/xml';
 | 
						|
      if ($_header_accept !== '') {
 | 
						|
        $headerParams['Accept'] = $_header_accept;
 | 
						|
      }
 | 
						|
      $_header_content_type = array();
 | 
						|
      $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
 | 
						|
 | 
						|
      
 | 
						|
      
 | 
						|
      
 | 
						|
      
 | 
						|
      // body params
 | 
						|
      $_tempBody = null;
 | 
						|
      if (isset($body)) {
 | 
						|
        $_tempBody = $body;
 | 
						|
      }
 | 
						|
 | 
						|
      // for model (json/xml)
 | 
						|
      if (isset($_tempBody)) {
 | 
						|
        $httpBody = $_tempBody; // $_tempBody is the method argument, if present
 | 
						|
      } else if (count($formParams) > 0) {
 | 
						|
        // for HTTP post (form)
 | 
						|
        $httpBody = $formParams;
 | 
						|
      }
 | 
						|
 | 
						|
      // make the API Call
 | 
						|
      $response = $this->apiClient->callAPI($resourcePath, $method,
 | 
						|
                                            $queryParams, $httpBody,
 | 
						|
                                            $headerParams);
 | 
						|
 | 
						|
      
 | 
						|
  }
 | 
						|
  
 | 
						|
  /**
 | 
						|
   * createUsersWithListInput
 | 
						|
   *
 | 
						|
   * Creates list of users with given input array
 | 
						|
   *
 | 
						|
   * @param array[User] $body List of user object (required)
 | 
						|
   * @return void
 | 
						|
   */
 | 
						|
   public function createUsersWithListInput($body) {
 | 
						|
 | 
						|
      // parse inputs
 | 
						|
      $resourcePath = "/user/createWithList";
 | 
						|
      $resourcePath = str_replace("{format}", "json", $resourcePath);
 | 
						|
      $method = "POST";
 | 
						|
      $httpBody = '';
 | 
						|
      $queryParams = array();
 | 
						|
      $headerParams = array();
 | 
						|
      $formParams = array();
 | 
						|
      $_header_accept = 'application/json, application/xml';
 | 
						|
      if ($_header_accept !== '') {
 | 
						|
        $headerParams['Accept'] = $_header_accept;
 | 
						|
      }
 | 
						|
      $_header_content_type = array();
 | 
						|
      $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
 | 
						|
 | 
						|
      
 | 
						|
      
 | 
						|
      
 | 
						|
      
 | 
						|
      // body params
 | 
						|
      $_tempBody = null;
 | 
						|
      if (isset($body)) {
 | 
						|
        $_tempBody = $body;
 | 
						|
      }
 | 
						|
 | 
						|
      // for model (json/xml)
 | 
						|
      if (isset($_tempBody)) {
 | 
						|
        $httpBody = $_tempBody; // $_tempBody is the method argument, if present
 | 
						|
      } else if (count($formParams) > 0) {
 | 
						|
        // for HTTP post (form)
 | 
						|
        $httpBody = $formParams;
 | 
						|
      }
 | 
						|
 | 
						|
      // make the API Call
 | 
						|
      $response = $this->apiClient->callAPI($resourcePath, $method,
 | 
						|
                                            $queryParams, $httpBody,
 | 
						|
                                            $headerParams);
 | 
						|
 | 
						|
      
 | 
						|
  }
 | 
						|
  
 | 
						|
  /**
 | 
						|
   * loginUser
 | 
						|
   *
 | 
						|
   * Logs user into the system
 | 
						|
   *
 | 
						|
   * @param string $username The user name for login (required)
 | 
						|
   * @param string $password The password for login in clear text (required)
 | 
						|
   * @return string
 | 
						|
   */
 | 
						|
   public function loginUser($username, $password) {
 | 
						|
 | 
						|
      // parse inputs
 | 
						|
      $resourcePath = "/user/login";
 | 
						|
      $resourcePath = str_replace("{format}", "json", $resourcePath);
 | 
						|
      $method = "GET";
 | 
						|
      $httpBody = '';
 | 
						|
      $queryParams = array();
 | 
						|
      $headerParams = array();
 | 
						|
      $formParams = array();
 | 
						|
      $_header_accept = 'application/json, application/xml';
 | 
						|
      if ($_header_accept !== '') {
 | 
						|
        $headerParams['Accept'] = $_header_accept;
 | 
						|
      }
 | 
						|
      $_header_content_type = array();
 | 
						|
      $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
 | 
						|
 | 
						|
      // query params
 | 
						|
      if($username !== null) {
 | 
						|
        $queryParams['username'] = $this->apiClient->toQueryValue($username);
 | 
						|
      }// query params
 | 
						|
      if($password !== null) {
 | 
						|
        $queryParams['password'] = $this->apiClient->toQueryValue($password);
 | 
						|
      }
 | 
						|
      
 | 
						|
      
 | 
						|
      
 | 
						|
      
 | 
						|
 | 
						|
      // for model (json/xml)
 | 
						|
      if (isset($_tempBody)) {
 | 
						|
        $httpBody = $_tempBody; // $_tempBody is the method argument, if present
 | 
						|
      } else if (count($formParams) > 0) {
 | 
						|
        // for HTTP post (form)
 | 
						|
        $httpBody = $formParams;
 | 
						|
      }
 | 
						|
 | 
						|
      // make the API Call
 | 
						|
      $response = $this->apiClient->callAPI($resourcePath, $method,
 | 
						|
                                            $queryParams, $httpBody,
 | 
						|
                                            $headerParams);
 | 
						|
 | 
						|
      if(! $response) {
 | 
						|
        return null;
 | 
						|
      }
 | 
						|
 | 
						|
  		$responseObject = $this->apiClient->deserialize($response,
 | 
						|
  		                                                'string');
 | 
						|
  		return $responseObject;
 | 
						|
  }
 | 
						|
  
 | 
						|
  /**
 | 
						|
   * logoutUser
 | 
						|
   *
 | 
						|
   * Logs out current logged in user session
 | 
						|
   *
 | 
						|
   * @return void
 | 
						|
   */
 | 
						|
   public function logoutUser() {
 | 
						|
 | 
						|
      // parse inputs
 | 
						|
      $resourcePath = "/user/logout";
 | 
						|
      $resourcePath = str_replace("{format}", "json", $resourcePath);
 | 
						|
      $method = "GET";
 | 
						|
      $httpBody = '';
 | 
						|
      $queryParams = array();
 | 
						|
      $headerParams = array();
 | 
						|
      $formParams = array();
 | 
						|
      $_header_accept = 'application/json, application/xml';
 | 
						|
      if ($_header_accept !== '') {
 | 
						|
        $headerParams['Accept'] = $_header_accept;
 | 
						|
      }
 | 
						|
      $_header_content_type = array();
 | 
						|
      $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
 | 
						|
 | 
						|
      
 | 
						|
      
 | 
						|
      
 | 
						|
      
 | 
						|
      
 | 
						|
 | 
						|
      // for model (json/xml)
 | 
						|
      if (isset($_tempBody)) {
 | 
						|
        $httpBody = $_tempBody; // $_tempBody is the method argument, if present
 | 
						|
      } else if (count($formParams) > 0) {
 | 
						|
        // for HTTP post (form)
 | 
						|
        $httpBody = $formParams;
 | 
						|
      }
 | 
						|
 | 
						|
      // make the API Call
 | 
						|
      $response = $this->apiClient->callAPI($resourcePath, $method,
 | 
						|
                                            $queryParams, $httpBody,
 | 
						|
                                            $headerParams);
 | 
						|
 | 
						|
      
 | 
						|
  }
 | 
						|
  
 | 
						|
  /**
 | 
						|
   * getUserByName
 | 
						|
   *
 | 
						|
   * Get user by user name
 | 
						|
   *
 | 
						|
   * @param string $username The name that needs to be fetched. Use user1 for testing.  (required)
 | 
						|
   * @return User
 | 
						|
   */
 | 
						|
   public function getUserByName($username) {
 | 
						|
 | 
						|
      // parse inputs
 | 
						|
      $resourcePath = "/user/{username}";
 | 
						|
      $resourcePath = str_replace("{format}", "json", $resourcePath);
 | 
						|
      $method = "GET";
 | 
						|
      $httpBody = '';
 | 
						|
      $queryParams = array();
 | 
						|
      $headerParams = array();
 | 
						|
      $formParams = array();
 | 
						|
      $_header_accept = 'application/json, application/xml';
 | 
						|
      if ($_header_accept !== '') {
 | 
						|
        $headerParams['Accept'] = $_header_accept;
 | 
						|
      }
 | 
						|
      $_header_content_type = array();
 | 
						|
      $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
 | 
						|
 | 
						|
      
 | 
						|
      
 | 
						|
      // path params
 | 
						|
      if($username !== null) {
 | 
						|
        $resourcePath = str_replace("{" . "username" . "}",
 | 
						|
                                    $this->apiClient->toPathValue($username), $resourcePath);
 | 
						|
      }
 | 
						|
      
 | 
						|
      
 | 
						|
 | 
						|
      // for model (json/xml)
 | 
						|
      if (isset($_tempBody)) {
 | 
						|
        $httpBody = $_tempBody; // $_tempBody is the method argument, if present
 | 
						|
      } else if (count($formParams) > 0) {
 | 
						|
        // for HTTP post (form)
 | 
						|
        $httpBody = $formParams;
 | 
						|
      }
 | 
						|
 | 
						|
      // make the API Call
 | 
						|
      $response = $this->apiClient->callAPI($resourcePath, $method,
 | 
						|
                                            $queryParams, $httpBody,
 | 
						|
                                            $headerParams);
 | 
						|
 | 
						|
      if(! $response) {
 | 
						|
        return null;
 | 
						|
      }
 | 
						|
 | 
						|
  		$responseObject = $this->apiClient->deserialize($response,
 | 
						|
  		                                                'User');
 | 
						|
  		return $responseObject;
 | 
						|
  }
 | 
						|
  
 | 
						|
  /**
 | 
						|
   * updateUser
 | 
						|
   *
 | 
						|
   * Updated user
 | 
						|
   *
 | 
						|
   * @param string $username name that need to be deleted (required)
 | 
						|
   * @param User $body Updated user object (required)
 | 
						|
   * @return void
 | 
						|
   */
 | 
						|
   public function updateUser($username, $body) {
 | 
						|
 | 
						|
      // parse inputs
 | 
						|
      $resourcePath = "/user/{username}";
 | 
						|
      $resourcePath = str_replace("{format}", "json", $resourcePath);
 | 
						|
      $method = "PUT";
 | 
						|
      $httpBody = '';
 | 
						|
      $queryParams = array();
 | 
						|
      $headerParams = array();
 | 
						|
      $formParams = array();
 | 
						|
      $_header_accept = 'application/json, application/xml';
 | 
						|
      if ($_header_accept !== '') {
 | 
						|
        $headerParams['Accept'] = $_header_accept;
 | 
						|
      }
 | 
						|
      $_header_content_type = array();
 | 
						|
      $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
 | 
						|
 | 
						|
      
 | 
						|
      
 | 
						|
      // path params
 | 
						|
      if($username !== null) {
 | 
						|
        $resourcePath = str_replace("{" . "username" . "}",
 | 
						|
                                    $this->apiClient->toPathValue($username), $resourcePath);
 | 
						|
      }
 | 
						|
      
 | 
						|
      // body params
 | 
						|
      $_tempBody = null;
 | 
						|
      if (isset($body)) {
 | 
						|
        $_tempBody = $body;
 | 
						|
      }
 | 
						|
 | 
						|
      // for model (json/xml)
 | 
						|
      if (isset($_tempBody)) {
 | 
						|
        $httpBody = $_tempBody; // $_tempBody is the method argument, if present
 | 
						|
      } else if (count($formParams) > 0) {
 | 
						|
        // for HTTP post (form)
 | 
						|
        $httpBody = $formParams;
 | 
						|
      }
 | 
						|
 | 
						|
      // make the API Call
 | 
						|
      $response = $this->apiClient->callAPI($resourcePath, $method,
 | 
						|
                                            $queryParams, $httpBody,
 | 
						|
                                            $headerParams);
 | 
						|
 | 
						|
      
 | 
						|
  }
 | 
						|
  
 | 
						|
  /**
 | 
						|
   * deleteUser
 | 
						|
   *
 | 
						|
   * Delete user
 | 
						|
   *
 | 
						|
   * @param string $username The name that needs to be deleted (required)
 | 
						|
   * @return void
 | 
						|
   */
 | 
						|
   public function deleteUser($username) {
 | 
						|
 | 
						|
      // parse inputs
 | 
						|
      $resourcePath = "/user/{username}";
 | 
						|
      $resourcePath = str_replace("{format}", "json", $resourcePath);
 | 
						|
      $method = "DELETE";
 | 
						|
      $httpBody = '';
 | 
						|
      $queryParams = array();
 | 
						|
      $headerParams = array();
 | 
						|
      $formParams = array();
 | 
						|
      $_header_accept = 'application/json, application/xml';
 | 
						|
      if ($_header_accept !== '') {
 | 
						|
        $headerParams['Accept'] = $_header_accept;
 | 
						|
      }
 | 
						|
      $_header_content_type = array();
 | 
						|
      $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
 | 
						|
 | 
						|
      
 | 
						|
      
 | 
						|
      // path params
 | 
						|
      if($username !== null) {
 | 
						|
        $resourcePath = str_replace("{" . "username" . "}",
 | 
						|
                                    $this->apiClient->toPathValue($username), $resourcePath);
 | 
						|
      }
 | 
						|
      
 | 
						|
      
 | 
						|
 | 
						|
      // for model (json/xml)
 | 
						|
      if (isset($_tempBody)) {
 | 
						|
        $httpBody = $_tempBody; // $_tempBody is the method argument, if present
 | 
						|
      } else if (count($formParams) > 0) {
 | 
						|
        // for HTTP post (form)
 | 
						|
        $httpBody = $formParams;
 | 
						|
      }
 | 
						|
 | 
						|
      // make the API Call
 | 
						|
      $response = $this->apiClient->callAPI($resourcePath, $method,
 | 
						|
                                            $queryParams, $httpBody,
 | 
						|
                                            $headerParams);
 | 
						|
 | 
						|
      
 | 
						|
  }
 | 
						|
  
 | 
						|
 | 
						|
}
 |