def create_profile(self, url: str, name, type, bundle_id, cerificate_id, devices): params = { 'data': { 'attributes': { 'name': name, 'profileType': type }, 'relationships': { 'bundleId': { 'data': { 'id': bundle_id, 'type': 'bundleIds' } }, 'certificates': { 'data': [{ 'id': cerificate_id, 'type': 'certificates' }] }, }, 'type': 'profiles' } } # App Store profile must not include devices relationship if type != 'IOS_APP_STORE': params['data']['relationships']['devices'] = {'data': devices} connectool.prints(url) connectool.prints(params) return netmanager.post(url, params=params, header=self.__header)
def register_certificate(self, url: str, csr, type): connectool.prints(url) params = { 'data': { 'attributes': { 'certificateType': type, 'csrContent': csr }, 'type': 'certificates' } } connectool.prints(params) return netmanager.post(url, params=params, header=self.__header)
def create_profile(self,url:str,name,type,bundle_id,cerificate_id,devices): params = {'data':{ 'attributes':{'name':name,'profileType':type}, 'relationships':{ 'bundleId':{'data':{'id':bundle_id,'type':'bundleIds'}}, 'certificates':{'data':[{'id':cerificate_id,'type':'certificates'}]}, 'devices':{'data':devices}}, 'type':'profiles' } } connectool.prints(url) connectool.prints(params) return netmanager.post(url,params=params,header=self.__header)
def register_device(self, url: str, name, udid): params = { 'data': { 'attributes': { 'name': name, 'udid': udid, 'platform': 'IOS' }, 'type': 'devices' } } connectool.prints(url) connectool.prints(params) return netmanager.post(url, params=params, header=self.__header)
def register_bundle_id(self, url: str, bundle_id, team_id, name): params = { 'data': { 'attributes': { 'identifier': bundle_id, 'name': name, 'platform': 'IOS', 'seedId': team_id }, 'type': 'bundleIds' } } connectool.prints(url) connectool.prints(params) return netmanager.post(url, params=params, header=self.__header)
def __set_key_path(self,value): self.__key_path = None if value and os.path.exists(value): self.__key_path = value else : home = os.environ['HOME'] for path in os.listdir(home): if 'private_keys' in path: private_keys_path = os.path.join(home,path,'AuthKey_'+self.__keyId+'.p8') if os.path.exists(private_keys_path): self.__key_path = private_keys_path connectool.prints(self.__key_path) break if not self.__key_path: raise Exception('private_keys not exist')
def get_bundle_id_profiles(self,url:str,id): url = url+'/'+id+'/profiles' connectool.prints(url) connectool.prints(self.__header) return netmanager.get(url,header=self.__header)
def delete_bundle_id(self,url:str,id): connectool.prints(url) connectool.prints(self.__header) return netmanager.delete(url,path=id,header=self.__header)
def list_bundle_ids(self,url:str,limit,sort): params = {'limit':limit,'sort':sort} connectool.prints(url) connectool.prints(self.__header) connectool.prints(params) return netmanager.get(url,params= params,header=self.__header)
def request_profile(self,url:str,id): url = url+'/'+id connectool.prints(url) connectool.prints(self.__header) return netmanager.get(url,header=self.__header)
def __private_key(self): with open(self.__key_path,'r') as fp: try: return fp.read() except Exception as excep: connectool.prints(excep)