Answer a pending approval

        :param issue_id_or_key: str
        :param approval_id: str
        :param decision: str
        :return:
842
def answer_approval(self, issue_id_or_key, approval_id, decision):
        
        url = 'rest/servicedeskapi/request/{0}/approval/{1}'.format(issue_id_or_key, approval_id)
        data = {'decision': decision}

        return self.post(url, headers=self.experimental_headers, data=data)
508561
def list_issues(context, id, sort, limit):
    

    result = component.list_issues(context, id=id, sort=sort, limit=limit)
    headers = ['id', 'status', 'product', 'component', 'title', 'url']
    utils.format_output(result, context.format, headers)
825217
public function getIssue($issue_key, $expand = '')
	{
		return $this->api(self::REQUEST_GET, sprintf('/rest/api/2/issue/%s', $issue_key), array('expand' => $expand));
	}
1186224
def determine_action(self, issue):
        
        resource_type = self.resource_types[issue.resource.resource_type_id]
        issue_alert_schedule = self.alert_schedule[resource_type] if \
            resource_type in self.alert_schedule \
            else self.alert_schedule['*']

        action_item = {
            'action': None,
            'action_description': None,
            'last_alert': issue.last_alert,
            'issue': issue,
            'resource': self.resource_classes[self.resource_types[issue.resource.resource_type_id]](issue.resource),
            'owners': [],
            'stop_after': issue_alert_schedule['stop'],
            'remove_after': issue_alert_schedule['remove'],
            'notes': issue.notes,
            'missing_tags': issue.missing_tags
        }

        time_elapsed = time.time() - issue.created
        stop_schedule = pytimeparse.parse(issue_alert_schedule['stop'])
        remove_schedule = pytimeparse.parse(issue_alert_schedule['remove'])

        if self.collect_only:
            action_item['action'] = AuditActions.IGNORE
        elif remove_schedule and time_elapsed >= remove_schedule:
            action_item['action'] = AuditActions.REMOVE
            action_item['action_description'] = 'Resource removed'
            action_item['last_alert'] = remove_schedule
            if issue.update({'last_alert': remove_schedule}):
                db.session.add(issue.issue)

        elif stop_schedule and time_elapsed >= stop_schedule:
            action_item['action'] = AuditActions.STOP
            action_item['action_description'] = 'Resource stopped'
            action_item['last_alert'] = stop_schedule
            if issue.update({'last_alert': stop_schedule}):
                db.session.add(issue.issue)

        else:
            alert_selection = self.determine_alert(
                issue_alert_schedule['alert'],
                issue.get_property('created').value,
                issue.get_property('last_alert').value
            )
            if alert_selection:
                action_item['action'] = AuditActions.ALERT
                action_item['action_description'] = '{} alert'.format(alert_selection)
                action_item['last_alert'] = alert_selection
                if issue.update({'last_alert': alert_selection}):
                    db.session.add(issue.issue)
            else:
                action_item['action'] = AuditActions.IGNORE

        db.session.commit()
        return action_item
702994
def get_issue_link_type(self, issue_link_type_id):
        
        url = 'rest/api/2/issueLinkType/{issueLinkTypeId}'.format(issueLinkTypeId=issue_link_type_id)
        return self.get(url)
896929
def CheckApprovalRequest(approval_request):
  """"""

  at = rdf_objects.ApprovalRequest.ApprovalType

  if approval_request.approval_type == at.APPROVAL_TYPE_CLIENT:
    return CheckClientApprovalRequest(approval_request)
  elif approval_request.approval_type == at.APPROVAL_TYPE_HUNT:
    return CheckHuntApprovalRequest(approval_request)
  elif approval_request.approval_type == at.APPROVAL_TYPE_CRON_JOB:
    return CheckCronJobApprovalRequest(approval_request)
  else:
    raise ValueError(
        "Invalid approval type: %s" % approval_request.approval_type)
580518
def issue(self, invoice_id, **kwargs):
        "
        url = "{}/{}/issue".format(self.base_url, invoice_id)
        return self.post_url(url, {}, **kwargs)
