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)
Exemple #2
0
    def take_action(self, parsed_args):
        api = memsource_cli.JobApi(self.app.client)
        response = api.get_part(token=self.app.client.configuration.token,
                                project_uid=parsed_args.project_uid,
                                job_uid=parsed_args.job_uid)

        return utils._print_output(response)
Exemple #3
0
    def take_action(self, parsed_args):
        api = memsource_cli.ProjectTemplateApi(self.app.client)
        response = api.get_project_template(
            token=self.app.client.configuration.token,  # noqa: E501
            project_template_id=parsed_args.project_template_id)

        return utils._print_output(response)
Exemple #4
0
    def take_action(self, parsed_args):
        api = memsource_cli.JobApi(self.app.client)

        _providers = []
        for i in parsed_args.providers:
            provider = i.split('=')
            provider_type = provider[0]
            provider_id = provider[1]
            _providers.append({'type': provider_type, 'id': provider_id})

        _jobs = []
        for i in parsed_args.jobs:
            _jobs.append({'uid': i})

        response = api.edit_parts(token=self.app.client.configuration.token,
                                  project_uid=parsed_args.project_uid,
                                  body={
                                      "status": parsed_args.status,
                                      "providers": _providers,
                                      "dateDue": parsed_args.date_due,
                                      "jobs": _jobs
                                  })
        return utils._print_output(response)
Exemple #5
0
    def take_action(self, parsed_args):

        api = memsource_cli.UserApi(self.app.client)
        response = api.get_user_v2(user_id=parsed_args.user_id,
                                   token=self.app.client.configuration.token)
        return utils._print_output(response)
    def take_action(self, parsed_args):
        api = memsource_cli.AuthenticationApi(self.app.client)
        response = api.who_am_i(token=self.app.client.configuration.token)

        return utils._print_output(response)
Exemple #7
0
    def take_action(self, parsed_args):
        api = memsource_cli.AuthenticationApi(self.app.client)
        response = api.login(body=vars(parsed_args))

        return utils._print_output(response)
Exemple #8
0
    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)