github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/clients/python/bacalhau_apiclient/api/misc_api.py (about) 1 # coding: utf-8 2 3 """ 4 Bacalhau API 5 6 This page is the reference of the Bacalhau REST API. Project docs are available at https://docs.bacalhau.org/. Find more information about Bacalhau at https://github.com/filecoin-project/bacalhau. # noqa: E501 7 8 OpenAPI spec version: 0.3.22.post4 9 Contact: team@bacalhau.org 10 Generated by: https://github.com/swagger-api/swagger-codegen.git 11 """ 12 13 14 from __future__ import absolute_import 15 16 import re # noqa: F401 17 18 # python 2 and python 3 compatibility library 19 import six 20 21 from bacalhau_apiclient.api_client import ApiClient 22 23 24 class MiscApi(object): 25 """NOTE: This class is auto generated by the swagger code generator program. 26 27 Do not edit the class manually. 28 Ref: https://github.com/swagger-api/swagger-codegen 29 """ 30 31 def __init__(self, api_client=None): 32 if api_client is None: 33 api_client = ApiClient() 34 self.api_client = api_client 35 36 def api_serverversion(self, version_request, **kwargs): # noqa: E501 37 """Returns the build version running on the server. # noqa: E501 38 39 See https://github.com/filecoin-project/bacalhau/releases for a complete list of `gitversion` tags. # noqa: E501 40 This method makes a synchronous HTTP request by default. To make an 41 asynchronous HTTP request, please pass async_req=True 42 >>> thread = api.api_serverversion(version_request, async_req=True) 43 >>> result = thread.get() 44 45 :param async_req bool 46 :param VersionRequest version_request: Request must specify a `client_id`. To retrieve your `client_id`, you can do the following: (1) submit a dummy job to Bacalhau (or use one you created before), (2) run `bacalhau describe <job-id>` and fetch the `ClientID` field. (required) 47 :return: VersionResponse 48 If the method is called asynchronously, 49 returns the request thread. 50 """ 51 kwargs['_return_http_data_only'] = True 52 if kwargs.get('async_req'): 53 return self.api_serverversion_with_http_info(version_request, **kwargs) # noqa: E501 54 else: 55 (data) = self.api_serverversion_with_http_info(version_request, **kwargs) # noqa: E501 56 return data 57 58 def api_serverversion_with_http_info(self, version_request, **kwargs): # noqa: E501 59 """Returns the build version running on the server. # noqa: E501 60 61 See https://github.com/filecoin-project/bacalhau/releases for a complete list of `gitversion` tags. # noqa: E501 62 This method makes a synchronous HTTP request by default. To make an 63 asynchronous HTTP request, please pass async_req=True 64 >>> thread = api.api_serverversion_with_http_info(version_request, async_req=True) 65 >>> result = thread.get() 66 67 :param async_req bool 68 :param VersionRequest version_request: Request must specify a `client_id`. To retrieve your `client_id`, you can do the following: (1) submit a dummy job to Bacalhau (or use one you created before), (2) run `bacalhau describe <job-id>` and fetch the `ClientID` field. (required) 69 :return: VersionResponse 70 If the method is called asynchronously, 71 returns the request thread. 72 """ 73 74 all_params = ['version_request'] # noqa: E501 75 all_params.append('async_req') 76 all_params.append('_return_http_data_only') 77 all_params.append('_preload_content') 78 all_params.append('_request_timeout') 79 80 params = locals() 81 for key, val in six.iteritems(params['kwargs']): 82 if key not in all_params: 83 raise TypeError( 84 "Got an unexpected keyword argument '%s'" 85 " to method api_serverversion" % key 86 ) 87 params[key] = val 88 del params['kwargs'] 89 # verify the required parameter 'version_request' is set 90 if self.api_client.client_side_validation and ('version_request' not in params or 91 params['version_request'] is None): # noqa: E501 92 raise ValueError("Missing the required parameter `version_request` when calling `api_serverversion`") # noqa: E501 93 94 collection_formats = {} 95 96 path_params = {} 97 98 query_params = [] 99 100 header_params = {} 101 102 form_params = [] 103 local_var_files = {} 104 105 body_params = None 106 if 'version_request' in params: 107 body_params = params['version_request'] 108 # HTTP header `Accept` 109 header_params['Accept'] = self.api_client.select_header_accept( 110 ['application/json']) # noqa: E501 111 112 # HTTP header `Content-Type` 113 header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 114 ['application/json']) # noqa: E501 115 116 # Authentication setting 117 auth_settings = [] # noqa: E501 118 119 return self.api_client.call_api( 120 '/version', 'POST', 121 path_params, 122 query_params, 123 header_params, 124 body=body_params, 125 post_params=form_params, 126 files=local_var_files, 127 response_type='VersionResponse', # noqa: E501 128 auth_settings=auth_settings, 129 async_req=params.get('async_req'), 130 _return_http_data_only=params.get('_return_http_data_only'), 131 _preload_content=params.get('_preload_content', True), 132 _request_timeout=params.get('_request_timeout'), 133 collection_formats=collection_formats)