rebuilt client

This commit is contained in:
Tony Tam
2015-02-15 22:04:50 -08:00
parent 1556bf16a9
commit ffe5353987
10 changed files with 1010 additions and 754 deletions

View File

@@ -1,6 +1,6 @@
<?php
/**
* Copyright 2014 Reverb Technologies, Inc.
* 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.
@@ -25,275 +25,381 @@ class UserApi {
$this->apiClient = $apiClient;
}
/**
* 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/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PUT";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
$this->apiClient->toPathValue($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/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
$this->apiClient->toPathValue($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/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
$this->apiClient->toPathValue($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/login";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($username != null) {
$queryParams['username'] = $this->apiClient->toQueryValue($username);
}
if($password != null) {
$queryParams['password'] = $this->apiClient->toQueryValue($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/logout";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
//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
*
* @return
*/
public function createUser($body) {
//parse inputs
// parse inputs
$resourcePath = "/user";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
//make the API Call
if (! isset($body)) {
$body = null;
// body params
$body = null;
if (isset($body)) {
$body = $body;
}
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body);
}
// make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
/**
}
/**
* createUsersWithArrayInput
*
* Creates list of users with given input array
* body, array[User]: List of user object (required)
* @return
*
* @return
*/
public function createUsersWithArrayInput($body) {
//parse inputs
// parse inputs
$resourcePath = "/user/createWithArray";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
//make the API Call
if (! isset($body)) {
$body = null;
// body params
$body = null;
if (isset($body)) {
$body = $body;
}
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body);
}
// make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
/**
}
/**
* createUsersWithListInput
* Creates list of users with given list input
*
* Creates list of users with given input array
* body, array[User]: List of user object (required)
* @return
*
* @return
*/
public function createUsersWithListInput($body) {
//parse inputs
// parse inputs
$resourcePath = "/user/createWithList";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
//make the API Call
if (! isset($body)) {
$body = null;
// body params
$body = null;
if (isset($body)) {
$body = $body;
}
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body);
}
// make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
/**
* 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/login";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
// query params
if($username != null) {
$queryParams['username'] = $this->apiClient->toQueryValue($username);
}// query params
if($password != null) {
$queryParams['password'] = $this->apiClient->toQueryValue($password);
}
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body);
}
// make the API Call
$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/logout";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body);
}
// make the API Call
$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/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
// path params
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
$this->apiClient->toPathValue($username), $resourcePath);
}
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body);
}
// make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response) {
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'User');
return $responseObject;
}
/**
* 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/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PUT";
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
// path params
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
$this->apiClient->toPathValue($username), $resourcePath);
}
// body params
$body = null;
if (isset($body)) {
$body = $body;
}
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body);
}
// make the API Call
$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/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE";
$queryParams = array();
$headerParams = array();
$formParams = array();
$headerParams['Accept'] = 'application/json,application/xml';
$headerParams['Content-Type'] = '';
// path params
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
$this->apiClient->toPathValue($username), $resourcePath);
}
$body = $body ?: $formParams;
if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") > -1) {
$body = http_build_query($body);
}
// make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
}