<?php /** * AlphaApi * PHP version 5 * * @category Class * @package HelixWebServices * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2 * @link https://github.com/swagger-api/swagger-codegen */ /** * Copyright 2015 SmartBear Software * * 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. * https://github.com/swagger-api/swagger-codegen * Do not edit the class manually. */ namespace HelixWebServices\Api; use \HelixWebServices\Configuration; use \HelixWebServices\ApiClient; use \HelixWebServices\ApiException; use \HelixWebServices\ObjectSerializer; /** * AlphaApi Class Doc Comment * * @category Class * @package HelixWebServices * @author http://github.com/swagger-api/swagger-codegen * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2 * @link https://github.com/swagger-api/swagger-codegen */ class AlphaApi { /** * API Client * @var \HelixWebServices\ApiClient instance of the ApiClient */ protected $apiClient; /** * Constructor * @param \HelixWebServices\ApiClient|null $apiClient The api client to use */ function __construct($apiClient = null) { if ($apiClient == null) { $apiClient = new ApiClient(); $apiClient->getConfig()->setHost('http://localhost/api'); } $this->apiClient = $apiClient; } /** * Get API client * @return \HelixWebServices\ApiClient get the API client */ public function getApiClient() { return $this->apiClient; } /** * Set the API client * @param \HelixWebServices\ApiClient $apiClient set the API client * @return AlphaApi */ public function setApiClient(ApiClient $apiClient) { $this->apiClient = $apiClient; return $this; } /** * serverChangesPost * * * * @param string $server The server ID that we execute this particular method against. (required) * @param \HelixWebServices\Model\ChangelistRequest $changelist_request Description of changes to make (required) * @return \HelixWebServices\Model\CommandResponse * @throws \HelixWebServices\ApiException on non-2xx response */ public function serverChangesPost($server, $changelist_request) { list($response, $statusCode, $httpHeader) = $this->serverChangesPostWithHttpInfo ($server, $changelist_request); return $response; } /** * serverChangesPostWithHttpInfo * * * * @param string $server The server ID that we execute this particular method against. (required) * @param \HelixWebServices\Model\ChangelistRequest $changelist_request Description of changes to make (required) * @return Array of \HelixWebServices\Model\CommandResponse, HTTP status code, HTTP response headers (array of strings) * @throws \HelixWebServices\ApiException on non-2xx response */ public function serverChangesPostWithHttpInfo($server, $changelist_request) { // verify the required parameter 'server' is set if ($server === null) { throw new \InvalidArgumentException('Missing the required parameter $server when calling serverChangesPost'); } // verify the required parameter 'changelist_request' is set if ($changelist_request === null) { throw new \InvalidArgumentException('Missing the required parameter $changelist_request when calling serverChangesPost'); } // parse inputs $resourcePath = "/p4d/v16.1/{server}/changes"; $resourcePath = str_replace("{format}", "json", $resourcePath); $method = "POST"; $httpBody = ''; $queryParams = array(); $headerParams = array(); $formParams = array(); $_header_accept = ApiClient::selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json')); // path params if ($server !== null) { $resourcePath = str_replace( "{" . "server" . "}", $this->apiClient->getSerializer()->toPathValue($server), $resourcePath ); } // body params $_tempBody = null; if (isset($changelist_request)) { $_tempBody = $changelist_request; } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } // this endpoint requires API key authentication $apiKey = $this->apiClient->getApiKeyWithPrefix('Authorization'); if (strlen($apiKey) !== 0) { $headerParams['Authorization'] = $apiKey; } // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, '\HelixWebServices\Model\CommandResponse' ); if (!$response) { return array(null, $statusCode, $httpHeader); } return array($this->apiClient->getSerializer()->deserialize($response, '\HelixWebServices\Model\CommandResponse', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\HelixWebServices\Model\CommandResponse', $e->getResponseHeaders()); $e->setResponseObject($data); break; } throw $e; } } /** * serverGitFusionReposGet * * * * @param string $server The server ID that we execute this particular method against. (required) * @return \HelixWebServices\Model\GitFusionRepoId[] * @throws \HelixWebServices\ApiException on non-2xx response */ public function serverGitFusionReposGet($server) { list($response, $statusCode, $httpHeader) = $this->serverGitFusionReposGetWithHttpInfo ($server); return $response; } /** * serverGitFusionReposGetWithHttpInfo * * * * @param string $server The server ID that we execute this particular method against. (required) * @return Array of \HelixWebServices\Model\GitFusionRepoId[], HTTP status code, HTTP response headers (array of strings) * @throws \HelixWebServices\ApiException on non-2xx response */ public function serverGitFusionReposGetWithHttpInfo($server) { // verify the required parameter 'server' is set if ($server === null) { throw new \InvalidArgumentException('Missing the required parameter $server when calling serverGitFusionReposGet'); } // parse inputs $resourcePath = "/p4d/v16.1/{server}/git-fusion-repos"; $resourcePath = str_replace("{format}", "json", $resourcePath); $method = "GET"; $httpBody = ''; $queryParams = array(); $headerParams = array(); $formParams = array(); $_header_accept = ApiClient::selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json')); // path params if ($server !== null) { $resourcePath = str_replace( "{" . "server" . "}", $this->apiClient->getSerializer()->toPathValue($server), $resourcePath ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } // this endpoint requires API key authentication $apiKey = $this->apiClient->getApiKeyWithPrefix('Authorization'); if (strlen($apiKey) !== 0) { $headerParams['Authorization'] = $apiKey; } // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, '\HelixWebServices\Model\GitFusionRepoId[]' ); if (!$response) { return array(null, $statusCode, $httpHeader); } return array($this->apiClient->getSerializer()->deserialize($response, '\HelixWebServices\Model\GitFusionRepoId[]', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\HelixWebServices\Model\GitFusionRepoId[]', $e->getResponseHeaders()); $e->setResponseObject($data); break; } throw $e; } } /** * serverGitFusionReposPost * * * * @param string $server The server ID that we execute this particular method against. (required) * @param \HelixWebServices\Model\GitFusionRepoConfig $body The new configuration (required) * @return \HelixWebServices\Model\CommandResponse * @throws \HelixWebServices\ApiException on non-2xx response */ public function serverGitFusionReposPost($server, $body) { list($response, $statusCode, $httpHeader) = $this->serverGitFusionReposPostWithHttpInfo ($server, $body); return $response; } /** * serverGitFusionReposPostWithHttpInfo * * * * @param string $server The server ID that we execute this particular method against. (required) * @param \HelixWebServices\Model\GitFusionRepoConfig $body The new configuration (required) * @return Array of \HelixWebServices\Model\CommandResponse, HTTP status code, HTTP response headers (array of strings) * @throws \HelixWebServices\ApiException on non-2xx response */ public function serverGitFusionReposPostWithHttpInfo($server, $body) { // verify the required parameter 'server' is set if ($server === null) { throw new \InvalidArgumentException('Missing the required parameter $server when calling serverGitFusionReposPost'); } // verify the required parameter 'body' is set if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling serverGitFusionReposPost'); } // parse inputs $resourcePath = "/p4d/v16.1/{server}/git-fusion-repos"; $resourcePath = str_replace("{format}", "json", $resourcePath); $method = "POST"; $httpBody = ''; $queryParams = array(); $headerParams = array(); $formParams = array(); $_header_accept = ApiClient::selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json')); // path params if ($server !== null) { $resourcePath = str_replace( "{" . "server" . "}", $this->apiClient->getSerializer()->toPathValue($server), $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 } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } // this endpoint requires API key authentication $apiKey = $this->apiClient->getApiKeyWithPrefix('Authorization'); if (strlen($apiKey) !== 0) { $headerParams['Authorization'] = $apiKey; } // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, '\HelixWebServices\Model\CommandResponse' ); if (!$response) { return array(null, $statusCode, $httpHeader); } return array($this->apiClient->getSerializer()->deserialize($response, '\HelixWebServices\Model\CommandResponse', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\HelixWebServices\Model\CommandResponse', $e->getResponseHeaders()); $e->setResponseObject($data); break; } throw $e; } } /** * serverGitFusionReposRepoGet * * * * @param string $server The server ID that we execute this particular method against. (required) * @param string $repo The Git Fusion Repo ID (required) * @return \HelixWebServices\Model\GitFusionRepoConfig * @throws \HelixWebServices\ApiException on non-2xx response */ public function serverGitFusionReposRepoGet($server, $repo) { list($response, $statusCode, $httpHeader) = $this->serverGitFusionReposRepoGetWithHttpInfo ($server, $repo); return $response; } /** * serverGitFusionReposRepoGetWithHttpInfo * * * * @param string $server The server ID that we execute this particular method against. (required) * @param string $repo The Git Fusion Repo ID (required) * @return Array of \HelixWebServices\Model\GitFusionRepoConfig, HTTP status code, HTTP response headers (array of strings) * @throws \HelixWebServices\ApiException on non-2xx response */ public function serverGitFusionReposRepoGetWithHttpInfo($server, $repo) { // verify the required parameter 'server' is set if ($server === null) { throw new \InvalidArgumentException('Missing the required parameter $server when calling serverGitFusionReposRepoGet'); } // verify the required parameter 'repo' is set if ($repo === null) { throw new \InvalidArgumentException('Missing the required parameter $repo when calling serverGitFusionReposRepoGet'); } // parse inputs $resourcePath = "/p4d/v16.1/{server}/git-fusion-repos/{repo}"; $resourcePath = str_replace("{format}", "json", $resourcePath); $method = "GET"; $httpBody = ''; $queryParams = array(); $headerParams = array(); $formParams = array(); $_header_accept = ApiClient::selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json')); // path params if ($server !== null) { $resourcePath = str_replace( "{" . "server" . "}", $this->apiClient->getSerializer()->toPathValue($server), $resourcePath ); }// path params if ($repo !== null) { $resourcePath = str_replace( "{" . "repo" . "}", $this->apiClient->getSerializer()->toPathValue($repo), $resourcePath ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } // this endpoint requires API key authentication $apiKey = $this->apiClient->getApiKeyWithPrefix('Authorization'); if (strlen($apiKey) !== 0) { $headerParams['Authorization'] = $apiKey; } // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, '\HelixWebServices\Model\GitFusionRepoConfig' ); if (!$response) { return array(null, $statusCode, $httpHeader); } return array($this->apiClient->getSerializer()->deserialize($response, '\HelixWebServices\Model\GitFusionRepoConfig', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\HelixWebServices\Model\GitFusionRepoConfig', $e->getResponseHeaders()); $e->setResponseObject($data); break; } throw $e; } } /** * serverGitFusionReposRepoDelete * * * * @param string $server The server ID that we execute this particular method against. (required) * @param string $repo The Git Fusion Repo ID (required) * @return \HelixWebServices\Model\CommandResponse * @throws \HelixWebServices\ApiException on non-2xx response */ public function serverGitFusionReposRepoDelete($server, $repo) { list($response, $statusCode, $httpHeader) = $this->serverGitFusionReposRepoDeleteWithHttpInfo ($server, $repo); return $response; } /** * serverGitFusionReposRepoDeleteWithHttpInfo * * * * @param string $server The server ID that we execute this particular method against. (required) * @param string $repo The Git Fusion Repo ID (required) * @return Array of \HelixWebServices\Model\CommandResponse, HTTP status code, HTTP response headers (array of strings) * @throws \HelixWebServices\ApiException on non-2xx response */ public function serverGitFusionReposRepoDeleteWithHttpInfo($server, $repo) { // verify the required parameter 'server' is set if ($server === null) { throw new \InvalidArgumentException('Missing the required parameter $server when calling serverGitFusionReposRepoDelete'); } // verify the required parameter 'repo' is set if ($repo === null) { throw new \InvalidArgumentException('Missing the required parameter $repo when calling serverGitFusionReposRepoDelete'); } // parse inputs $resourcePath = "/p4d/v16.1/{server}/git-fusion-repos/{repo}"; $resourcePath = str_replace("{format}", "json", $resourcePath); $method = "DELETE"; $httpBody = ''; $queryParams = array(); $headerParams = array(); $formParams = array(); $_header_accept = ApiClient::selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json')); // path params if ($server !== null) { $resourcePath = str_replace( "{" . "server" . "}", $this->apiClient->getSerializer()->toPathValue($server), $resourcePath ); }// path params if ($repo !== null) { $resourcePath = str_replace( "{" . "repo" . "}", $this->apiClient->getSerializer()->toPathValue($repo), $resourcePath ); } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } // this endpoint requires API key authentication $apiKey = $this->apiClient->getApiKeyWithPrefix('Authorization'); if (strlen($apiKey) !== 0) { $headerParams['Authorization'] = $apiKey; } // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, '\HelixWebServices\Model\CommandResponse' ); if (!$response) { return array(null, $statusCode, $httpHeader); } return array($this->apiClient->getSerializer()->deserialize($response, '\HelixWebServices\Model\CommandResponse', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\HelixWebServices\Model\CommandResponse', $e->getResponseHeaders()); $e->setResponseObject($data); break; } throw $e; } } /** * serverGitFusionReposRepoPatch * * * * @param string $server The server ID that we execute this particular method against. (required) * @param string $repo The Git Fusion Repo ID (required) * @param \HelixWebServices\Model\GitFusionRepoConfig $body The new configuration (required) * @return \HelixWebServices\Model\CommandResponse * @throws \HelixWebServices\ApiException on non-2xx response */ public function serverGitFusionReposRepoPatch($server, $repo, $body) { list($response, $statusCode, $httpHeader) = $this->serverGitFusionReposRepoPatchWithHttpInfo ($server, $repo, $body); return $response; } /** * serverGitFusionReposRepoPatchWithHttpInfo * * * * @param string $server The server ID that we execute this particular method against. (required) * @param string $repo The Git Fusion Repo ID (required) * @param \HelixWebServices\Model\GitFusionRepoConfig $body The new configuration (required) * @return Array of \HelixWebServices\Model\CommandResponse, HTTP status code, HTTP response headers (array of strings) * @throws \HelixWebServices\ApiException on non-2xx response */ public function serverGitFusionReposRepoPatchWithHttpInfo($server, $repo, $body) { // verify the required parameter 'server' is set if ($server === null) { throw new \InvalidArgumentException('Missing the required parameter $server when calling serverGitFusionReposRepoPatch'); } // verify the required parameter 'repo' is set if ($repo === null) { throw new \InvalidArgumentException('Missing the required parameter $repo when calling serverGitFusionReposRepoPatch'); } // verify the required parameter 'body' is set if ($body === null) { throw new \InvalidArgumentException('Missing the required parameter $body when calling serverGitFusionReposRepoPatch'); } // parse inputs $resourcePath = "/p4d/v16.1/{server}/git-fusion-repos/{repo}"; $resourcePath = str_replace("{format}", "json", $resourcePath); $method = "PATCH"; $httpBody = ''; $queryParams = array(); $headerParams = array(); $formParams = array(); $_header_accept = ApiClient::selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json')); // path params if ($server !== null) { $resourcePath = str_replace( "{" . "server" . "}", $this->apiClient->getSerializer()->toPathValue($server), $resourcePath ); }// path params if ($repo !== null) { $resourcePath = str_replace( "{" . "repo" . "}", $this->apiClient->getSerializer()->toPathValue($repo), $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 } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } // this endpoint requires API key authentication $apiKey = $this->apiClient->getApiKeyWithPrefix('Authorization'); if (strlen($apiKey) !== 0) { $headerParams['Authorization'] = $apiKey; } // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, $method, $queryParams, $httpBody, $headerParams, '\HelixWebServices\Model\CommandResponse' ); if (!$response) { return array(null, $statusCode, $httpHeader); } return array($this->apiClient->getSerializer()->deserialize($response, '\HelixWebServices\Model\CommandResponse', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\HelixWebServices\Model\CommandResponse', $e->getResponseHeaders()); $e->setResponseObject($data); break; } throw $e; } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 19597 | swellard | Refactor REST path | ||
#1 | 19553 | swellard | Move and rename clients | ||
//guest/perforce_software/helix-web-services/main/source/clients/2016.1.0/php/HelixWebServices/lib/Api/AlphaApi.php | |||||
#5 | 19255 | tjuricek |
Change, client, command tests for PHP Client SDK. Changed how array-like query parameters were passed to the server to be consistent with other SDKs. |
||
#4 | 19202 | tjuricek | Revised documentation for the Ruby Client SDK; removed obsolete methods and definitions, and restyled a lot of the tables. | ||
#3 | 19002 | tjuricek |
Improve API to interact with multiple p4ds. The configuration now requires an explicit setting of what P4Ds HWS can talk to via the 'P4D config dir', where there's a file indicating connection settings per p4d, and importantly, an ID. This is the "server ID" referenced everywhere. Most methods now require a server ID to indicate which p4d to manipulate. In the future, it's likely we will interact with *multiple* p4d instances on some services. This completely removes the ability to run HWS as a kind of an "open proxy" to whatever p4d you want. Given the nature of the change and the lack of priority, we've removed Helix Cloud testing and disabled several methods from their "Helix Cloud" implementation. These will be relatively easy to bring back, we'll just need a new method from Raymond that lists the "allowed server IDs" that map to the HWS configured server IDs for a particular user. Another notable aspect of this change is the use of JSON Web Token to create our authentication key. We associate this key with an in-memory "session" that contains the P4D tickets we use to authenticate users. The JWT token, by default, is assigned a timeout, which allows HWS to block further access to underlying servers without having to interact with multiple auth backends. If any backend fails with that session, the user will get a 403. If you disable the timeout, you'll need to ensure your clients clear out sessions. |
||
#2 | 18905 | tjuricek |
Add Git Fusion environent configuration and testing, and altered the implementation to use the newly defined API. Note: only runs on linux. We use latest GF production for testing and GF packages are linux only. The "integration" is pretty "light" at this point. This does require the test machine to have our package repository setup. |
||
#1 | 18811 | tjuricek | Initial PHP client SDK for Helix Web Services. |