# coding: utf-8 """ AlphaApi.py 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. """ from __future__ import absolute_import import sys import os # python 2 and python 3 compatibility library from six import iteritems from ..configuration import Configuration from ..api_client import ApiClient class AlphaApi(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): config = Configuration() if api_client: self.api_client = api_client else: if not config.api_client: config.api_client = ApiClient() self.api_client = config.api_client def server_changes_post(self, server, changelist_request, **kwargs): """ Create a new changelist that can affect multiple files using different kinds of actions.\nIf you require the ability to integrate or move, for example, you can use this method. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.server_changes_post(server, changelist_request, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str server: The server ID that we execute this particular method against. (required) :param ChangelistRequest changelist_request: Description of changes to make (required) :return: CommandResponse If the method is called asynchronously, returns the request thread. """ all_params = ['server', 'changelist_request'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method server_changes_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'server' is set if ('server' not in params) or (params['server'] is None): raise ValueError("Missing the required parameter `server` when calling `server_changes_post`") # verify the required parameter 'changelist_request' is set if ('changelist_request' not in params) or (params['changelist_request'] is None): raise ValueError("Missing the required parameter `changelist_request` when calling `server_changes_post`") resource_path = '/p4d/v16.1/{server}/changes'.replace('{format}', 'json') method = 'POST' path_params = {} if 'server' in params: path_params['server'] = params['server'] query_params = {} header_params = {} form_params = {} files = {} body_params = None if 'changelist_request' in params: body_params = params['changelist_request'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['ticket_auth'] response = self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, files=files, response_type='CommandResponse', auth_settings=auth_settings, callback=params.get('callback')) return response def server_git_fusion_repos_get(self, server, **kwargs): """ Lists all configured repositories readable by the current user. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.server_git_fusion_repos_get(server, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str server: The server ID that we execute this particular method against. (required) :return: list[GitFusionRepoId] If the method is called asynchronously, returns the request thread. """ all_params = ['server'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method server_git_fusion_repos_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'server' is set if ('server' not in params) or (params['server'] is None): raise ValueError("Missing the required parameter `server` when calling `server_git_fusion_repos_get`") resource_path = '/p4d/v16.1/{server}/git-fusion-repos'.replace('{format}', 'json') method = 'GET' path_params = {} if 'server' in params: path_params['server'] = params['server'] query_params = {} header_params = {} form_params = {} files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['ticket_auth'] response = self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, files=files, response_type='list[GitFusionRepoId]', auth_settings=auth_settings, callback=params.get('callback')) return response def server_git_fusion_repos_post(self, server, body, **kwargs): """ Submits a [p4gf_config](http://www.perforce.com/perforce/r15.1/manuals/git-fusion/chapter_dyn_ngj_3l.html#section_jgz_nz2_2j) file to create or update a repository configuration.\n\nIf the repository does not exist or has been previously deleted, this method saves contents of the config file to a new `p4gf_config` file.\nIf the repository has already been initialised, this method replaces all of the file contents of the specified repository's `p4gf_config` file. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.server_git_fusion_repos_post(server, body, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str server: The server ID that we execute this particular method against. (required) :param GitFusionRepoConfig body: The new configuration (required) :return: CommandResponse If the method is called asynchronously, returns the request thread. """ all_params = ['server', 'body'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method server_git_fusion_repos_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'server' is set if ('server' not in params) or (params['server'] is None): raise ValueError("Missing the required parameter `server` when calling `server_git_fusion_repos_post`") # verify the required parameter 'body' is set if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `server_git_fusion_repos_post`") resource_path = '/p4d/v16.1/{server}/git-fusion-repos'.replace('{format}', 'json') method = 'POST' path_params = {} if 'server' in params: path_params['server'] = params['server'] query_params = {} header_params = {} form_params = {} files = {} body_params = None if 'body' in params: body_params = params['body'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['ticket_auth'] response = self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, files=files, response_type='CommandResponse', auth_settings=auth_settings, callback=params.get('callback')) return response def server_git_fusion_repos_repo_get(self, server, repo, **kwargs): """ Return configuration for the specified repository.\nGrabs and returns contents of the [p4gf_config](http://www.perforce.com/perforce/r15.1/manuals/git-fusion/chapter_dyn_ngj_3l.html#section_jgz_nz2_2j) file for given repository. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.server_git_fusion_repos_repo_get(server, repo, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str server: The server ID that we execute this particular method against. (required) :param str repo: The Git Fusion Repo ID (required) :return: GitFusionRepoConfig If the method is called asynchronously, returns the request thread. """ all_params = ['server', 'repo'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method server_git_fusion_repos_repo_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'server' is set if ('server' not in params) or (params['server'] is None): raise ValueError("Missing the required parameter `server` when calling `server_git_fusion_repos_repo_get`") # verify the required parameter 'repo' is set if ('repo' not in params) or (params['repo'] is None): raise ValueError("Missing the required parameter `repo` when calling `server_git_fusion_repos_repo_get`") resource_path = '/p4d/v16.1/{server}/git-fusion-repos/{repo}'.replace('{format}', 'json') method = 'GET' path_params = {} if 'server' in params: path_params['server'] = params['server'] if 'repo' in params: path_params['repo'] = params['repo'] query_params = {} header_params = {} form_params = {} files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['ticket_auth'] response = self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, files=files, response_type='GitFusionRepoConfig', auth_settings=auth_settings, callback=params.get('callback')) return response def server_git_fusion_repos_repo_delete(self, server, repo, **kwargs): """ Deletes the repository configuration (The [p4gf_config file](http://www.perforce.com/perforce/r15.1/manuals/git-fusion/chapter_dyn_ngj_3l.html#section_jgz_nz2_2j)).\nContents of the repository are not deleted from Perforce. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.server_git_fusion_repos_repo_delete(server, repo, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str server: The server ID that we execute this particular method against. (required) :param str repo: The Git Fusion Repo ID (required) :return: CommandResponse If the method is called asynchronously, returns the request thread. """ all_params = ['server', 'repo'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method server_git_fusion_repos_repo_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'server' is set if ('server' not in params) or (params['server'] is None): raise ValueError("Missing the required parameter `server` when calling `server_git_fusion_repos_repo_delete`") # verify the required parameter 'repo' is set if ('repo' not in params) or (params['repo'] is None): raise ValueError("Missing the required parameter `repo` when calling `server_git_fusion_repos_repo_delete`") resource_path = '/p4d/v16.1/{server}/git-fusion-repos/{repo}'.replace('{format}', 'json') method = 'DELETE' path_params = {} if 'server' in params: path_params['server'] = params['server'] if 'repo' in params: path_params['repo'] = params['repo'] query_params = {} header_params = {} form_params = {} files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['ticket_auth'] response = self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, files=files, response_type='CommandResponse', auth_settings=auth_settings, callback=params.get('callback')) return response def server_git_fusion_repos_repo_patch(self, server, repo, body, **kwargs): """ Updates values in the repository configuration.\nThis method will find all specified parameters and update each value for the specified repository's configuration file. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.server_git_fusion_repos_repo_patch(server, repo, body, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str server: The server ID that we execute this particular method against. (required) :param str repo: The Git Fusion Repo ID (required) :param GitFusionRepoConfig body: The new configuration (required) :return: CommandResponse If the method is called asynchronously, returns the request thread. """ all_params = ['server', 'repo', 'body'] all_params.append('callback') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method server_git_fusion_repos_repo_patch" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'server' is set if ('server' not in params) or (params['server'] is None): raise ValueError("Missing the required parameter `server` when calling `server_git_fusion_repos_repo_patch`") # verify the required parameter 'repo' is set if ('repo' not in params) or (params['repo'] is None): raise ValueError("Missing the required parameter `repo` when calling `server_git_fusion_repos_repo_patch`") # verify the required parameter 'body' is set if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `server_git_fusion_repos_repo_patch`") resource_path = '/p4d/v16.1/{server}/git-fusion-repos/{repo}'.replace('{format}', 'json') method = 'PATCH' path_params = {} if 'server' in params: path_params['server'] = params['server'] if 'repo' in params: path_params['repo'] = params['repo'] query_params = {} header_params = {} form_params = {} files = {} body_params = None if 'body' in params: body_params = params['body'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['ticket_auth'] response = self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, files=files, response_type='CommandResponse', auth_settings=auth_settings, callback=params.get('callback')) return response