2012-09-23 18:38:27 -07:00

274 lines
7.3 KiB
PHP

<?php
/**
* Copyright 2011 Wordnik, 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.
*/
class UserApi {
function __construct($apiClient) {
$this->apiClient = $apiClient;
}
/**
* createUsersWithArrayInput
* Creates list of users with given input array
* body, array[User]: List of user object (required)
* @return
*/
public function createUsersWithArrayInput($body) {
//parse inputs
$resourcePath = "/user.{format}/createWithArray";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
$headerParams = array();
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
/**
* createUser
* Create user
* body, User: Created user object (required)
* @return
*/
public function createUser($body) {
//parse inputs
$resourcePath = "/user.{format}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
$headerParams = array();
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
/**
* createUsersWithListInput
* Creates list of users with given list input
* body, List[User]: List of user object (required)
* @return
*/
public function createUsersWithListInput($body) {
//parse inputs
$resourcePath = "/user.{format}/createWithList";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
$headerParams = array();
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
/**
* updateUser
* Updated user
* username, string: name that need to be deleted (required)
* body, User: Updated user object (required)
* @return
*/
public function updateUser($username, $body) {
//parse inputs
$resourcePath = "/user.{format}/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PUT";
$queryParams = array();
$headerParams = array();
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
$username, $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
/**
* deleteUser
* Delete user
* username, string: The name that needs to be deleted (required)
* @return
*/
public function deleteUser($username) {
//parse inputs
$resourcePath = "/user.{format}/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE";
$queryParams = array();
$headerParams = array();
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
$username, $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
/**
* getUserByName
* Get user by user name
* username, string: The name that needs to be fetched. Use user1 for testing. (required)
* @return User
*/
public function getUserByName($username) {
//parse inputs
$resourcePath = "/user.{format}/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
$username, $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'User');
return $responseObject;
}
/**
* loginUser
* Logs user into the system
* username, string: The user name for login (required)
* password, string: The password for login in clear text (required)
* @return string
*/
public function loginUser($username, $password) {
//parse inputs
$resourcePath = "/user.{format}/login";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
if($username != null) {
$queryParams['username'] = $this->apiClient->toPathValue($username);
}
if($password != null) {
$queryParams['password'] = $this->apiClient->toPathValue($password);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'string');
return $responseObject;
}
/**
* logoutUser
* Logs out current logged in user session
* @return
*/
public function logoutUser() {
//parse inputs
$resourcePath = "/user.{format}/logout";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
}