586744
def with_statuses(issue_statuses)
      if name == 'status_id'
        format 'Status: %s => %s',
               find_issue_status(issue_statuses, old_value),
               find_issue_status(issue_statuses, new_value)
      else
        to_s
      end
    end
1294965
def get(cls, issue_id):
        
        res = Issue.get(issue_id, IssueType.get(cls.issue_type).issue_type_id)
        return cls(res) if res else None
386534
def issue_instant_ok(self):
        
        upper = time_util.shift_time(time_util.time_in_a_while(days=1),
                                     self.timeslack).timetuple()
        lower = time_util.shift_time(time_util.time_a_while_ago(days=1),
                                     -self.timeslack).timetuple()
        # print("issue_instant: %s" % self.response.issue_instant)
        # print("%s < x < %s" % (lower, upper))
        issued_at = str_to_time(self.response.issue_instant)
        return lower < issued_at < upper
168259
def issue(ctx, accountable, issue_key):
    
    accountable.issue_key = issue_key
    if not ctx.invoked_subcommand:
        issue = accountable.issue_meta()
        headers = issue.keys()
        rows = [headers, [v for k, v in issue.items()]]
        print_table(SingleTable(rows))
627601
def get_issue_comment(self, id):
        
        assert isinstance(id, (int, long)), id
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self._parentUrl(self.issue_url) + "/comments/" + str(id)
        )
        return github.IssueComment.IssueComment(self._requester, headers, data, completed=True)
1093019
def get_sla_by_id(self, issue_id_or_key, sla_id):
        
        url = 'rest/servicedeskapi/request/{0}/sla/{1}'.format(issue_id_or_key, sla_id)

        return self.get(url)
1221872
def issue(self, number):
        
        json = None
        if int(number) > 0:
            url = self._build_url('issues', str(number), base_url=self._api)
            json = self._json(self._get(url), 200)
        return Issue(json, self) if json else None
661782
def handle_decisions(self, event_id, decisions):
        
        # handle each decision separately, in order
        for decision in decisions:
            decision_type = decision["decisionType"]
            attributes_key = "{0}DecisionAttributes".format(
                decapitalize(decision_type))
            attributes = decision.get(attributes_key, {})
            if decision_type == "CompleteWorkflowExecution":
                self.complete(event_id, attributes.get("result"))
            elif decision_type == "FailWorkflowExecution":
                self.fail(event_id, attributes.get(
                    "details"), attributes.get("reason"))
            elif decision_type == "ScheduleActivityTask":
                self.schedule_activity_task(event_id, attributes)
            else:
                # TODO: implement Decision type: CancelTimer
                # TODO: implement Decision type: CancelWorkflowExecution
                # TODO: implement Decision type: ContinueAsNewWorkflowExecution
                # TODO: implement Decision type: RecordMarker
                # TODO: implement Decision type: RequestCancelActivityTask
                # TODO: implement Decision type: RequestCancelExternalWorkflowExecution
                # TODO: implement Decision type: ScheduleLambdaFunction
                # TODO: implement Decision type: SignalExternalWorkflowExecution
                # TODO: implement Decision type: StartChildWorkflowExecution
                # TODO: implement Decision type: StartTimer
                raise NotImplementedError(
                    "Cannot handle decision: {0}".format(decision_type))

        # finally decrement counter if and only if everything went well
        self.open_counts["openDecisionTasks"] -= 1
439870
def _report_problem(self, problem, level=logging.ERROR):
        ''''''
        problem = self.basename + ': ' + problem
        if self._logger.isEnabledFor(level):
            self._problematic = True
        if self._check_raises:
            raise DapInvalid(problem)
        self._logger.log(level, problem)
468703
def can_approve(self, user, **data):
        
        service_id = data.get('service_id', self.service_id)

        try:
            service = yield Service.get(service_id)

            is_repo_admin = user.is_org_admin(service.organisation_id)

            is_reseller_preverifying = user.is_reseller() and data.get('pre_verified', False)

            raise Return(is_repo_admin or is_reseller_preverifying)
        except couch.NotFound:
            pass

        raise Return(False)