def take_action(self, parsed_args): if parsed_args.template_id: api = memsource_cli.ProjectApi(self.app.client) all_params = [ 'name', 'sourceLang', 'workflowSteps', 'dateDue', 'note', 'client', 'businessUnit', 'domain', 'subDomain' ] args = {} parsed = vars(parsed_args) for k, v in parsed.items(): if k in all_params and v is not None: args[k] = v response = api.create_project_from_template_v2( token=self.app.client.configuration.token, # noqa: E501 template_id=parsed_args.template_id, body=vars(parsed_args)) return utils._print_output(response) api = memsource_cli.ProjectApi(self.app.client) response = api.create_project( token=self.app.client.configuration.token, # noqa: E501 body=vars(parsed_args)) return utils._print_output(response)
def take_action(self, parsed_args): api = memsource_cli.ProjectApi(self.app.client) query_params = vars(parsed_args) args = {} all_params = [ 'name', 'client_id', 'client_name', 'business_unit_name', 'statuses', 'target_langs', 'domain_name', 'sub_domain_name', 'cost_center_id', 'cost_center_name', 'due_in_hours', 'created_in_last_hours', 'source_langs', 'owner_id', 'job_statuses', 'job_status_group', 'buyer_id', 'page_number', 'page_size', 'token' ] # noqa: E501 for k, v in query_params.items(): if k in all_params and v is not None: args[k] = v response = api.list_projects(token=self.app.client.configuration.token, **args) column_headers = [ 'uid', 'internal_id', 'id', 'name', 'date_created', 'domain', 'sub_domain', 'owner', 'source_lang', 'target_langs', 'references', 'user_role' ] data = [] output = response.to_dict() content = output['content'] for i in range(0, len(content)): for j in column_headers: if isinstance(content[i][j], dict): content[i][j] = json.dumps(content[i][j]) data += [ (content[i]['uid'], content[i]['internal_id'], content[i]['id'], content[i]['name'], json.dumps(content[i]['date_created'], default=str).replace('"', ''), content[i]['domain'], content[i]['sub_domain'], content[i]['owner'], content[i]['source_lang'], content[i]['target_langs'], json.dumps(content[i]['references']), content[i]['user_role']) ] return ((column_headers), (data))
def take_action(self, parsed_args): api = memsource_cli.ProjectApi(self.app.client) response = api.get_project(token=self.app.client.configuration.token, project_uid=parsed_args.project_uid) return utils._print_output(response)
def take_action(self, parsed_args): api = memsource_cli.ProjectApi(self.app.client) api.delete_project(token=self.app.client.configuration.token, project_uid=parsed_args.project_uid, purge=parsed_args.purge)
def take_action(self, parsed_args): api = memsource_cli.ProjectApi(self.app.client) api.assign_linguists_from_template( token=self.app.client.configuration.token, project_uid=parsed_args.project_uid, template_id=parsed_args.template_id)
def take_action(self, parsed_args): api = memsource_cli.ProjectApi(self.app.client) response = api.create_project(token=self.app.client.configuration.token, # noqa: E501 body=vars(parsed_args)) return utils._print_output(response)